Some question regarding light functions

Hi there,

thanks for reaching out. I will try to answer your questions as best as I can.

Why is depth testing disabled when drawing backfaces? Wouldn’t it make sense to use `CF_DepthFartherOrEqual` in these cases?

If depth testing is enabled for backfaces, they might erroneously pass the depth test and be drawn on top of front-facing objects, leading to visual artifacts or incorrect rendering

In the case of using CF_DepthFartherOrEqual**,** fragments that are further from the camera would be rendered over fragments that are nearer, which in my understanding would overwrite the backfaces of the light function’s geometry when there are other objects that need to be drawn. I’m not entirely sure about this, and I can forward your question to Epic if desired.

Why is `View.NearClippingDistance` multiplied by 2? I understand that a conservative test is probably better in this case, but I’m not sure this is the reason.

By doubling the near clipping distance, the code ensures that the proximity check remains robust even under edge cases and avoids precision issues due to floating-point inaccuracies when the camera is very close to or intersecting with the light geometry. This additional padding reduces the chance of rendering artifacts or incorrectly disabling depth tests.

Also related: why does `StencilingGeometry::DrawCone` expect vertices to be “generated” inside the vertex shader instead of using a vertex buffer?

This is done for performance optimization and flexibility: when using lightweight, procedural geometry like cones, where the vertex positions can be calculated mathematically, generating vertices dynamically in the vertex shader can be faster than transferring precomputed vertex data from the CPU to the GPU and avoids the need of managing and storing vertex buffers in memory. That way, parameters like the cone’s radius, height, or tessellation level can be dynamically adjusted without needing to recreate or update a vertex buffer.

Hopefully this helps. Please let me know if you have further questions.

Thanks,

Sam