Shadows and tiles...
Posted: Tue Mar 01, 2005 10:32 pm
Shadows
The biggest problem I've run into is that for shadows to be proper a line has to be able to be drawn from the pivot point through the back face of each polygon of an object. If that line passes through the front face (the one you can see) or if it passes through two of more polys you'll have broken shadows.
The pivot point being above the ground plane is also a problem. Each node in a model has a pivot point. If the pivot point can see ANY face of the node it'll cause bad shadows.
The easiest and simplest fix is create your objects. Texture them. If its a complex object, anything with curves or bends, then go into the sub gizmo for faces and break the object up into sections. To do that you just select a group of faces and click the Detach button and leave both element and clone unchecked. Those selected faces become a new object of their own but they keep their texture coords.
Then edit the pivot point of each new object so that you can draw that line from it to each poly passing through the back face (along the line of the normal) without passing through more than one.
This has fixed every shadow problem I've had.
|__
...|
...|
|--
A model (ignore the .'s) in the above shape will cast bad shadows assuming that the visible faces are on the left. No matter where you put the pivot point a line can't be drawn through each poly without hitting the wrong side or or passing through more than one.
Break that up into
|__
...|
...|
|--
these three parts and put the pivot point a little bit to the right and up of the first, to the right of the second and to the right and down of the third and they'll cast good shadows.
Also;
When you break the objects apart remember to move the pivot point.
The best and easiest way to make sure its positioned right is goto Pivots, click Affect Pivot Only, click Center to Object.
Now draw an imaginary line from the pivot through every polygon of the object. If the line doesn't pass through the backside of each one you're going to have bad shadows.
Essentially any shape more complex than a straight box or tube is a prime candidate for requiring breaking it up into multiple objects.
Other than don't put your ML's and SL's below the ground there isn't a bad position AFAIK.
Also make sure that your tile is a tile. There are some very odd things that happen on occasion if you've got the classification as anything but tile for a tile.
-Danmar
-------------------------------
So there may be a reason that BW has that snap to nearest centimeter setting so shadows don't get goofed up.
-------------------------------
Q: I'm building tiles that have sloped areas going into the water with some walkable water areas. I understand that the engine will not draw shadows on models below the world z axis zero point. Does anyone know why there is this restriction and if there is anyway around it.
A: The restriction is in place for speed. By chopping the shadows at 0 the engine doesn't have to compute anything that might fall past that and thus you get a speed increase.
There is no way around it.
***********
WIth that said there is a way around it. Simply raise you tiles and walk meshes X meters off the ground to the point where your lowest point is at or above z = 0.
The downside to this is that it hides the grid in the toolset which is a minor to major thing for you possible.
I wrote a max utility to perform this specific function. Select all your tile parts and click lift and it'll lift or raise all the parts according to the dialed in shift.
------------------------------
Danmar
I had a lot of shadow issues with a small tent I made and I eventually just made a simple extruded triangle shape, made it non-rendering but shadow casting and set the tent and all its objects to not cast shadows.
If your looking for it you can see that the shadows cast are not quite right but they're a lot better than the shadows cast by the real geometry.
The biggest problem I've run into is that for shadows to be proper a line has to be able to be drawn from the pivot point through the back face of each polygon of an object. If that line passes through the front face (the one you can see) or if it passes through two of more polys you'll have broken shadows.
The pivot point being above the ground plane is also a problem. Each node in a model has a pivot point. If the pivot point can see ANY face of the node it'll cause bad shadows.
The easiest and simplest fix is create your objects. Texture them. If its a complex object, anything with curves or bends, then go into the sub gizmo for faces and break the object up into sections. To do that you just select a group of faces and click the Detach button and leave both element and clone unchecked. Those selected faces become a new object of their own but they keep their texture coords.
Then edit the pivot point of each new object so that you can draw that line from it to each poly passing through the back face (along the line of the normal) without passing through more than one.
This has fixed every shadow problem I've had.
|__
...|
...|
|--
A model (ignore the .'s) in the above shape will cast bad shadows assuming that the visible faces are on the left. No matter where you put the pivot point a line can't be drawn through each poly without hitting the wrong side or or passing through more than one.
Break that up into
|__
...|
...|
|--
these three parts and put the pivot point a little bit to the right and up of the first, to the right of the second and to the right and down of the third and they'll cast good shadows.
Also;
When you break the objects apart remember to move the pivot point.
The best and easiest way to make sure its positioned right is goto Pivots, click Affect Pivot Only, click Center to Object.
Now draw an imaginary line from the pivot through every polygon of the object. If the line doesn't pass through the backside of each one you're going to have bad shadows.
Essentially any shape more complex than a straight box or tube is a prime candidate for requiring breaking it up into multiple objects.
Other than don't put your ML's and SL's below the ground there isn't a bad position AFAIK.
Also make sure that your tile is a tile. There are some very odd things that happen on occasion if you've got the classification as anything but tile for a tile.
-Danmar
-------------------------------
So there may be a reason that BW has that snap to nearest centimeter setting so shadows don't get goofed up.
-------------------------------
Q: I'm building tiles that have sloped areas going into the water with some walkable water areas. I understand that the engine will not draw shadows on models below the world z axis zero point. Does anyone know why there is this restriction and if there is anyway around it.
A: The restriction is in place for speed. By chopping the shadows at 0 the engine doesn't have to compute anything that might fall past that and thus you get a speed increase.
There is no way around it.
***********
WIth that said there is a way around it. Simply raise you tiles and walk meshes X meters off the ground to the point where your lowest point is at or above z = 0.
The downside to this is that it hides the grid in the toolset which is a minor to major thing for you possible.
I wrote a max utility to perform this specific function. Select all your tile parts and click lift and it'll lift or raise all the parts according to the dialed in shift.
------------------------------
Danmar
I had a lot of shadow issues with a small tent I made and I eventually just made a simple extruded triangle shape, made it non-rendering but shadow casting and set the tent and all its objects to not cast shadows.
If your looking for it you can see that the shadows cast are not quite right but they're a lot better than the shadows cast by the real geometry.