Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 21 Sep 2012
Offline Last Active Today, 10:03 AM

#5256020 Radiosity

Posted by on 07 October 2015 - 09:50 AM


I'm building a Lightmapper for my small engine and I'm running into a bit of a problem using radiosity. I'm splitting my scene into small patches and propagating the light using a simplified version of the form factor. 

 private float FormFactor(Vector3 v, float d2, Vector3 receiverNormal, Vector3 emitterNormal, 
            float emitterArea)
                 emitterArea * (-Vector3.Dot(emitterNormal, v)
                * Vector3.Dot(receiverNormal, v))

the problem I'm having is with the bounce light. They never converge and keep adding up energy. I could stop after some iteration but the code is probably incorrect since the energy never goes down. 

                        if (Vector3.Dot(ne, lightdir)<0)
                            var form = FormFactor(lightdir, distance, nr, ne, emitter.Area);
                            emittedLight += emitter.Color *form* receiver.SurfaceColor;

this is the function where I had the bounce light. 


Llightdir is the vector from the emitter patch to the receiver. 

ne is the normalize normal of the emitter patch. 

nr is the normalize normal of the receiver patch.


I try to scale my scene to see if maybe it was a energy or scaling problem but it didn't work.

the only thing that actually work was to divided by 4 the bounce light but that seems incorrect because in some scene the light ended up converging and on other there where just adding more energy.


So I'm wondering is there some kind of rule I'm missing. Should I add attenuation to the bounce light or the form factor is enough ? I spend the last week try to piece it together but most sources on internet didn't gave me clues on how to balance the bounce energy. 


BTW I choose the form factor because it's easy to run on the cpu. 

#5241712 Are there any limitations to the DirectX Toolkit?

Posted by on 21 July 2015 - 08:19 AM

I think directX toolkit was develop by Shawn Hargreaves which was on the xna dev team. The project is open source so basically you can just have a look at it and you'll find what you want to understand.

Also you can extend, add, modify the feature you want. You are not lock up in the design. 


If you want to stay on c# sharpdx is a good alternative. It's a thin wrapper on top of directX. I managed to follow frank luma directX book ,which was written for c++ user, and the code was pretty close to sharpdx. 

#5240318 Moving from MonoGame to SharpDX/SlimDX

Posted by on 14 July 2015 - 02:08 PM

this book might help you 



#4984366 Solved reconstruct depth in orthographic view

Posted by on 27 September 2012 - 08:35 AM

I fixed my problem. My light transformation was quite off and the formula to reproject was cool. So no problem then.