Horde3D

Next-Generation Graphics Engine
It is currently 09.11.2024, 01:00

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: 08.05.2014, 22:18 
Offline

Joined: 28.12.2013, 22:53
Posts: 5
Directional light is a subject that has been mentioned many times in this forum, but I haven't found a good solution yet.

These threads provide a couple of pointers:
viewtopic.php?f=1&t=1646
viewtopic.php?f=1&t=368

Using a spotlight far away from the scene doesn't work well; there is too much shadow acne or peter-paning. Tuning the shadow bias doesn't solve the issue.
The depth value used in the shader is always:

Code:
depth = d / r
    with
d: the distance of the fragment to the spotlight position
r: radius of the spotlight

The shadow map is a 24-bit number and the precision suffers if the scene occupies a tiny range of spotlight radius. The solution would be to have the depth range in the shadow map adjusted with the bounding box of the scene. The current implementation uses the shadow caster's AABB's to optimise projection matrix to generate the shadow map (eg. the x,y values for the shadow map are optimised). However the bounding box is not used to adjust the near/far plane of the frustum (and the shader doesn't use this projection to compute the depth value, it just uses the light's radius).

Please let me know if anything in the description above is not true. Did anyone already tried to tackle this problem?

For real parallel light with orthographic projection, I found attila's version of Horde3D used for "Offroad Legends" (published in this thread: viewtopic.php?f=1&t=1665). Unfortunately, the shaders used for this directional light hack have not been published.
Question to attila: How is the depth value for the shadow map computed?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 29 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group