While fixing a bug on my SoC branch, I found a bug on the way blender handles hemi and sun lights.<br><br>Trunk raytrace code only allows to raycast with (origin, final).<br>As so blender implements SUN and HEMI lights by calculating the point on the boundaries of the scene BB, thats has the same direction.<br>
After that a QMC displace vector is added to the light position, leading that the effect of the displace vector is proportional to the scene BB. (if the scene has a large BB then the displace vector doens't has a big effect, reducing the effect QMC, leading to hard-shadows)<br>
<br>As you can see in those 2 renders (where only the BB of the scene was changed):<br><a href="http://andresp.no-ip.org/soc2009/btest/html/jaguarandi/k3QpVfTmPA-H/XEV42KRBIVMa/">http://andresp.no-ip.org/soc2009/btest/html/jaguarandi/k3QpVfTmPA-H/XEV42KRBIVMa/</a> <= small BB<br>
<a href="http://andresp.no-ip.org/soc2009/btest/html/jaguarandi/k3QpVfTmPA-H/OGbBdYxecYaf/">http://andresp.no-ip.org/soc2009/btest/html/jaguarandi/k3QpVfTmPA-H/OGbBdYxecYaf/</a> <= large BB (got harder shadows)<br><br>
If I am not mistaken the displace vector should be applied at the light vector and then having the light vector be transformed to an "end_point" outside the scene.<br><br>Anyway I implemented such aproach on my branch (since the new render API uses parameters (origin,vector,max_dist) ) and got the following result:<br>
<a href="http://andresp.no-ip.org/soc2009/btest/html/jaguarandi/1_BuRIEJDoCZ/XEV42KRBIVMa/">http://andresp.no-ip.org/soc2009/btest/html/jaguarandi/1_BuRIEJDoCZ/XEV42KRBIVMa/</a><br><br><br>There is a large difference between images as now the QMC is used at the direction level (which I belive to be the right way todo it) instead of final point.<br>
<br>I would apreciate feedback as this makes that all HEMI and SUN lights rendered from now on will change a lot.<br><br>PS: maybe I should email this to bf-commiters (not really sure)<br>--<br>André<br>