Instancing, hardware skinning and normal maps.

Hey guys.
I have some questions which I coudn’t answer myself with the help of google.
First of all I need to write a function that transforms a heightmap to a normal map (I use it for ROAM terrains). I tried making one myself but it’s not good.

Next I would like to ask about the implementation of hardware instancing. I want only true hardware instancing not pseudo stuff. I couldn’t find any usefull demos about this.

Also the next thing is the hardware skinning. Couldn’t find anything usefull for this with google.
Maybe I’m not searching right.
Anyway could you guys be nice enough and point me to some things to read ?
Also I guess there shoudn’t be any difference if any of these things have to be implemented in a deferred rendering engine right? (Single pass)
Thank a million.

For skinning, read this. In particular look at the GLSL code, it should give you a good idea how it works:

I’m sure NVidia’s got something on it, but this isn’t complicated stuff. You call glDrawElementsInstanced (instead of glDrawElements) or similiar gl*Instanced call. You store the things that are common between all instances (e.g. vertex colors, texture coords, position offsets, …whatever) in vertex attribute arrays, and you store the things that vary per instance in a texture. In your shader, you use gl_InstanceID (for GLSL anyway) as a texture coordinate to look up those instance-varying things and merge them as appropriate with the vertex attribute data to get instance-specific appearance. Conceptually, pretty simple.

Google “tutorial gl_instanceid or sv_instanceid” and “instancing”. You can take any DX10 instancing tutorial and it applies to OpenGL.

For hardware skinning, nVidia SDK 9.5 “Improved Skinning”

For hardware instancing, nVidia SDK 10 “Instanced Tessellation”

But I think you should understand the theory first. As soon as you learn them, you can write out the code directly.