Morgun Dmytro Morgun Dmytro - 1 year ago 81
C++ Question

Radiosity global illumination shadow`s edges jitter, being not straight

I'm implementing radiosity illumination technique. I have some static scene that I want to precompute and then show and move inside it. So not that realtime, but must work on mobiles.
So the geometry is being split and the light bounces, but the shadow edges look bad:


The geometry is being split using triangles:

the pic with the triangulation

As their edges don't align along the shade it looks not that nice. And the samples in the internets don't have that (while some do have). So I am probably missing something.

Maybe I should find the shadow edges and force triangulation to create line along those edges. But it is not that easy to find them and they could have complex shape, and there could be many lights further multiplying the number of triangulation restrictions. More dense triangulation is unlikely to help (tried that), the edge jittering will be on a smaller scale, but more intense. It could help if WAY more triangles were created and the output blurred. But as this is radiosity, increasing the number of triangles dramatically affects the performance. The scene in the pic is very simple, it is good for demonstration, but we need (and have) much more complex scenes/views, with models, 3d perspective view etc.
The triangles showed are in fact further subdivided into four each for better colour interpolation, but these are the units of the light bouncing.

Answer Source

You cannot get a hard shadow from a sparsely tessellated geometry. So if you have a point light that should generate hard shadows:

  • Apply your radiosity algorithm.
  • Subtract the direct light from the solution, so it would have only the indirect light contribution.
  • When you render the scene, use the radiosity solution for indirect lighting and a classical technique (like high-resolution shadow maps) for hard shadows.

Alternatively you can indeed perform an adaptive subdivision. See GPU Gems 2. Chapter 39. Global Illumination Using Progressive Refinement Radiosity#Adaptive Subdivision for loose description and references.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download