Shadows and tiles...
Come here for tutorials and 3d training. The aim is to point out good 3d training sites or methods.

Moderators: Winterhawk99, Mermut, Bannor Bloodfist

Post Reply
Guest

Shadows and tiles...

Post by Guest »

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.

Guest

Post by Guest »

Two things here. 1st is a ref. to DLA CC Wikki on shadows.

2nd is a post reguarding a shadow problem on the Bioware forums that is very interesting.

Q: Corvallis
I was working on some retextures with the SOU desert and I ran into some very strange shadow probems. This has to do with the 'giant statue head'. It looks fine in org. sou campain & toolset.

Does exporting mdl and converting them to ascii change the pivot point or something? Even if you take the org. mdl without retexture as soon at it goes through compDcomp the models toast (as far as shadows go). Try it?

Model: ttd01_q01_01

As NWmax uses compDcomp to change mdl for use in Gmax it's still a bad move. Not sure if I can use that model. Any idea?


A: Danmar
Heh there's no way that head could not cast bad shadows, the ear faces will always screw things. Yet the original doesn't of course how can this be you ask? There's a little known, (maybe I'm the only one?), loophole in the all faces must face away from the model's pivot point.

And that loophole is that when there is _no_ smoothing data, each face is a not smoothed with its neighbors, then they will never cast bad shadows as a result.

The fact that its little know is possibly because of the fact that everything that decompresses a mdl file puts all the faces into the same smoothing group rather than honor any existing smoothing group data. This is a bug that goes back to the very first decompiler.

And there are very very few objects in NWN that aren't smoothing to some degree other than flat planes or 90 degree angle blocks.

The original head has no smooothing groups which makes each face a 'virtual' self contained object so it will cast shadows based only on its own orientation to the light.

Faces in smoothing groups, which because of the bug in every importer/exporter/decompiler, the entire group of smoothed faces is used to cast shadows which then has to obey the pivot line commandment on shadow casting.

Just import the tile and then select the head, go to face submode, select all faces, then scroll down to smoothing groups and click the Clear All to get rid of all smoothing group data. This will result in the 'faceted' when you've succesfully managed it.

And your big head won't be casting all the freaky shadows.


This of course relates to smoothing as well.

Post Reply