Looking for some examples on how to use the shadow mapping methods. Or how to create dynamic shadows in general. Any help?
Any code examples on how to use SoftShadowMapMethod and SlowFilteredShadowMapMethodSoftware: Away3D 4.x |
||
|
||
Somokon, Member
Posted: 20 July 2011 04:14 PM Total Posts: 75 [ # 1 ] For every material that you want the shadow to appear on
material.shadowMethod = SlowFilteredShadowMapMethod(lightSource)
or
material.shadowMethod = SoftShadowMapMethod(lightSource, stepSize=0.00025)
Also ensure your light source is added to the material as well
material.lights = [lightSource1, lightSource2, ...]
|
||
julespong, Member
Posted: 20 July 2011 06:03 PM Total Posts: 53 [ # 2 ] ok, here’s my code: Mesh(event.asset).castsShadows = true;
Can someone tell me why it’s trying to convert my lightsource to a shadowmap method? FYI: I’m using the nightly build of Away 4 |
||
julespong, Member
Posted: 20 July 2011 06:25 PM Total Posts: 53 [ # 3 ] Additionally, I’ve attempted to instantiate a new shadowmapping method: material.shadowMethod = new SlowFilteredShadowMapMethod(__lights[2]);
Error: An abstract method was called! Either an instance of an abstract class was created, or an abstract method was not overridden by the subclass. So… either I’m supposed to instantiate a ShadowMapMethod and I’m getting an abstract method error. Or I’m supposed to use the ShadowMapMethod statically and I’m getting a type conversion error. Any pointers? |
||
Somokon, Member
Posted: 21 July 2011 06:37 AM Total Posts: 75 [ # 4 ]
That would be because you forgot the ‘new’ operator in front of SlowFilteredShadowMapMethod. Without it, your code attempts to cast _lights[2] into SlowFilteredShadowMapMethod object.
If you are still having trouble can you paste the rest of your code? |
||
David Lenaerts, Administrator
Posted: 21 July 2011 09:44 AM Total Posts: 80 [ # 5 ] Julespong: Is _lights[2] perhaps a Point Light? Shadow mapping for point lights isn’t supported. Only Directional Lights work. Also, something very important concerning SlowFilteredShadowMapMethod: with the latest FP11 beta, this is broken and will complain about not being able to compile the shader programme. This is because of some new limitations on programme length. We’re still hoping for some update in the player, tho. |
||
julespong, Member
Posted: 21 July 2011 06:32 PM Total Posts: 53 [ # 6 ] Ahh… that makes sense then. Yes, I’m using the FP11 beta and yes, I was attempting to use a PointLight for my light source. I’ll try to use the SoftShadowMapMethod instead of the SlowFilteredShadowMapMethod also. Thanks for the info. |
||
julespong, Member
Posted: 21 July 2011 08:33 PM Total Posts: 53 [ # 7 ] Well, I got it working with a DirectionalLight and a SoftShadowMapMethod. What range does the stepsize argument take? Also, how do I control the opacity of the shadow? The shadow I’m getting using the default stepsize seems very pixelated and fragmented. Any advice on how to clean that up? What can we expect in terms of shading capabilities when 4.0 releases? |