[2.1] Reports no tangents, even if I had it create them

Problems building or running the engine, queries about how to use features etc.
Post Reply
Dugi
Halfling
Posts: 46
Joined: Tue Jul 23, 2013 2:37 pm
x 7

[2.1] Reports no tangents, even if I had it create them

Post by Dugi »

I have come to a weird problem. When I try to create a normal mapped item, it says something like this:

Code: Select all

Couldn't apply datablock '[Hash 0xblablabla]' to this renderable. Using default one. Check previous log messages to see if there's more information.
OGRE EXCEPTION(1:InvalidStateException): Renderable can't use normal maps but datablock wants normal maps. Generate Tangents for this mesh to fix the problem or use a datablock without normal maps. in HlmsPbs::calculateHashForPreCreate at /home/dugi/Downloads/ogre-2.1/Components/Hlms/Pbs/src/OgreHlmsPbs.cpp (line 533)
The strange thing is that I have generated these tangents. I have made OgreMeshTool generate tangents by switching it to a v1 mesh and then making a v2 mesh with tangents from it, it even printed this line:

Code: Select all

Generating tangent vectors....success
Saving as a v2 mesh...
Command line arguments I have used were -V 2.1 -v2 -t. When I exported it to xml (with the same arguments), the vertices in result had normals.

Any ideas what is behind this?
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [2.1] Reports no tangents, even if I had it create them

Post by dark_sylinc »

Does the mesh have UVs? (they're needed) If not, there's a bug as it shouldn't say "success" (obviously).

If it does, could you send me the mesh to see what's going on?
Dugi
Halfling
Posts: 46
Joined: Tue Jul 23, 2013 2:37 pm
x 7

Re: [2.1] Reports no tangents, even if I had it create them

Post by Dugi »

They do have UVs. They used to work on 1.9 before I did some OgreMeshTool changes on them.

Here is an example of such a mesh.
Attachments
castle_hall_floor.mesh.zip
Tried to find the smallest one, the forums didn't allow me to upload a mesh file
(953 Bytes) Downloaded 37 times
zxz
Gremlin
Posts: 184
Joined: Sat Apr 16, 2016 9:25 pm
x 19

Re: [2.1] Reports no tangents, even if I had it create them

Post by zxz »

I am having the same issue.

I used:

Code: Select all

1. OgreMeshTool -v1 foo.mesh
2. OgreMeshTool -t foo.mesh
3. OgreMeshTool -v2 foo.mesh
After this procedure, Ogre still doesn't find tangents in the mesh. The mesh does have UV coords and reports success in generating tangents in step 2.

Code: Select all

OGRE EXCEPTION(1:InvalidStateException): Renderable can't use normal maps but datablock wants normal maps. Generate Tangents for this mesh to fix the problem or use a datablock without normal maps. in HlmsPbs::calculateHashForPreCreate at /tmp/og21/ogressao/Components/Hlms/Pbs/src/OgreHlmsPbs.cpp (line 533)
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: [2.1] Reports no tangents, even if I had it create them

Post by dark_sylinc »

Fixed.

A bug caused v1 mesh to v2 conversion to lose its tangents & binormals if QTangents weren't enabled. Thanks.

Btw consider using "-o puqs" for smaller, optimized vertices. If the loss of precision is unacceptable, "-o q" will still convert normal tangents & bitangents into a QTangent while still leaving full 32-bit precision for the position and UVs. In my experience QTangent has always been a win so far (unless you need to process the vertices in software via C and your code already expects normals & tangents).

Cheers
Matias.
Dugi
Halfling
Posts: 46
Joined: Tue Jul 23, 2013 2:37 pm
x 7

Re: [2.1] Reports no tangents, even if I had it create them

Post by Dugi »

Thank you.

I have applied the patch, applied it to all files and it appears to work. No more exceptions, but I cannot verify properly if it works - my program does not yet have lighting ported properly, so the effect of normal maps cannot be seen.
Post Reply