Not seeing any shadows

Software: Away3D 4.x

pallzoltan, Newbie
Posted: 21 March 2012 07:28 PM   Total Posts: 20

Hey guys,

Please point me in the right direction, what am i missing here:

// tmp
   
= new DirectionalLight();
   
l.ambient 1;
   
l.ambientColor 0xFFFFFF;
   
l.color 0xFF0000;
   
l.0;
   
l.10;
   
l.100;
   
l.castsShadows true;
   
_view.scene.addChild(l);
   
   var 
s:SoftShadowMapMethod = new SoftShadowMapMethod(l);
   for(var 
i:uint 0ObjectContainer3D(_car).numChildreni++){
    TextureMaterial
(Mesh(ObjectContainer3D(_car).getChildAt(i)).material).shadowMethod s;
   
}
   LightsHelper
.addStaticLightToMaterials(_car as ObjectContainer3Dl);
   
LightsHelper.addStaticLightToMaterials(_road as ObjectContainer3Dl); 

Both _car and _road have their children’s (meshes) castShadow set to true, I’m still not seeing ant shadows.

Thanks ^^

   

pallzoltan, Newbie
Posted: 21 March 2012 08:13 PM   Total Posts: 20   [ # 1 ]

This actually works but the shadow was unexpectedly far.

Z.

   

pallzoltan, Newbie
Posted: 21 March 2012 08:54 PM   Total Posts: 20   [ # 2 ]

Well actually I’m still having problems smile my _car is exacly on the _road, and it doesn’t project any shadow on it. So I’ve tried putting a sphere on the scene, which has shadows as soon as I lift it from the road. Obviously this is not an option for me, the car has to be on the road all the time, so is there any way to project the shadow?

Thank you,
Z.

   

pallzoltan, Newbie
Posted: 22 March 2012 03:29 PM   Total Posts: 20   [ # 3 ]

since noone took a second to look at my code and i figured it out almost 24 hours later, i’d like to post the solution, in case someone is having similar issues: the problem was that my whole scene was too small. it was so small that (i suppose) the shadow casting thought that the car is too small to have a shadow. i increased my models by 20 and shadows work now. they’re not too pretty tho

Z.

   

Avatar
Matse, Sr. Member
Posted: 23 March 2012 09:45 AM   Total Posts: 149   [ # 4 ]

Well this size issue couldn’t be guessed by looking at your code wink

I did take a look, but never messed with LightsHelper.addStaticLightToMaterials

Still, if you didn’t already, you might want to play with camera.lens.near and camera.lens.far values to get better looking shadows. Also try out the different shadowMethods if you didn’t.

   

pallzoltan, Newbie
Posted: 23 March 2012 10:06 AM   Total Posts: 20   [ # 5 ]

I think the light’s position was a good clue. Thanks tho smile

Z.

   

Avatar
Baush, Sr. Member
Posted: 30 June 2012 12:13 PM   Total Posts: 135   [ # 6 ]

Are shadows functional with Orthogonal lens? I can’t seem to get it to work at all. Thanks

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X