DXR Flickering Artifacts

Started by
4 comments, last by _void_ 4 years, 7 months ago

Hey guys,

My battle with DXR still goes one ? This time I am trying to render three triangles and encounter flickering artifacts on two of them.

611801920_DXRFlickering.png.6c662e89d725b9fdd0530d3d55beb57f.png

For the sake of the test, each triangle represents a separate mesh. Their vertex and index data are stored in a global vertex and index buffers.

For each of the meshes, I create a dedicated D3D12_RAYTRACING_GEOMETRY_DESC, specifying corresponding offsets in the vertex and index buffers.


D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS BLASBuildInputs;
BLASBuildInputs.Type = D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL;
BLASBuildInputs.Flags = D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_PREFER_FAST_TRACE;
BLASBuildInputs.DescsLayout = D3D12_ELEMENTS_LAYOUT_ARRAY;
BLASBuildInputs.NumDescs = (UINT)geometryDescs.size(); // 3 descs
BLASBuildInputs.pGeometryDescs = geometryDescs.data();

If I specify only one geometry desc on D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS, it works fine for all of them. That is,


BLASBuildInputs.NumDescs = 1;
BLASBuildInputs.pGeometryDescs = &geometryDescs[0]; // works also with 1 and 2

But will not work, if I use three of them.

My closest hit shader interpolates vertex colors and outputs the result in the payload. I also tried to output hardcoded "red" color to exclude interpolation issue, but did not help.

 

Any ideas what could be upsetting it so much? ?

Thanks!

 

Advertisement

The artifacts themselves look more like an issue stemming from a missing barrier or synchronisation on the UAV you write to or how/when you copy it to the swap chain (rather than the TLAS/BLAS builds).

If you want to check something into your branch again I can take a look in the morning.

Adam Miles - Principal Software Development Engineer - Microsoft Xbox Advanced Technology Group

@Adam Miles I do not see anything obviously wrong with the barriers. I have pushed the latest changes. It is the same project but on "master" branch. Thanks!

Your problem is this:

image.png.a0b9331a76623c4800c7946937bf00fc.png

And the fix is this:

image.thumb.png.bf0c0d5caeb31806824af11707432def.png

Since you currently only have one hit group, the last two geometries are indexing off the end of your shader binding table into unknown memory. Therefore it's not running your Closest Hit shader for the last two triangles and therefore the payload is coming back with the same color it was initialised with in the ray generation shader (Narrator: It wasn't initialised, hence the flickering).

Adam Miles - Principal Software Development Engineer - Microsoft Xbox Advanced Technology Group

@Adam MilesSo cool! Thank you so much for the help!

This topic is closed to new replies.

Advertisement