0
votes
1answer
65 views

Why would I lose the D3D device during an HLSL unroll?

I have a pixel shader that downsamples a texture from one size to another. The downsample shader uses a nested 'for' loop to traverse the uv coordinates. When the for loop executes more than four ...
2
votes
2answers
473 views

Computing pixel's screen position in a vertex shader: right or wrong?

I am building a deferred rendering engine and I have a question. The article I took the sample code from suggested computing screen position of the pixel as follows: VertexShaderFunction() { ... ...
1
vote
1answer
234 views

Color grading, shaders and 3d textures

I'm trying to implement color correction with the 3d lookup table. The lookup table is actually just a 2d texture 256x16 and consists of 16 squares which one is 16x16. When it comes to rendering, I ...
0
votes
1answer
70 views

Vertex and Fragment Shader worldNormal

How to access/calculate worldNormal in a Vertex and Fragment shader ? Thanks a lot !
1
vote
1answer
774 views

Volumetric Fog Shader - Camera Issue

I am trying to build an infinite fog shader. This fog is applied on a 3D plane. For the moment I have a Z-Depth Fog. And I encounter some issues. As you can see in the screenshot, there are two views. ...
1
vote
2answers
57 views

Defining lines from a heightmap

To a pixel shader of a 2D game, I'm passing a 1-row heightmap that holds the height in UV coordinates of evenly distributed points throughout the texture I'm drawing, but as for n points there will ...
2
votes
2answers
229 views

3D Distortion Effect

I'm trying to make a distortion effect similar to this: However I'm not making a 2d screen space effect. I'm applying it to a 3d scene and I want it to be placed IN the world, so it can be blocked ...
0
votes
1answer
94 views

Shader registers for different graphics card

The title is not very explicative, so i'll try to make myself clear. I have two "working"(on which i work on) PCs : a desktop that runs an NVIDIA GT440 an a laptop with a RADEON HD 4650. I have a ...
0
votes
1answer
93 views

Weird rendering issue when applying lightmap through HLSL

I have a weird issue when trying to render the lightmaps in my game. Please see the following screenshots. Note how the scene looks up close with the lightmaps enabled. Note how that same part of ...
3
votes
0answers
404 views

How to achieve supersampling / anti-aliasing in pixel shaders?

I am trying to write a couple pixel shaders to apply to images similar to Photoshop effects. For example this effect: ...
0
votes
2answers
164 views

The saturate function is not working in my pixel shader

I wrote a pixel shader for my game and when I tried to compile it an error occurred: ID3DXEffectCompiler::CompileEffect: There was an error compiling expression When I removed all the saturate ...
3
votes
1answer
238 views

Per Instance Textures, and Vertex And Pixel Shaders?

How do you implement per instance textures, vertex shaders, and pixel shaders? Given: 1. Two different model templates in Vertex Buffer, Square & Triangle 2. Instance Buffer with [n] instances of ...
0
votes
2answers
185 views

How to implement input-texture limited alphablending of 2 textures with HLSL?

I try to implement a HLSL shader the does the normal Alphablend with premultiplied colors (just as XNA4 does) but depending on some existing colors. One can think of adding a glow to a 2D terrain ...
0
votes
2answers
648 views

HLSL shader optimization [closed]

The following HLSL shader (without preprocessing) results in 65 arithmetic operations (see below). Can the same effect achieved with <=64 operations? // Center of "light" float x; float y; // ...
4
votes
1answer
1k views

In HLSL pixel shader , why is SV_POSITION different to other semantics?

In my HLSL pixel shader, SV_POSITION seems to have different values to any other semantic I use. I don't understand why this is. Can you please explain it? For example, I am using a triangle with the ...
5
votes
1answer
2k views

How do I use screen-space derivatives to antialias a parametric shape in a pixel shader?

In Valve's Alpha Tested Magnification paper, it mentions using "per-pixel screen-space derivatives" for doing anti-aliasing. My understanding is that this is the ddx and ddy intrinsic functions in ...
1
vote
1answer
823 views

Pixel Shader, YUV-RGB Conversion failing

I am tasked with playing back a video hthat comes in in a YUV format as an overlay in a larger game. I am not a specialist in Direct3d, so I am struggling. I managed to get a shader working and am ...
1
vote
1answer
793 views

2D Mask antialiasing in xna hlsl

I have two texture2d , one of these is a mask texture and have 2kind color and i use that for mask (filter) second texture2D something like float4 tex = tex2D(sprite, texCoord); float4 bitMask ...
1
vote
1answer
627 views

Need to combine a color, mask, and sprite layer in a shader

My task: to display a sprite using different team colors. I have a sprte graphic, part of which has to be displayed as a team color. The color isn't 'flat', i.e. it shades from brighter to darker. I ...
2
votes
3answers
5k views

Hue, saturation, brightness, contrast effect in hlsl

I am new to pixel shader, and I am trying to write a simple brightness, contrast, hue, saturation effect. I have written a shader for it but I doubt that my shader is not providing me correct result, ...
1
vote
1answer
549 views

Sampling from Normal Map and Diffuse Map in Pixel Shader

I'm having some issue changing a basic lighting shader to take a normal texture and a diffuse texture for a model and then using the normal texture for lighting. The code is very simple and i can't ...
2
votes
1answer
1k views

Why is a fully transparent pixel still rendered?

I am trying to make a pixel shader that achieves an effect similar to this video http://www.youtube.com/watch?v=f1uZvurrhig&feature=related My basic idea is render the scene to a temp render ...
0
votes
2answers
1k views

How to achieve after-image pixel shader effect

How would one go about writing a pixel shader like this one in XNA 4.0? http://www.youtube.com/watch?v=f1uZvurrhig&feature=related
1
vote
1answer
722 views

How to set TextureFilter to Point to make example Bloom filter work?

I have simple app that renders some particles and now I am trying to apply the bloom shader from the xna samplers ( http://create.msdn.com/en-US/education/catalog/sample/bloom ) to it, but I am ...
1
vote
1answer
937 views

XNA - Getting HLSL pixel of current render target?

I'm setting a render target in XNA using the following lines of code: Game.GraphicsDevice.SetRenderTarget(physicsTexture); Game.GraphicsDevice.Clear(Color.White); ...
0
votes
1answer
757 views

D3D11 - Setting multiple ID3D11SamplerStates for the pixel shader stage once and leaving them be

In my Direct3D 11 application, I am using several sampler states to retrieve texture data. Some of them are used in all pixel shaders, some of them are only used in very specific ones. The question ...
1
vote
0answers
508 views

How can I run the pixel shader effect? [closed]

Stated below is the code for my pixel shader which I am rendering after the vertex shader. I have set the wordViewProjection matrix in my program but I don't know to set the progress variable i.e in ...