shader

Why does my three.js canvas masking not work?

这一生的挚爱 提交于 2019-12-13 08:43:39
问题 I'm trying to reproduce example of Szenia Zadvornykh presented here https://medium.com/@Zadvorsky/webgl-masking-composition-75b82dd4cdfd His demo is based on three.js r80, so I referenced r101 and tried to remove most of unrelated parts, and just have scene with grid and png mask on top. Here's my code: http://jsfiddle.net/mmalex/y2kt3Lrf/ Having commented // composer.addPass(maskPass) the grid shows up. But it does not seem like uniform sampler2D tDiffuse has the output of render pass. I

SceneKit shader not working

空扰寡人 提交于 2019-12-13 06:59:53
问题 I'm trying to work with shaders in SceneKit on iOS 8. Here is my code: let sphere = SCNSphere(radius: 6) sphere.segmentCount = 100 sphere.firstMaterial?.diffuse.contents = UIImage(named: "noise.png") sphere.firstMaterial?.diffuse.wrapS = SCNWrapMode.Repeat sphere.firstMaterial?.diffuse.wrapT = SCNWrapMode.Repeat sphere.firstMaterial?.reflective.contents = UIImage(named: "envmap3") sphere.firstMaterial?.fresnelExponent = 1.3 let sphereNode = SCNNode(geometry: sphere) sphereNode.position =

how to do particles texture mapping with three.js shaderMaterial?

我与影子孤独终老i 提交于 2019-12-13 06:14:09
问题 what I'm trying to achieve is having a particle system where each particle have a portion of a given texture. Below is a example of a particles's buffergeometry using a shader material. so far I can make it look almost as it should, nonetheless, I dont know how to properly program the fragment shader in order to have the correct offset of the texture on each particle. the texture is 500x500px which is the same amount of particles. http://www.pruebasmemo.co.nf/ fragment shader code: uniform

SystemAccessViolationException in OpenTK.dll using Shaders

徘徊边缘 提交于 2019-12-13 05:37:46
问题 Using OpenTK to attempt to create shaders in C#, repeatedly getting memory access violation errors. Any help would be appreciated. Here is the class I am having errors with, full code will be able to be found at https://github.com/Autodesk/synthesis/engine-research/OpenTKBuild Error at Line 53 : An unhandled exception of type 'System.AccessViolationException' occurred in OpenTK.dll Additional information: Attempted to read or write protected memory. This is often an indication that other

Mismatch between input assembler and vertex shader - but it looks right

余生颓废 提交于 2019-12-13 05:26:32
问题 I had a similar issue someone kindly solved here, but that led me to this one. The error is: "Input Assembler - Vertex Shader linkage error: Signatures between stages are incompatible. The input stage requires Semantic/Index (SV_POSITION,0) as input, but it is not provided by the output stage." Here is my declaration and the vertex shader input. Can anyone tell me why they wouldn't match? I'm stumped. static const D3D11_INPUT_ELEMENT_DESC vertexLayout[] = { { "SV_POSITION", 0, DXGI_FORMAT

No uniform with name in shader

∥☆過路亽.° 提交于 2019-12-13 04:50:59
问题 I'm new to all this shader stuff, and right not I'm simply trying to replace the default SpriteBatch renderer in LibGDX. I copy pasted the default shader and tried to add a mouse uniform, but it gives me the 'No uniform with name 'u_mouse' in shader. This is all the related code: String vertexShader = "attribute vec4 " + ShaderProgram.POSITION_ATTRIBUTE + ";\n" // + "attribute vec4 " + ShaderProgram.COLOR_ATTRIBUTE + ";\n" // + "attribute vec2 " + ShaderProgram.TEXCOORD_ATTRIBUTE + "0;\n" //

will this sinus approximation be faster than a shader CG sinus function?

£可爱£侵袭症+ 提交于 2019-12-13 04:48:38
问题 I have some functions that are not really sines but they are a lot quicker than conventional processing, they are simple parabole functions. Will this be faster on a graphics processor than the built-in graphics sinus function: float par (float xx){////// sinus approximation half xd =((fmod(abs(xx), 2.4)) - 1.2); if ( fmod (abs(xx) , 4.8) > 2.4) { xd=(-xd*xd)+2.88;} else {xd = xd*xd;} xd = -xd*0.694444444+1; if ( (xx<0) ) { xd=-xd;} return xd; } 回答1: MAIN ANSWER There is absolutely no way

Simple color GLSL shader doesn't output anything

冷暖自知 提交于 2019-12-13 04:23:51
问题 I'm trying to draw a sphere with just a diffuse color, but nothing shows up. All the OpenGL code should be correct, because if I swap the "color" shader with "textured" shader, everything shows up nicely. This is the shader selection code. The if-branch is for the textured objects, and the else-branch is for color-only objects. GL.Disable(EnableCap.Blend); if (phong.diffuseTexture != 0) { texturedShader.Enable(); GL.UniformMatrix4(texturedShader.GetUniformLocation("view"), false, ref camView)

How can I convert these fragColor code snippets from ShaderToy so that they will work in Unity?

笑着哭i 提交于 2019-12-13 03:45:25
问题 I'm following this tutorial: https://www.youtube.com/watch?v=CzORVWFvZ28 to convert some code from ShaderToy to Unity. This is the shader that I'm attempting to convert: https://www.shadertoy.com/view/Ws23WD. I saw that in the tutorial, he was able to take his fragColor statement from ShaderToy and simply return a color in Unity instead. However, when I tried doing that with the code that I have from ShaderToy, an error about not being able to implicitly convert from float3 to float4 popped

Receive and cast shadows (custom GEOMETRY Grass Shader) - Unity C#

ぃ、小莉子 提交于 2019-12-13 03:19:27
问题 I was following a tutorial made by Sam Wronski aka. World of Zero (Tutorial by World of Zero) where he codes a geometry shader for a point cloud grass generator. Great tutorial but I am wondering (and didn't find a proper solution after days of research) how I could implement shadows to the shader (casting and receiving shadows). I am trying to dig deeper into shaders, but this is a level to high for me yet. My question is : how can I implement shadow casting and receiving for this grass