Shadows
From NWN1 Custom Content Guide
To put it bluntly, shadows are a pain in the butt to check and fix, but when you understand how they operate in regards to the setup, it because a bit easier to do your modeling to account for this implementation.
The general rule of thumb to insure a model will cast a shadow properly is to draw a line from the pivot point of the mesh to the center and back of each face (poly) on the mesh (opposite the normals). No overlaps are allowed through other faces. So you can tell that NWN prefers convex objects.
| Image:Shadows 01.jpg | A good easy example would be something like a box (cube), the pivot can be anywhere in the interior and the box will cast shadows properly.
Dark grey lines are from the pivot to the back of the face, the little lines poking from the face are the orientation of the normals. |
| Image:Shadows 02.jpg | Now, how about a slightly more complex object? Let's make it into a simple sword hilt and handle: |
| Image:Shadows 02a.jpg | Ut-ho, as we can see from the top view, there might be problems with the shadows, due to the bottom part of the hilt facing the other way. But with a simple move of the pivot closer to the center of the hilt, it works out ok: |
| Image:Shadows 03.jpg | And for really complex meshes with multiple layers of surfaces (barrels, trees) or is concave in nature? You can't do it with one pivot, so don't be afraid to split your mesh up into multiple objects. Take for instance, the standard NWN barrel:
As you can see, Bioware split the barrel walls into 4 parts so the lip of the walls at the top where the lid opens up will be able to cast a shadow properly when the barrel is 'opened'. |
| Note: | Objects with DanglyMesh (aka Flex) on them will cast shadows, but if you're dealing with a flat object like say the sail of a boat, it might be an idea to separate the sail into two objects. |
| Note: | Skinmesh objects will NOT cast shadows, but there is a simple trick here. Use the bones themselves. Set the trimesh properties to not render but cast shadows. Oversize your bones and you can fake shadows fairly well with this approach while still being polygon conscious. |
| Note: | Extremely complicated large sized objects are better avoided altogether, as there is a limit to the number of objects a single model can have (you can't split a model of a rocket engine into zillions of pieces). A possible way around this, is to split the model into several smaller parts (less complicated models). |
| Note: | There's a little known, (Danmar says) 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. |
Another solution is use a 'shadow proxy', that is, set the normal objects to be "Render=Yes, Shadow=No" then have a bunch of other (low poly) objects with "Render=No, Shadow=Yes" be the ones that actually cast the shadows. This also works out because the shadow casting tends to slow the game down, so by using a low poly object for the shadow casting, it potentially speeds up the game's frame rate.
Main_Page | Shadows
