Combining Rendertargets from raytraced geometry and rasterized geometry (depth problem)

Started by
4 comments, last by evelyn4you 3 weeks, 1 day ago

hi,

in my raytracing only game engine i produce a gbuffer by raytracing and store the raylength as linear depth in a rendertarget. This and many other passes are done in compute mode.

At the end of the pipeline i have a graphics mode rasterizer pass with a cleared depthstencil and render my physics debug shapes like spheres, cubes an bones.

In this pass i calculate the depth and compare with the raytraced depth.
depth = length(world_pos - camera_pos)

Still picture is fine. When moving camera all shapes are perfectly rendered. (koharent)

My problem: ( overlapping shape with raytraced geometry )

I get a kind of flipbook effect when moving the camera, the overlapping background, foreground is shown in high frequency.

I checked again and again all things, ( e.g. resource barriers ) and suppose this happens because the calculation of the depth in raytraced mode is not koharent to the calculation in rasterizer mode.
Sometimes depth at a pixel is detected smaller, sometimes higher.

How to solve this problem ?

Advertisement

Try a depth bias, similar to with shadow maps.

@Aressera

thanks for your comment.

I have already tried a fixed bias e.g. 0.1f and also a relative percentage bias of depth but this did not help.

Maybe your raster and RT are off by one frame?
Might explain why only still image works. (But the bias should still help in this case as well.)

hello,

good news i solved the problem.

I use 2 ressource tables for my gbuffer binded rendertargets and buffers.

- first table has ordinary sequence
- second table has some targets swapped. e.g. scene_depth and scene_depth previous are exchanged

In had missed to the set the right table in my GRAPHICS pipeline, whereas in the COMPUTE pipeline the table changed every frame.

Advertisement