Listen, I know this is not much. But this shouldn't happen. I've tried two different methods. I've tried creating this texture and I've tried using an existing rendertarget and drawing something on it through a pixel shader. Both methods seem to yield no results...
Now, here is the thing that really drives me mad. If I load a texture I've created outside of runtime it works fine.
Without Terrain Generation: (Red: 1, Blue: 0, Green: 0, Height: ~0)
Terrain With Generation: (Red: 0, Blue: 0, Green: 0, Height: 0) <- this should have a red layer of noise.
// note this uses the noise texture which I have checked that was created perfectly.........
Terrain with Generation: (Red: tex.r, Blue: tex.b, Green: tex.g, Height: tex.a)
// note this uses a texture of the same size that I pass using the same parameter as the noise, no other code has been changed
What the heck is going wrong with this application? It can't be the shader, it draws the parameter fine. It can't be the shader object because it passes the texture fine. And it can't be the texture because I've read back the data. It's set perfectly, and even uses base 2.
Please, anything will help...
EDIT:
Quote:Original post by MJP
Does everything still work correctly if you have your pixel shader sample from TextureSampler? What happens if you send your noise texture as the parameter for SpriteBatch.Draw and sample from TextureSampler, does it still show up? This will verify that you're filling up your noise texture with correct values. You could also verify by running your app in PIX, finding your texture, and viewing it.
If you've made sure your noise texture is coming out directly, you'll want to do some further debugging. Run your app with the debug runtimes active, and make sure you're not getting any errors. Then after that I would have a look at the native D3D9 calls that are happening behind the scene. Find the call to IDirect3DDevice9::SetTexture that's setting your noise texture to the device. Then look through the calls leading up to the actual DrawPrimitive call, and make sure your Effect is being applied properly and that the SpriteBatch is messing up anything for you.
Thanks for your response. Yes, it does work fine. However, what I'm planning on attempting is not just simple terrain generation. I also want to have the ability to generate noise on the terrain by a factor of x. Which would give me the ability to create rippes in the terrain.
As for the second part. I've been trying to use PIX to debug it, but it has been no help. The first thing I would have suspected is as you say. However, I'm able to pass a texture loaded by the content manager in. Which boggles my mind...