Falcor icon indicating copy to clipboard operation
Falcor copied to clipboard

IgnoreHit not working

Open cjsb opened this issue 5 years ago • 3 comments

Hi,

I took a simple ray tracing example that should ignore the rays that hit a transparent material but it seems that the IgnoreHit is not working.

I tried to just ignore all the hits, like this:

[shader("anyhit")] void TestAnyHit(inout TestRayPayload rayData, BuiltinIntersectionAttribs attribs) { IgnoreHit(); }

But the results is still the same. Should I do anything else to ignore a hit?

Thank you =)

cjsb avatar Apr 14 '19 04:04 cjsb

2 possible issues:

  • The material are not really transparent. Search for D3D12_RAYTRACING_GEOMETRY_FLAG_OPAQUE in RtModel.cpp. If we set this flag, the AHS will never be called. We're only marking materials as transparent if their base color map contains an alpha channel (which is wrong, but that's the current behavior)
  • You don't add the AHS to the RtProgram you create

I'm guessing it's probably the first. If the material uses a constant transprency value, the material won't be marked as transparent. Material::setBaseColor() should check for the alpha value and if it's not 1 set the alpha mode to AlphaModeMask

nbentyNV avatar Apr 15 '19 22:04 nbentyNV

It was the first option! It is working now, thank you!!! =)

cjsb avatar Apr 17 '19 14:04 cjsb

Re-opening it. We need to fix it in a future release

nbentyNV avatar Apr 17 '19 18:04 nbentyNV