Sign in to follow this  
Paul Ward

Shader problem combining components in scene

Recommended Posts

Well, as they say ... a picture explains a thousand words so here goes.

I'm trying to understand why despite my pixel shader being set (as you can see in the timeline of calls on the left) along the bottom the pixel shader part of the pipeline is missing resulting in no output.




I have 2 components in my scene (a hud component using awesomuim and a voxel based terrain component).

Both have been tested on their own and work to render the expected output but when combining them I get the hud when the scene is done but no terrain.


It gets even stranger too ...

The mesh info shown here appears to be correct but if i move the camera around I can see that the terrain did clearly make it on to the scene but appears to have gotten "mangled" in some way.


I think it looks something to do with my transforms somehow but none of the code between these 2 components is shared including the transforms so how 1 component is affecting the other is beyond me.


Does anyone have any ideas how I can go about tracking this down?



If I move the camera a bit I get something like this ...



Edited by TehWardy

Share this post

Link to post
Share on other sites

Just an observation (may not have anything to do with the problem): it may just be your coding style, but you update resources after you set them. I.e., PSSetShaderResource(...); UpdateSubresource(...);


Are you just anticipating the next PSSetShaderResource, or do you have any of those out of order? E.g., you don't update the pixel resource(s) before your first call.

Edited by Buckeye

Share this post

Link to post
Share on other sites

Yeh it's an optimisation point ... 


Essentially the first thing that happens is the resource is created then per object I do a set then a draw call.

It's for things like world view projections as each object has its own unique values.

We only just implemented the shader batching and its not solving all cases just yet but its not far off !!!



On the up side I fixed the problem ...


I turns out that my team mate had managed to declare his own constant buffer which he was overwriting my constant buffer with then never using it because the buffer only contains the wvp matrix for the current renderable object and he was rendering in 2d space for the hud code.


once I ripped that out it all sprang to life.


Been battling this for a few days now ... awesome that I have it fixed but annoying I had to go dig through the hud code to get my fix.


Never mind !!!

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this