|
batiali, Newbie
Posted: 10 August 2012 02:49 PM Total Posts: 5
Hey,
This is a newbie question that I failed to find an answer.
Is it possible to cast shadow of a mesh on to another mesh? I mean, I’m able to see the shadow of a mesh on a plane without additional setting, but unable to make it work on another mesh. For example I can’t see the shadow of a cube on another cube.
Any help or directing to an example is appreciated.
|
batiali, Newbie
Posted: 10 August 2012 05:19 PM Total Posts: 5
[ # 1 ]
I think I figured the problem.
In my case, even though I set the proper shadowMethod of a material, because the mesh is too small, it doesn’t cast its shadow. When I scaled it, the problem is solved. Anyone knows what’s the limitation? and a solution?
|
Richard Olsson, Administrator
Posted: 10 August 2012 06:18 PM Total Posts: 1192
[ # 2 ]
The shadows are (generally) calculated using across the entire frustum of the camera, so if the frustum is smaller, the shadow will have better precision per distance unit. If you have a very small scene, try decreasing the “far” setting of the camera to make the frustum smaller. You can access this setting via myView.camera.lens.far.
|
batiali, Newbie
Posted: 10 August 2012 11:18 PM Total Posts: 5
[ # 3 ]
Thanks Richard, that’s a great answer, but actually I couldn’t make it work on my case. Scene is not small, there’s a big terrain that’s procedurally generated and lots of very small 3d objects on it. (like trees and houses…) So, decreasing the “far” value actually breaks other stuff.
I tried baking these small objects’ shadows on the terrains texture so, it seemed fine at the moment, thanks for your answer, it helpmed me understand another part of the away3d!
|
Richard Olsson, Administrator
Posted: 12 August 2012 08:49 AM Total Posts: 1192
[ # 4 ]
If your objects are static (as yours seem to be) you should definitely bake the shadow into the ground texture like you’re doing now, to avoid having to repeatedly render the shadows every frame. Real-time shadows are sort of heavy, and you are much better off performance-wise if you just calculate the shadows once and bake them into the texture (through code, or in your modeling/texturing workflow.)
|
synkarius, Member
Posted: 12 August 2012 11:46 PM Total Posts: 64
[ # 5 ]
Richard, how would one bake shadows via code?
|