Gathering a Depth Map?
by Matt Vitelli · in Torque Game Engine Advanced · 03/10/2008 (8:39 pm) · 22 replies
Does anyone have any insight into how to go about gathering a depth map for the scene? This would be extremely useful and with it, one could implement a variety of fullscreen shader effects. I'm just not even sure where to start. I looked at some of the screenshot code, but that doesn't seem to include anything that would gather depths. Perhaps I should add something to the updateReflection function? I'm just not even sure where to begin in saving it to a texture. Any help would be deeply appreciated.
Thanks,
Matt Vitelli
Thanks,
Matt Vitelli
#22
Sorry I don't have any answers, I'm just as puzzled, though. I should probably try to code-up a repro case based on one of the DX demos, and see if the problem is a Torque issue, a DirectX bug, or simply one of those many, lovely "gotchas" about graphics programming.
08/16/2008 (8:58 am)
This is a problem I have run into and I don't know exactly what the deal is. I've looked at it in PIX, you can examine the viewport and the transforms, and the last time I looked the values are the same. The problem seems to occur when the viewport is not the same size as the current back-buffer. The only mention I have found in the DX docs is that when SetRenderTarget is called, the viewport is changed to ( 0, 0, width, height ) of the new target. This doesn't seem to help much, though, because it still doesn't explain the behavior, and calling setViewport(), as you mentioned, doesn't seem to fix the issue.Sorry I don't have any answers, I'm just as puzzled, though. I should probably try to code-up a repro case based on one of the DX demos, and see if the problem is a Torque issue, a DirectX bug, or simply one of those many, lovely "gotchas" about graphics programming.
Torque 3D Owner Lorne McIntosh
Ubiq Visuals Inc,
Everything seems to work as it should until I enter the editor, at which point the viewport is changed (because of that little bar at the top), and everything goes wonky:
I think the depth pass doesn't realize it should be rendering 22 pixels lower than normal. Later, when the regular passes are made, nothing renders in those places because it fails the z-test.
I've tried GFX->getViewport(); and GFX->setViewport(); all over the place but can't seem to make any improvement.
Ideas?