XNA 4.0 – Strange edges with multilight shader
I am generating a light, a depth and a normalmap to calculate the lightning at each pixel with multiple lights. On both rendertargets, i set the preferredMultiSampleCount parameter to 16 samples...
View ArticleHLSL Compile Error: maximum vs_4_0_level_9_3 sampler register index (0)...
I’m trying to convert a project from XNA to SharpDx and are updating my shaders to version 4_0. Now I’m getting an error of which I can find now information: maximum vs_4_0_level_9_3 sampler register...
View ArticleCan't read .cso files but I can read their .hlsl versions?
Well I’ve been trying to read a .cso file to use as a shader for a DirectX program I’m currently making. Problem is no matter how I implemented a way to read the file it never worked. And after...
View ArticleCan't sample texture in HLSL using DX11
Environment: Windows 7 x64 Visual Studo 2012 DirextX11 HLSL Shader Model 5 Ogre 1.9 Okay, so I’m trying to sample a texture in my pixel shader but I’m coming across some strange problems. Here’s the...
View ArticleXNA 4.0 HLSL – strange depth map
I want to draw my pre-rendered depth map to the scene. I get my depth value in the following way: basically (Pixel Shader) // Depth is stored as distance from camera / far plane distance, 1-d for more...
View ArticleDeferred Lighting – How to map to the generated texture?
I’m trying to implement deferred lighting and I have done the first and second pass but I’m stuck on the third as I don’t know how to map from the current pixel being drawn to the generated texture...
View ArticleCan't read .cso files but I can read their .hlsl versions?
Well I’ve been trying to read a .cso file to use as a shader for a DirectX program I’m currently making. Problem is no matter how I implemented a way to read the file it never worked. And after...
View ArticleCan't read .cso files but I can read their .hlsl versions?
Well I’ve been trying to read a .cso file to use as a shader for a DirectX program I’m currently making. Problem is no matter how I implemented a way to read the file it never worked. And after...
View ArticleCan't sample texture in HLSL using DX11
Environment: Windows 7 x64 Visual Studo 2012 DirextX11 HLSL Shader Model 5 Ogre 1.9 Okay, so I’m trying to sample a texture in my pixel shader but I’m coming across some strange problems. Here’s the...
View ArticleVertex definitions and shaders
I noticed that from looking at other examples like say .. riemers tutorials he takes a buffer with a bunch of vector3′s in it and ties it to a shader which expects a float4 … why does this work in his...
View Articlemarshaling c# struct with array to const buffer
I am trying to use a const buffer to pass a structure with an array of values into the pixel shader. However, all my color[] array values are coming in as zeros. I have the struct defined as:...
View ArticleDepth Map not rendering properly in DirectX / HLSL / SharpDX
I’ve been struggling with this for awhile, and everything I find online says this SHOULD be working, but I apparently missed something. I’m attempting to run Deferred Rendering in SharpDX on a Store...
View ArticleXNA HLSL UV Mapping
I was testing my hlsl lighting shader, I’ve copied it from a tutorial and it works perfectly, but all the meshes in the model needs to have texture coordinate, I guess this is because this part:...
View ArticleIn XNA 4, how can I access SpriteBatch's transformMatrix in my shader?
I would like to use a custom effect with a regular XNA SpriteBatch. I have a 2D camera which computes a transform matrix, so I need my shader to take this into account. I have put a world matrix...
View ArticleShader – Calculate depth relative to Object
I am trying to calculate depth relative to the object.Here is a good solution to retrieve depth relative to camera : Depth as distance to camera plane in GLSL varying float distToCamera; void main() {...
View ArticleHLSL SampleCmp compile error
When trying to compile the following HLSL: Texture2DArray gShadowmap : register(TEXTURE_REGISTER_DEPTH); SamplerState gShadowmapSampler : register(SAMPLER_REGISTER_DEPTH); // ... float3 projCoords =...
View Article2D HLSL World position
I’m trying to get world position from my vertex shader to my pixel shader so that I can disable the shader once a preset X coordinate has been passed (no shading once I’m over X). Getting the screen...
View ArticleHLSL Shader Relative Positioning
I’ve got a shader that does the texturing, lighting, etc. for my game engine (written on top of MonoGame, in case that’s relevant) for my block-terrain-based game (everything is rendered as triangles...
View ArticleHow do I sample a Depth/Stencil Texture in HLSL?
I am shadow mapping in Direct3D 9. I’m trying to avoid rendering depth to a 32-bit render target. So, I’ve created a depth/stencil texture( a texture w/usage Depth/Stencil ). When I render I do this:...
View ArticleHLSL: An array of textures and sampler states
The shader must switch between multiple textures depending on the Alpha value of the original texture for each pixel. Now this would word fine if I didn’t have to worry about SamplerStates. I have...
View Article