I plan soon to publish a robot rigged cc0 with animations in different formats, md2 and b3d, all good so far, but I do not know how to implement in normalsmaps code in animated geometry, has anyone experienced this?
I have seen that you can convert geometry to tangent using "MeshConverter", I tried converting a geometry and importing it to irrEdit, but the normalmaps do not load, I have not yet tried in code as I do not know how to start this task properly.
At the moment I have it textured as follows, although I still have to change the red parts to make it look like the head.
How to add normalmaps into animated mesh?
How to add normalmaps into animated mesh?
**
If you are looking for people with whom to develop your game, even to try functionalities, I can help you, free. CC0 man.
**
If you are looking for people with whom to develop your game, even to try functionalities, I can help you, free. CC0 man.
**
Re: How to add normalmaps into animated mesh?
If you are lucky the format already creates a meshbuffer with tangents (I think .X format does, not sure about others). Then you have to ensure the normalmap is in texture 1 slot (slot 0 has diffuse). And materialType is EMT_NORMAL_MAP_SOLID, EMT_PARALLAX_MAP_SOLID, EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA or EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA.
I'm not sure about options if the loader can't create tangents already. As long as it uses SSkinMeshBuffer internally you could create automatic tangents with SSkinMeshBuffer::convertToTangents, but it wouldn't really initialize the tangent and binormal. IMeshManipulator::recalculateTangents can calculate tangents, but not sure if it works with SSkinMeshBuffer (but I think it does). So maybe calling those 2 could get you tangents even when loaders do not support it.
What also might be useful is that you can also automatically create normal-map textures with driver->makeNormalMapTexture (it makes dark areas "low" and bright areas "high", but only regards red channel for 32-bit textures). Good for a first test. Thought for better normal-maps you usually create them in a tool.
There are other options to have normalmaps, but those are a bit more complicated and require writing your own shader. Thought they have the advantage that you can code shaders to generate the tangents/binormals so you can work with simpler meshbuffers.
I'm not sure about options if the loader can't create tangents already. As long as it uses SSkinMeshBuffer internally you could create automatic tangents with SSkinMeshBuffer::convertToTangents, but it wouldn't really initialize the tangent and binormal. IMeshManipulator::recalculateTangents can calculate tangents, but not sure if it works with SSkinMeshBuffer (but I think it does). So maybe calling those 2 could get you tangents even when loaders do not support it.
What also might be useful is that you can also automatically create normal-map textures with driver->makeNormalMapTexture (it makes dark areas "low" and bright areas "high", but only regards red channel for 32-bit textures). Good for a first test. Thought for better normal-maps you usually create them in a tool.
There are other options to have normalmaps, but those are a bit more complicated and require writing your own shader. Thought they have the advantage that you can code shaders to generate the tangents/binormals so you can work with simpler meshbuffers.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: How to add normalmaps into animated mesh?
thank you cutealien, I don't know what the forum would be without youCuteAlien wrote: ↑Tue Aug 13, 2024 7:25 pm If you are lucky the format already creates a meshbuffer with tangents (I think .X format does, not sure about others). Then you have to ensure the normalmap is in texture 1 slot (slot 0 has diffuse). And materialType is EMT_NORMAL_MAP_SOLID, EMT_PARALLAX_MAP_SOLID, EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA or EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA.
I'm not sure about options if the loader can't create tangents already. As long as it uses SSkinMeshBuffer internally you could create automatic tangents with SSkinMeshBuffer::convertToTangents, but it wouldn't really initialize the tangent and binormal. IMeshManipulator::recalculateTangents can calculate tangents, but not sure if it works with SSkinMeshBuffer (but I think it does). So maybe calling those 2 could get you tangents even when loaders do not support it.
What also might be useful is that you can also automatically create normal-map textures with driver->makeNormalMapTexture (it makes dark areas "low" and bright areas "high", but only regards red channel for 32-bit textures). Good for a first test. Thought for better normal-maps you usually create them in a tool.
There are other options to have normalmaps, but those are a bit more complicated and require writing your own shader. Thought they have the advantage that you can code shaders to generate the tangents/binormals so you can work with simpler meshbuffers.
**
If you are looking for people with whom to develop your game, even to try functionalities, I can help you, free. CC0 man.
**
If you are looking for people with whom to develop your game, even to try functionalities, I can help you, free. CC0 man.
**