SlimDX - No depth sorting on a render target

Started by
2 comments, last by unbird 13 years, 6 months ago
It has been a while since my first post on this subject (been working on some other projects)... but 3 months and no response to what I would think would be a simple problem :(

Here is the original post

Z Depth Error (order vs distance)

Subject really says it all. I've got a gui where a 3d view works perfectly, but all I do is switch to a Floating point render target and my depth sorting doesn't work.

With the exception of the floating point format of the renderTarget, there is literally no difference code wise between the viewport and the renderTarget.

Please any assistance.
Advertisement
Check what IDirect3D9::CheckDepthStencilMatch (SlimDX: Direct3D.CheckDepthStencilMatch) tells you. Maybe you can't combine floating point targets with depth at all.
Thank you for that... It had something to do with my depthStencil,
The veiwport must have been making it for me automatically but the render target wasn't...
Now I'm issuing
device.DepthStencilSurface = Surface.CreateDepthStencil()
Format seems to be very picky here... im using D32.singleLockable and its working on my card..

Interesting thing now is I'm writing directly to openEXR from my depthStencil and its working properly, but now the viewport is having the same problem the render used to have (unsorted)... do I need to make both targets ( gui window and renderTarget) use the same depth, Right now its either one or the other?


Thanks again.
Quote:do I need to make both targets ( gui window and renderTarget) use the same depth, Right now its either one or the other?
Not necessarily, it just has to be compatible again (*). But did you reset it again ? Before switching to render-to-target you should be able to save it, i.e. reading device.DepthStencilSurface and storing for later. If you find a depth-format compatible for both view and target, it should even be possible to use the same (can't find it right now, but I remember the docs stating it has just to be big enough for both or something).

Other than that: Do you clear the depth surfaces correctly ? Code and screenshots (of your most recent setup) always comes in handy for helping.

(*) Hmmm, maybe I did not understand correctly: Do you want to preserve the depth from the render target for later ? I.e., in this context, preserve the depth information, but have different formats (since your hardware forces you to) ? Then you somehow have to convert the format. Don't know if you can use D3DXLoadSurfaceFromSurface for that. If not, then you IMHO have to resort to shaders (e.g. pixelshader sampling/outputting depth). Edit: Can you use the D32.singleLockable for the GUI rendering ?

Just out of interest: What graphics hardware are you using ?

[Edited by - unbird on October 27, 2010 11:56:21 AM]

This topic is closed to new replies.

Advertisement