shader

How to use SCNTechnique to create a “masked” portal effect in SceneKit / ARKit?

巧了我就是萌 提交于 2019-12-23 03:36:10
问题 I'm trying to wrap my head around how to use SCNTechnique with Scenekit. The effect I'm trying to create can easily be achieved in Unity by adding a custom shader to two materials, making objects with the "filtered" shader to only be visible when it is seen through the other shader (the portal). I've followed this tutorial to create this in Unity: https://www.youtube.com/watch?v=b9xUO0zHNXw I'm trying to achieve the same effect in SceneKit, but I'm not sure how to apply the passes. I'm

How to render a mesh behind another mesh, like a mask?

空扰寡人 提交于 2019-12-23 03:25:16
问题 I would like it so that when mesh A (the character), is behind mesh B (a wall), it is still rendered but with a solid gray color. I'm beginning opengles 2.0 and I'm still unsure as to go about this. From what I understand the depth buffer allows meshes to fight out who will be seen in the fragments they encompass, also there are various blend functions that could possibly involved in this, finally the stencil buffer looks like it would also have this desirable functionality. So is there a way

Multiple subroutine types defined in the same fragment shader does not work correctly using GLSL Shaders

最后都变了- 提交于 2019-12-22 17:54:23
问题 I'm working on a program using GLSL shaders. I coded 2 different ways to compute ADS (Ambient + Diffuse + Specular) shading in 2 different methods. To do the job properly I used subroutines to use one or the other method to compute ADS shading. Here's a piece of the fragment shader code : subroutine vec3 LightShadingEffectType(int idx, vec3 normal, vec3 lightDir); subroutine uniform LightShadingEffectType LightShadingEffect; subroutine (LightShadingEffectType) vec3 Basic_ADS_Shading(int idx,

Multiple subroutine types defined in the same fragment shader does not work correctly using GLSL Shaders

亡梦爱人 提交于 2019-12-22 17:54:03
问题 I'm working on a program using GLSL shaders. I coded 2 different ways to compute ADS (Ambient + Diffuse + Specular) shading in 2 different methods. To do the job properly I used subroutines to use one or the other method to compute ADS shading. Here's a piece of the fragment shader code : subroutine vec3 LightShadingEffectType(int idx, vec3 normal, vec3 lightDir); subroutine uniform LightShadingEffectType LightShadingEffect; subroutine (LightShadingEffectType) vec3 Basic_ADS_Shading(int idx,

How Might I organize vertex data in WebGL for a frame-by-frame (very specific) animated program?

萝らか妹 提交于 2019-12-22 16:29:54
问题 I have been working on an animated graphics project with very specific requirements, and after quite a bit of searching and test coding, I have figured that I could take several approaches, but the Khronos and MDN documentation I have been reading coupled with other posts I have seen here don't answer all of my questions regarding my particular project. In the meantime, I have written short test programs (setting infrastructure for testing). Firstly, I should describe the project: The main

Unity ShaderGraph

≯℡__Kan透↙ 提交于 2019-12-22 14:14:23
怎样使用Unity ShaderGraph 这边给大家总结一下,这边想要使用Unity ShaderGraph需要 Unity 2018.1以上的版本。 需要在window-pacakgemanager-all下面下载Lightweight Render以及ShaderGraph两个包。 然后在文件夹界面右键create-Rendering下创建一个LightWeightPipelineAsset, 之后Edit-ProjectSettings-Graphcs。将刚刚创建好的LightWeightPipelineAsset放入ScriptRenderingPipelineSetting一栏。 之后再文件夹界面右键create-shader-PBR Graph。双击进入Shader,就可以进入ShaderGraph的界面了。 来源: CSDN 作者: 绀目澄清 链接: https://blog.csdn.net/u013628121/article/details/103651234

LibGDX assigning a specific shader to a ModelInstance

旧巷老猫 提交于 2019-12-22 13:59:46
问题 I have recently been learning an implementing my own shaders in libgdx. So far I did this with a custom shader provider, which chooses between a few shaders based on the userdata value of the object; public class MyShaderProvider extends DefaultShaderProvider { public final DefaultShader.Config config; final static String logstag = "ME.MyShaderProvider"; //known shaders static public enum shadertypes { prettynoise, invert, standardlibgdx, noise, distancefield, conceptbeam } public

Libgdx, Alpha Text using Shader not working

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-22 13:58:13
问题 I have some trouble applying alpha in Text (with shaders) using Stage action. I'm using Group that add Window actor and Window add Label actor. My other actor in group working fine applying Actions alpha but my label (draw using shaders) not working, the different with other widget is my text label are applying shaders. font.frag uniform sampler2D u_texture; varying vec4 v_color; varying vec2 v_texCoord; const float smoothing = 0.2; void main() { float distance = texture2D(u_texture, v

Passing an array of vec2 to shader in THREE.js

妖精的绣舞 提交于 2019-12-22 11:32:05
问题 I've been searching the web for a while now and did not find the correct answer yet. I found the list of uniform types THREE.js uses, and I think the following code should be correct. At the last line I define an uniform array of Vector2. uniforms: { "center": { type: "v2", value: new THREE.Vector2( 0.5, 0.5 ) }, "aspectRatio": { type: "f", value: null }, "radius": { type: "f", value: 0.1 }, "pointList": { type: "v2v", value: [] }, }, In my js script I pass this array as follows. This should

Metal shader in SceneKit to outline an object

对着背影说爱祢 提交于 2019-12-22 10:55:30
问题 I'm playing around and trying to implement Metal shader in SceneKit that will outline an object. The idea is to draw an outline (or silhouette) similar to this image found in this blogpost (the blogpost doesn't contain any code): I'm new to SceneKit and Metal shaders so I'm able just to draw some geometry and write simple vertex or fragment shader. I'm curious how can I achieve this kind of effect? Is it done in multiple passes? Cheers! 回答1: The basic idea here is to clone the "selected" node