New answers tagged

2

There are two ways to set the stencil buffer value in Direct3D 11, one of which is only available in Direct3D 11.3 (and Direct3D 12). I will split this answer into two parts accordingly. Direct3D 11 General As part of the D3D11_DEPTH_STENCIL_DESC you specify what action to take on a stencil test pass and fail. These options boil down to: Keep the current ...


0

To create this effect convert the pixel to greyscale: float grayscale = dot(color.rgb, float3(0.3, 0.59, 0.11)); Then return red above the threshold and return black below it (while preserving the alpha). See what threshold value works for you.


2

You can not Sample a texture in vertex shader with regular sampling. You should use SampleLevel and sample a specific mip level of the texture with it. This is because you don't have screen space derivatives (ddx and ddy) in the vertex shader. In the pixel shader those are used to determine the mip level. You can also use texture.Load.


0

You were adding Assets.GameArt.shadowTexture as Texture2D to your graphicdevice but there are no any texture associated in your HLSL file. You need add Texture2D to your pixel shader file and use your sampler to sample your texture2D. I suggest to render it without spritebatch and go one level lower and create your own quad with vertices, then render it with ...


2

It turns out that this is due to optimisation of the .fx compiler. When only one sampler is actually used (regardless of the number of samplers being declared) the effect is compiled to be optimized to only read from the first register. So: With this declaration: sampler ScreenTextureSampler: register (s0) // This is the texture that SpriteBatch will try ...



Top 50 recent answers are included