PDA

View Full Version : Instancing, hardware skinning and normal maps.



Sanctus
07-11-2009, 04:36 AM
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.

remdul
07-11-2009, 05:41 AM
For skinning, read this. In particular look at the GLSL code, it should give you a good idea how it works:
http://lumina.sourceforge.net/Tutorials/Armature.html

Dark Photon
07-11-2009, 05:06 PM
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.
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 site:nvidia.com". You can take any DX10 instancing tutorial and it applies to OpenGL.

LangFox
07-11-2009, 07:08 PM
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.