Setting camera.lens.far to large makes large block shadow

Software: Away3D 4.x

volzh, Newbie
Posted: 14 September 2011 01:27 AM   Total Posts: 4

When camera.lens.far is set to large number,
shadow is rendered wired.
It’s look like a very large pixel.

as attached image,
lens.far = 5000 is left side,
lens.far = 50000 is right side.


Image Attachments

TheSillyOne, Newbie
Posted: 01 November 2011 10:33 AM   Total Posts: 28   [ # 1 ]

Welcome to the world of shadow maps! smile

I assume they use the view’s camera projection matrix (“lens”) to render shadows. That is of course not right and should be fixed. You should be looking forward to cascaded shadow maps. smile

EDIT: General / simple explanation: In order to get an even distribution of shadow samples along all axes, a cubic volume of the scene is rendered with orthographic projection. Now, the greater you set the depth of that imaginary cube, the more the shadow samples get stretched along the scene, because the shadow map has still the same size in texels.

The only problem I see here, is that you apparently set the lens parameters of your camera, but that should not really have an effect on the shadow maps, because the lights should have a radius, which should control that.

I guess you should file a bug report or feature request.

Best regards.


empend, Member
Posted: 01 November 2011 09:09 PM   Total Posts: 77   [ # 2 ]

Its really bad having to work around this.
It almost forces you to make your models at a scale so you end up with the result you would like.
I hope this gets changed, so we can control it by ourselves.


alihm, Jr. Member
Posted: 01 August 2012 11:09 AM   Total Posts: 49   [ # 3 ]

Anyone knows if this is fixed on Gold version?
I just want to have quality shadows for one single character in the scene and can’t reduce camera.lens.far anymore. Is there any workaround to have quality shadows only for one object? or maybe set another camera with lower lens.far and use it to render shadows?


John Brookes, Moderator
Posted: 01 August 2012 11:42 AM   Total Posts: 732   [ # 4 ]

Gold is the same.
I managed to hack together something that works in situations where the camera is following closely to something and you have a large scene/far.
In directionalShadowMapper there is
var corners : Vector.<Number> = _frustumCorners
Thats pulled from the camera lens.
So I created another frustrum for the lens for a shadow and reduced the far values.
Worked for what I needed.


Sean72, Newbie
Posted: 01 May 2013 05:28 AM   Total Posts: 28   [ # 5 ]

I’m going to bump this and ask…

Is there a way yet to control the quality of shadows for directional lights that doesn’t require scaling the whole scene just to fit the shadows?  Maybe a shadow map texture resolution or similar?  I’m working with the latest 4.1 dev code.


alihm, Jr. Member
Posted: 01 May 2013 06:19 AM   Total Posts: 49   [ # 6 ]

Have you tried NearShadowMapMethod? It gives better results if you have a big scene and want your main character to have nice and smooth shadows. Basically instead of reducing lens.far you can reduce shadow coverage.



Away3D Forum

Member Login