Skip to content

COLLADA Model using Relief Mapping in XNA, Animation next

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.

Cobblestone with Relief Mapping effect

Relief Mapping effect in XNA loaded from COLLADA

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)
Advertisements

2 replies »

  1. Good work! Here’s some ideas/comments

    Since graphics API moved away from fixed pipeline, all effects are implemented using shader programs (HLSL for XNA).
    COLLADA provides storage and binding for shader programs, which should be used to create effects such as normal map, depth maps…). .
    Since your next step is to look into animation, note that shader parameters can be the target of animations in COLLADA, this is another benefit to store together the model, shader program and its binding (which AFAIK unfortunately XNA does not make easy.

    Bump-mapping extension is a short cut, making the shader code implicit. It is not necessary a bad thing, but it is a short cut as far as COLLADA is concerned, as it should be done by providing proper shader code.

    Note that you could try the Spore exported models, that are exported with the same bump mapping extension, so you should be able to get good visual results from those exports and where you are at in your current implementation. Those models also come with a complete skin/bone model, but do not export animation curves, could be useful to get skin/bone working, and then try some IK techniques, or map some forward animations techniques.

  2. Thanks for your hints!

    You are right, I probably should have written “normal maps are not part of the common effect profile”.
    The common profile is what I wanted to implement at first to support the most common material definitions. The bump extension really is a convenient shortcut for this matter.

    Regarding bindings for shader programs: As of COLLADA 1.5 HLSL (I presume HLSL because of XNA) seems not to be part of the “official” profiles (like CG and GLSL). Also I have not yet found a sample file that actually contains a HLSL shader and its bindings, even though I have heard rumours that 3ds max actually supports this via extension.

    A thorough implementation of the COLLADA specification regarding shader profiles, bindings and animation would probably be the ideal. However, I’m afraid that won’t be possible for me to realize in such short time. Possibly I will be able to expand upon this in line with a master thesis, but right now that’s distant future for me (two years).

    Finally, thanks for mentioning Spore. I didn’t know about that. That surely will be helpful (and nice to look at)! 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Bunkerbewohner1

Error: Twitter did not respond. Please wait a few minutes and refresh this page.

My Del.icio.us

%d bloggers like this: