The hlsl tag has no wiki summary.
1
vote
1answer
53 views
How to mix effects together?
Lets say I have got terrain effect, contains multitexturing, light. Now water effect. It must be different, but must be also affected by light. Other one, player effect, must also be affected by ...
0
votes
1answer
74 views
DX11 - Weird shader behavior with and without branching
I have found problem in my shader code, which I dont´t know how to solve.
I want to rewrite this code without "ifs"
tmp = evaluate and result is 0 or 1 (nothing else)
if (tmp == 1) val = X1;
if (tmp ...
1
vote
1answer
56 views
Writing to multiple RenderTarget2D's from HLSL shader
I need to write to two render targets: one for colour and another for depth+normal (for post-processing). I have a problem, though. Both targets seem to be getting the value output by COLOR0, while ...
1
vote
1answer
91 views
*DX11, HLSL* - Colour as 4 floats or one UINT
With the DX11 pipeline, would it be much quicker for the vertex buffer to pass one single UINT with one byte per channel to the input assembler, as opposed to three floats? Then the vertex shader ...
3
votes
0answers
107 views
How would I create an HLSL effect like an animated “working” image?
I want to create the effect in the image in HLSL specifically get a block of pixels to move from a specified start point to an end point, so that it can go across the entire screen, but I don't have a ...
2
votes
1answer
115 views
Shader optimization - Cg/HLSL pseudo and via multiplication
HLSL/Cg do not allow texture fetching inside conditional blocks. To get around this I am first checking a variable and performing some computations, afterwards I set a float flag to 0.0 or 1.0, ...
3
votes
1answer
94 views
Error when compiling FXAA shader
I am getting the following error when compiling the FXAA shader downloaded from here
http://timothylottes.blogspot.co.uk/2011/07/fxaa-311-released.html
Fxaa3_11.h(934,5): error x4000: Use of ...
3
votes
1answer
168 views
Shadow-mapping xna
I've been trying to implement shadows in my game and I've been following quite a few tutorials online, mainly Riemers, but I'm always getting the same 2 errors when I'm drawing my models and setting ...
2
votes
1answer
80 views
Shader and Custom Vertex Format Errors
I am creating an editor of sorts that allow you to create 3D voxel models. I just got started and have ran into a few errors. Here is what it is producing:
I think the problem has to do with the ...
1
vote
2answers
102 views
How (if possible) would I change the BasicEffect Matrix mid draw
Say, for example, I have a list of enemies. Each enemy is a textured quad which is the stored in a singular shared VertexBuffer and IndexBuffer with the buffer usage set to BufferUsage.WriteOnly ...
3
votes
4answers
128 views
Enconding/Decoding bit value in Texture Alpha Channel
I am Rendering to a SurfaceFormat.Color. (R8G8B8A8)
The alpha of this format has 8 bits and I want to be able to use those 8 bits as a bit field.
For example, in one pass of my render, I want to save ...
1
vote
2answers
192 views
Is the output from D3DCompile specific to one GPU, or not?
In Direct3D 11 there is a two-stage shader compilation process; you first pass the HLSL source code into D3DCompile, which outputs a "blob" of bytecode. You then take this blob and call ...
1
vote
2answers
129 views
Why can't I get a bool packed and aligned into a D3D constant buffer?
Alright, I'm having a hard time getting a bool packed and aligned into a hlsl constant buffer and I'm not sure why.
Here is the buffer in hlsl
cbuffer MaterialBuffer : register(b1) {
float3 ...
1
vote
1answer
104 views
screen coordinate not working with pixel values
I have a very simple effect file shown below. I am using this to draw 2D lines, however it is not behaving how I expected and I can't seem to get my head round why.
If I draw a line that goes from ...
1
vote
1answer
138 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 ...