Bump mapping for Animated meshes

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Re: Bump mapping for Animated meshes

Post by ent1ty »

mongoose7 wrote:Hmm, I don't think you should multiply the tangent by the normal matrix. The same for the binormal.
You dare question the correctness of a piece of shader code found somewhere on the internet?
Well... How dare you?! :D


No seriously, it's not by the book, and i bet there's a whole lot of cases where this results in incorrect tangent and binormal. Still it's the easiest trick you can use to get (something fairly close to) normal or parallax mapping on animated meshes I know of.
Btw: if anyone has any more info on this from the mathematical point of view(how well does it work, cases when it doesn't work at all etc.), I'd be glad to learn something new :)
Last edited by ent1ty on Wed Nov 20, 2013 5:18 pm, edited 1 time in total.
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps

Step back! I have a void pointer, and I'm not afraid to use it!
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: Bump mapping for Animated meshes

Post by robmar »

Why don´t WE get it to work!?

But I would like an answer from Nadro about his SkinnedMesh solution, if it is a solution... :?
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: Bump mapping for Animated meshes

Post by The_Glitch »

I have a shader I made that's "in game" in Irrlicht if you want it, it can do plain normal mapping or normal specular mapping or normal specular with detail maps if you want.

But it does require that you use the Skinned mesh convertotangentMesh();

If this is what your trying not to use I haven't seen to many issues with it, hasn't killed any performance, but I haven't tried calculating the tangents in the shader I need to try this. Any yes works the exact same on static and animated meshs. Direct3D shader.

Also the only thing I don't like it Irrlicht mapping BINORMAL0 and TANGENT0 to TEXCOORD1 and TEXCOORD2 I've had this stop a lot of progress on one of my shaders.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Bump mapping for Animated meshes

Post by Nadro »

The_Glitch wrote:Also the only thing I don't like it Irrlicht mapping BINORMAL0 and TANGENT0 to TEXCOORD1 and TEXCOORD2 I've had this stop a lot of progress on one of my shaders.
It's already fixed in shader pipeline branch :)

@Robmar
Solution is available in post (3rd post) from your link...
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: Bump mapping for Animated meshes

Post by robmar »

@Nadro: I know I can apply material type (i.e. bump map shader) to each material and hence submesh, my problem is how to convert to tangents just those particular SUB-meshes?
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: Bump mapping for Animated meshes

Post by The_Glitch »

@ Nadro I didn't know this awesome. I'm not excatly sure how to use the update branch do I download an alternate source and recompile it?
Sorry never used a server trunk before.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Bump mapping for Animated meshes

Post by Nadro »

If you don't need flexible vertex format you should stay with stable version or trunk. If you need flexible vertex format support download shader-pipeline branch and compile sources.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: Bump mapping for Animated meshes

Post by robmar »

Nadro, any chance of an answer?

"@Nadro: I know I can apply material type (i.e. bump map shader) to each material and hence submesh, my problem is how to convert to tangents just those particular SUB-meshes?"
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Bump mapping for Animated meshes

Post by Nadro »

You can convert to tangents whole skinning mesh.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: Bump mapping for Animated meshes

Post by robmar »

and I don´t have to convert all those 1000 frame meshes? How does that function? I don´t see how the skinning mesh creates tangents for all those frames...
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Bump mapping for Animated meshes

Post by Nadro »

Skinning mesh doesn't use precalculated frames, it uses joints, thats why you generate vertex position, normal etc just for '1 frame'.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: Bump mapping for Animated meshes

Post by robmar »

okay but then the frames won´t run?

Is this used in one of the Irrlicht examples?
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Bump mapping for Animated meshes

Post by Nadro »

All *.b3d, *.x and .ms3d meshes in Irrlicht are loaded as skinned meshes, so eg. you can check how it works in all examples which use dwarf.x.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: Bump mapping for Animated meshes

Post by robmar »

But don´t they just use IAnimatedMesh and LoadMesh?
robmar
Posts: 1125
Joined: Sun Aug 14, 2011 11:30 pm

Re: Bump mapping for Animated meshes

Post by robmar »

I´ve just looked at sample 8 which uses a Dwarf.x and no sigh of a skinned mesh anywhere!

Back in 2008 Blindside wrote this about skinned meshes:-

"It's possible to use ordinary Irrlicht normal mapping on animated meshes ever since SkinnedMesh was introduced in version 1.4. You just have to convert the mesh to tangents using "irr::scene::ISkinnedMesh::convertMeshToTangents()". (First you must load an animated mesh and cast it to a skinned mesh eg.:

Code: Select all
IAnimatedMesh* mesh = smgr->getMesh("mymesh.x");
((ISkinnedMesh*)mesh)->convertMeshToTangents();"

So Nadro, I´m thinking your leading me up a creak with no paddle! :) - but I am testing Blindside´s code snippet and will post the results, so beware! :twisted:
Post Reply