After I’ve been working most of the day on skeletal animation support for my COLLADA Model class I returned messing with my Relief Mapping implementation. Turned out it was implemented correctly – only the scale weights were way off which caused a weird effect. I just had to decrease the weights by three orders of magnitude.
For testing purposes I created a simple plane with a cobblestone texture and corresponding normal map (with height encoded into the alpha channel) in 3ds Max and exported to DAE format (COLLADA). The result is a nice self-shadowing Relief Map effect on two quads, as can be seen in the following screenshot.
The tank is still the same test model (of course also a COLLADA file) consisting of three meshes and using parallax mapping. However, as I created the corresponding normal map manually it doesn’t really look good.
Since the official COLLADA 1.5 specification does not support normal maps of any kind by default * I am using the bump extension of 3ds Max. As far as I know you cannot specify in 3ds Max how the normal map shall be used. Currently my material system supports Dot3 Bump Mapping, Parallax Mapping and Relief Mapping (also called Steep Parallax Mapping). I’m not really a 3d designer, which is why I basically have no clue how to properly use 3ds max or similar tools. Maybe there is an elegant way to specify which technique should be used within the content creation tool, but since I don’t know of any I added a XNA content processor parameter called “NormalMapType” which can be used to set the desired effect from within Visual Studio’s property window.
(* Normal Maps are not part of the common effect profile, which is actually only kind of a fixed-function fallback solution when programmable shaders are not supported on the current platform. However, many 3D game models use this profile exclusively, especially in the Indie game development domain.)
Up next is still the animation system which proves to be a challenge. I don’t want to make too many assumptions about the model and the contained animations, but more general approaches result in more complex problems. I’ve found two XNA implementations of skeletal / skinned animation based on COLLADA, both of which presume that there is only one mesh, one material, one skin and one skeleton. These assumptions make dealing with the animation in COLLADA almost trivial, but I personally feel like these limitations are too tight. Also, so far my Model implementation already supports multiple meshes and multiple materials per mesh for static geometry (i.e. no animation is imported yet).
I will try to find a compromise. I have at most two months left to complete this project which is my bachelor thesis. And I have not eved started writing any text (other than source code). But skeletal animation is a must. When that is completed the following things are on top of my to-do list, if there is time to complete them:
- Morph Target Animation
- Mesh Instancing support (the architecture is ready, but not yet the implementation)
- Collision Detection (maybe through an interface for existing physics libraries)
- Custom Shader support (actually that’s already possible if the used shader sticks to certain naming conventions)