Animated tangents+binormals (and added to X Mesh Loader)
-
- Posts: 22
- Joined: Mon Nov 15, 2010 9:18 pm
Animated tangents+binormals (and added to X Mesh Loader)
So locally I have made some changes to the Irrlicht engine so Tangents and Binormals can be loaded from X Mesh files, and can be animated by skinned animations. I've tested this with an animated model (exported via Kw exporter and it works fine).
Here is the patch if anyone wants it:
http://dl.dropbox.com/u/2809326/Tangents.patch
As I mentioned in another thread, I also added support for floating point textures on OpenGL, though this somewhat more hacked, and should prob be tidied up a little before checking in:
http://dl.dropbox.com/u/2809326/Floatin ... ures.patch
Would it be possible to write access to the SVN repository so I can check-in directly ?
Here is the patch if anyone wants it:
http://dl.dropbox.com/u/2809326/Tangents.patch
As I mentioned in another thread, I also added support for floating point textures on OpenGL, though this somewhat more hacked, and should prob be tidied up a little before checking in:
http://dl.dropbox.com/u/2809326/Floatin ... ures.patch
Would it be possible to write access to the SVN repository so I can check-in directly ?
Thanks for the patches. Tangents.patch seems to be 3 patches in one.
The SViewFrustum changes have been requested recently by more people, so I guess everyone is happy when they are applied.
The tangents fix for dx looks also look good to me on first view. If you have any test-model for me to check if it works I can apply it.
Don't know about the fast_atof change, I don't think that is correct (as the value can't be larger than UINT_MAX), what was your reason for changing this?
The SViewFrustum changes have been requested recently by more people, so I guess everyone is happy when they are applied.
The tangents fix for dx looks also look good to me on first view. If you have any test-model for me to check if it works I can apply it.
Don't know about the fast_atof change, I don't think that is correct (as the value can't be larger than UINT_MAX), what was your reason for changing this?
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
-
- Posts: 22
- Joined: Mon Nov 15, 2010 9:18 pm
Ah yeah, the X loader was hitting that error case in findNextNoneWhiteSpaceNumber. If the number to be read was larger than INT_MAX (but less than UINT_MAX) then it would get truncated incorrectly. Looking at it again it seems the correct solution is to add strtou10 that returns u32.CuteAlien wrote: Don't know about the fast_atof change, I don't think that is correct (as the value can't be larger than UINT_MAX), what was your reason for changing this?
-
- Posts: 22
- Joined: Mon Nov 15, 2010 9:18 pm
Here is the corrected code. With the new function:griffin2000 wrote:Ah yeah, the X loader was hitting that error case in findNextNoneWhiteSpaceNumber. If the number to be read was larger than INT_MAX (but less than UINT_MAX) then it would get truncated incorrectly. Looking at it again it seems the correct solution is to add strtou10 that returns u32.CuteAlien wrote: Don't know about the fast_atof change, I don't think that is correct (as the value can't be larger than UINT_MAX), what was your reason for changing this?
http://dl.dropbox.com/u/2809326/Correct ... ents.patch
-
- Posts: 219
- Joined: Fri Feb 19, 2010 4:03 pm
- Location: Estonia
Splendid! Going to test it asap.
The collada format also contains binormal and tangent information (and there are excellent Collada exporters for most major design apps). Could you possibly also do the same for Collada (.dae) loader? That would be a great and *very* needed addition.
Thanks for the effort and for sharing.
The collada format also contains binormal and tangent information (and there are excellent Collada exporters for most major design apps). Could you possibly also do the same for Collada (.dae) loader? That would be a great and *very* needed addition.
Thanks for the effort and for sharing.
to live, is natural; to die, is not!
The following line looks suspicious:
Did you want to check for tangenttype instead of 2 times for tangentpos?
Code: Select all
if ((tangentpos != -1 && tangentpos == 1) || (binormalpos != -1 && binormaltype == 1))
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
-
- Posts: 22
- Joined: Mon Nov 15, 2010 9:18 pm
Indeed, well caught, should have read:CuteAlien wrote:The following line looks suspicious:
Did you want to check for tangenttype instead of 2 times for tangentpos?Code: Select all
if ((tangentpos != -1 && tangentpos == 1) || (binormalpos != -1 && binormaltype == 1))
Code: Select all
if ((tangentpos != -1 && tangenttype == 2) || (binormalpos != -1 && binormaltype == 2))
-
- Posts: 22
- Joined: Mon Nov 15, 2010 9:18 pm
Indeed unfortunately the Collada loader does not support skinning, so is no good for my needs. I make take a stab at adding both features at some point as its generally a much more widely supported format.xirtamatrix wrote:Splendid! Going to test it asap.
The collada format also contains binormal and tangent information (and there are excellent Collada exporters for most major design apps). Could you possibly also do the same for Collada (.dae) loader? That would be a great and *very* needed addition.
Thanks for the effort and for sharing.
I start to run into problems because I don't really know enough about mesh-loaders. I suppose this solution might have trouble when more than one texture is set because the vertex format would no longer correspond to the materialtype.
As far as I can see right now the only choice for material is setting it to video::EMT_LIGHTMAP after a check that probably looks if a second texture is available. Otherwise it should be set to EMT_SOLID. Solid would probably be fine as S3DVertexTangents is derived from S3DVertex, but S3DVertexTangents and S3DVertex2TCoords are incompatible.
Maybe I'm missing something, but I think we must also figure out which Materialtype to use for the tangent formats or the results should be unpredictable.
As far as I can see right now the only choice for material is setting it to video::EMT_LIGHTMAP after a check that probably looks if a second texture is available. Otherwise it should be set to EMT_SOLID. Solid would probably be fine as S3DVertexTangents is derived from S3DVertex, but S3DVertexTangents and S3DVertex2TCoords are incompatible.
Maybe I'm missing something, but I think we must also figure out which Materialtype to use for the tangent formats or the results should be unpredictable.
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
-
- Posts: 22
- Joined: Mon Nov 15, 2010 9:18 pm
Exactlygriffin2000 wrote:My reading of the code is that its an either-or thing. You can't have 2 UVs and tangents, only one or the other. That is a bit of a pain (it means you can't have lightmaps and normal-maps)
Messing about with loaders right now is pointless because irrlicht is still heavily restrictive about vertex formats.
Its possible to hack in two UV sets into Tangent vertex format (the most flexible of the three which irrlicht supports) but it isn't logical or convenient to modify all the loaders to do it that way
Irrlicht needs flexible vertex formats ASAP
In this case we would use one of the normal-map materials. Which won't hurt and might be useful for some people. And yeah -having both is currently not possible.
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