Shadows only

Software: Away3D 4.x

Avatar
Baush, Sr. Member
Posted: 29 November 2013 10:12 PM   Total Posts: 135

Hello everyone, is it possible to display shadow on a surface that is transparent? I can generate shadows fine on a ColorMaterial, but when I set it’s alpha to 0 the shadow disappears as well (expected).

Is it possible to get “shadows only” material?

Thanks for your time!

-Matt

   

Avatar
Mu Duck, Newbie
Posted: 29 November 2013 11:48 PM   Total Posts: 20   [ # 1 ]

Well a stupid solution can be to set alpha to 1, but assign a TextureMaterial with a transparent PNG texture.

   

Avatar
Baush, Sr. Member
Posted: 30 November 2013 12:58 AM   Total Posts: 135   [ # 2 ]

Thanks I’ll give it a try!

   

Avatar
Baush, Sr. Member
Posted: 30 November 2013 01:06 PM   Total Posts: 135   [ # 3 ]

Same result as with the ColorMaterial.. The shadow won’t appear. I suspect the shadow to affect the pixels of the texture, so if they are invisible, so is the shadow. Any other ideas?

Thanks

   

John Brookes, Moderator
Posted: 01 December 2013 06:02 PM   Total Posts: 732   [ # 4 ]

Use a white material and BlendMode.MULTIPLY

   

Avatar
Baush, Sr. Member
Posted: 04 December 2013 05:54 PM   Total Posts: 135   [ # 5 ]

No luck with the BlendMode either, it just becomes all transparent.

Note that I also use a transparent view background to get full transparency.

Here’s some of my code if it helps:

view.camera.lens = new OrthographicLens(2.4);
  
view.camera.lens.near 0;
  
view.camera.lens.far 150;
  
view.camera.position = new Vector3D(100600);
  
view.camera.lookAt(new Vector3D(010));

  
sunLight = new DirectionalLight(-0.1, -10.1);

  var 
shadowMapper:NearDirectionalShadowMapper = new NearDirectionalShadowMapper(1);
  
shadowMapper.autoUpdateShadows true;
  
sunLight.shadowMapper shadowMapper;

  
sunLight.diffuse 0.3;
  
sunLight.ambient 0.9;
  
sunLight.specular 0;
  
sunLight.color 0xFFFFFF;
  
sunLight.ambientColor 0xFFFFFF;

  
light = new StaticLightPicker([sunLight]);
  
view.scene.addChild(sunLight);

  
defaultBackground = new BitmapTexture(new BitmapData(3232true0x00000000));
  
view.background defaultBackground
var floorMaterial:ColorMaterial = new ColorMaterial(0xFFFFFF1);
   
floorMaterial.blendMode BlendMode.MULTIPLY;
   var 
shadowMapMethod:FilteredShadowMapMethod = new FilteredShadowMapMethod(sunLight);
   
shadowMapMethod.epsilon 3;
   
floorMaterial.shadowMethod shadowMapMethod;
   
floorMaterial.lightPicker light;

   
floor = new Mesh(new PlaneGeometry(22), floorMaterial);
   
view.scene.addChild(floor); 
   

John Brookes, Moderator
Posted: 04 December 2013 06:12 PM   Total Posts: 732   [ # 6 ]

BlendMode will blend with whatever is behind it.
If your view color is black you wont see the effect.

So either lighten your back ground color or place another plane just behind your shadowplane.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X