njord Posted February 3, 2012 Share Posted February 3, 2012 Hi all. I encountered a strange problem with shadows, when field of view is small. When fov is 70 or 80 degrees there is no problem, but when I decrease it, lets say 50,55 degrees, shadow bugs (may) occur. First I thought it may be a problem related to our custom models or daynight script. But then I performed some tests on Editor and reproduced the bug. Create a terrain in editor. Drag atmoshpere and directional light. Drag in the monster truck (a little higher from the surface to see its shadow easily). Configure editor field of view to 51 degrees. Move back and forward in the direction of monster truck. You will see its shadow partially or fully disappearing based on camera distance and viewing angle. Strangely, one of our custom models, (airport bridges) do not produce the same shadow artifacts. Maybe it is related to pivot point ? Here are 2 video links showing monster truck with shadow bug, airport bridges without shadow bug : ftp://81.214.87.33/ port:21 username : katron pass : katron2012 filenames : FOV_SHADOW_PROBLEM.avi FOV_SHADOW_PROBLEM_2.avi Here is a screenshot for a quick glance: Quote Link to comment Share on other sites More sharing options...
njord Posted February 8, 2012 Author Share Posted February 8, 2012 When fov was 51 degrees, I shortened my directional light shadow distance by changing multipler = 3 to 0.3 on the below code (simply made shadow distances 2.4m,12m,24m. They were 24m,120m,240m before.). This get rids of the "partially or fully disappearing shadow" bug. Of course , now there are shadows only up to 24 meters which is looking really bad with low fov. Another possible solution is increasing the FOV to 60+. But i need small field of view in my case. I will even use 45 degrees in the future. object.pivot = CreatePivot() object.light = CreateDirectionalLight() multiplier = 0.3 --was 3.0 before SetShadowDistance(object.light,8*multiplier,0) SetShadowDistance(object.light,40*multiplier,1) SetShadowDistance(object.light,80*multiplier,2) object.light:SetShadowmapSize(2048) multiplier = 2 SetShadowOffset(object.light,0.31*multiplier, 1.0, 0) SetShadowOffset(object.light,0.40*multiplier, 1.0, 1) SetShadowOffset(object.light,0.70*multiplier, 1.0, 2) SetShadowOffset(object.light,1.50*multiplier, 1.0, 3) PS: Josh, the shadows disappear on the borders of "directional light shadow stages". Quote Link to comment Share on other sites More sharing options...
njord Posted February 17, 2012 Author Share Posted February 17, 2012 up+ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.