Introduction
The contents of this page handle general informations about model shadows, how to implement a model with shadows as a custom .mdl into your module - and solutions for issues that might (and probably will) come along the way. If you happen to encounter a problem that can't be solved with any of the solutions below, you can always ask around in the community and the discord. Note that the given solutions might not apply to your specific problem. If the bug perists, or if you find a way around it, by all means, do share it with us to keep the flame alive.
It goes with saying that you have a backup of your file before you head out to edit or export it, therefore the author of this page takes no responsibility if data gets lost along the way.
Shadows
Definition
What are shadows essentially? This question might be irritating to some and feel like it's actually easy to answer.
However, as with anything, the case if often more complex as explained the quote down below:
Shadows are a result of the absence of light due to occlusion (occlusion: blocking off, blockage). When a light source's light rays do not hit an object because it gets occluded by some other object, the object is in shadow. Shadows add a great deal of realism to a lit scene and make it easier for a viewer to observe spatial relationships between objects. They give a greater sense of depth to our scene and objects. [...]
Shadows are a bit tricky to implement though, specifically because in current real-time (rasterized graphics) research a perfect shadow algorithm hasn't been developed yet. Taken from LearnOpenGL, click here to learn more (Note: Neverwinter uses DirectX)
Shadow Mapping
The concept of shadow mapping is quite simple. All you need is a light source for your environment and a scene it interacts with. To demonstrate this, let's say the ground there in our image is a single tile of our area and the cube is an object in it's way - for example a crate.
The light source is constantly lighting up the space around itself where it is placed in our environment. This is described in many shapes, sometimes as a cone (car lights), sometimes a sphere (torch or light bulb) and other times it's the sun. What is important though, is that once the light hits the object in it's way, it will describe the rest of it's path as occluded, thus rendering the faces it can not physically reach as dark. While there are concepts like indirect lighting, subsurface & specular materials, for our purpose we really just need to understand the basics of Shadow Mapping as you will notice this in your toolset as well.
Since I've previously mentioned there are many shapes, the one NWN uses for it's environment is of course a sun.
That means that it will cast light over the whole scene indifferent to how close the objects are to the source, instead the angle the light hits the object from is the only important measure. In our rendered example to the left, we use a point light, which is similar to a torch.
Tthe further away the object is, the longer the shadow grows and the weaker the light illuminates the tile and the object itself.
On the right we see the clear, constant distribution of light only obstructed by objects in it's way. In this sense, it is just a single crate. This is the light cast by the sun.
The tile itself only casts shadows from an elevated position and if a large object necessarily demands it.
Notice how the weed on the ground does not cast any shadows at all, but the cliffs do. Your placeables will typically cast shadows as well.
Shadow Mapping example as seen in Blender, rendered in Eevee
Shadow Mapping example as seen in NWNToolset, Crate & Weed
Shadow Mapping example as seen in NWNToolset, Weed, Stones & Cliffs
Working with Shadows
Prerequisition
NeverBlender
I assume that you have somewhat basic knowledge about how to handle import-export using NeverBlender and that you can manipulate a mesh to visually express your creative ideas.
If for some reason you haven't used Blender before, nor have you installed the import-export plug-in NeverBlender and have no experience with it at all, I would recommend you to to download them, read the instructions to NeverBlender from the Neverwinter Vault Page and visit some tutorials and videos on how to create your own model and import it into your module.
Note: This page does not cover NWN 2 related modelling, nor will it explain how to UV Map and texture your model.
NeverBlender is a plug-in that will cover your basic needs for Placeables, Doors, Models, Phenotypes, Walkmeshes, Animations and much more. I recommend it strongly, as Blender is a Free Open-Source Tool for 3D Modelling, Animation & Rendering - and as of late a gradually growing, powerful physics engine.
NWMax
You own 3DS Max and have the NWMax Plug-In for it?
Do replace this text and add in your workflow here to enable shadows in your model export.
Step 1:
Load up your project file (after having created a backup file for it.) For this tutorial I will load up one of my recent head models. To learn how to extract models as a readable MDL ASCII file, click here. For m Or one of the links for more information on UV Mapping or Texture Painting in general.
For my example, I have taken pfh0_head155, remodelled it, renamed it to pfh0_head200 and did the same for it's pfh0_head200g. You may notice that my mesh has more polygons than the average head model for a NWN character. How you choose to model your head is up to you, enjoy the freedom.
The hierachy goes as follows:
pfh0_head200 (PARENT: root of your head, it should be centered and rotated to x0.0, y0.0, z0.0, scaled to 1.0)
→ pfh0_head200g (CHILD TO pfh0_head200 | PARENT OF pfh0_head200g: this is your head model.)
→→ pfh0_head200g (CHILD TO pfh0_head200g | PARENT OF image_textures: These are the data properties of your model)
→→→ image_texture (CHILD TO pfh0_head200g: The material that will be laid over your texture.)
→→ Vertex Groups (CHILD TO pfh0_head200g | PARENT TO constraints: This is your vertex group 'folder')
→→→ constraints (CHILD TO Vertex Groups: Vertex Groups are used for dangly mesh weight assignment.)
→ shadow_dummy (CHILD TO pfh0_head200: This is a hidden mesh. You will learn about it later.)
→→ shadow_dummy (CHILD TO shadow_dummy: Data property of the shadow dummy mesh
→→→ material (CHILD TO shadow_dummy: unused material generated by the export.)
Step 2:
Bug:Stretching Shadows / Rip & Tear Glitch
This section handles an export bug one might encounter when exporting an .mdl model from Neverblender into the NWToolset to use as custom content.



