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.
**
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 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.
CuteAlien 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.
thank you cutealien, I don't know what the forum would be without you
**
If you are looking for people with whom to develop your game, even to try functionalities, I can help you, free. CC0 man.