pixel-shader

HLSL for getting cylinder effect

[亡魂溺海] 提交于 2019-11-29 12:16:58
I need to write an application with Silverlight 4 and need to show images like wrapped on cylinder. I need some HLSL code, as I wont to do that with Effects of Silverlight. I don't wont to do that with 3D libarries for silverlight. I only need HLSL code for changing pixels. I need for my image to look like this Thanks. This seems to be the effect you want, you may wish to change the 0.2 value to increase or decrease the effect or make this adjustable in your shader but that's a simple change to do. I'd recommend Shazzam if your not using it for writing shaders for WPF or Silverlight. sampler2D

What is the relationship between gl_Color and gl_FrontColor in both vertex and fragment shaders

跟風遠走 提交于 2019-11-29 06:04:48
问题 I have pass-through vertex and fragment shaders. vertex shader void main(void) { gl_TexCoord[0] = gl_MultiTexCoord0; gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; } fragment shader void main(void) { gl_FragColor = gl_Color; } Those produce empty rendering (black not background color like glClearBuffer does). If I modify the vertex shader to set the gl_FrontColor to gl_Color it does render untouched OpenGl buffer ... with is the expected behavior of pass-through shaders. void main

How much performance do conditionals and unused samplers/textures add to SM2/3 pixel shaders?

痴心易碎 提交于 2019-11-28 18:56:25
We've one pixel shader in HLSL which is used for slightly different things in a few places, and as such has several conditional blocks meaning that complex functionality is omitted in some cases. As well, this means we pass textures as sampler parameters which may not always be used. I have no idea how much of a performance hit these two things add but especially since we support SM2.0 on integrated graphics chips, inefficiencies are an issue. So, does passing a texture in and not using it mean any extra overhead? And does using an if simply act to add a couple of instructions or can it

How much performance do conditionals and unused samplers/textures add to SM2/3 pixel shaders?

前提是你 提交于 2019-11-27 20:25:09
问题 We've one pixel shader in HLSL which is used for slightly different things in a few places, and as such has several conditional blocks meaning that complex functionality is omitted in some cases. As well, this means we pass textures as sampler parameters which may not always be used. I have no idea how much of a performance hit these two things add but especially since we support SM2.0 on integrated graphics chips, inefficiencies are an issue. So, does passing a texture in and not using it

Can I generate a random number inside a pixel shader?

耗尽温柔 提交于 2019-11-27 12:56:11
I'm trying to write a very simple shader that adds random sparkle to applicable objects. The way I'd like to do this is by adding a random shade of white (R = G = B) to the pixel value within the pixel shader. It seems that noise() doesn't work the way I hope it does: float multiplier = noise(float3(Input.Position[0], Input.Position[1], time)); It gives me "error X4532: cannot map expression to pixel shader instruction set" referring to the call to noise() . Since I don't know of a way to retain a number between calls to the shader, I don't think I can just write a simple random number

Can I generate a random number inside a pixel shader?

巧了我就是萌 提交于 2019-11-26 16:22:29
问题 I'm trying to write a very simple shader that adds random sparkle to applicable objects. The way I'd like to do this is by adding a random shade of white (R = G = B) to the pixel value within the pixel shader. It seems that noise() doesn't work the way I hope it does: float multiplier = noise(float3(Input.Position[0], Input.Position[1], time)); It gives me "error X4532: cannot map expression to pixel shader instruction set" referring to the call to noise() . Since I don't know of a way to