I already explained this. Up in the normal map is not necessarily up in your model.
Imagine if one side of the forehead was at one angle and the other side was at another angle. (Not hard to imagine because your image is exactly that.) Changing the y value in the NORMAL MAP will have really strange results on the MODEL. Because in one case you are pointing your normals at one odd direction and in the other case you are pointing them in a completely different odd direction.
You cannot mess with the normal map values, really, unless you do it consistently.
ok got it, thanks , anyway im glad i think i solved all problems with it. not sure why blender exported different tangent Y direction for second model. maybe 2.8 bug.
Anyway, there are 2 āstandardsā for normal maps: direct x standard and opengl standard. the difference between them is that the green channel is inverted
I guess one would expect that we support the opengl way, but actually we support the directx way because itās what blender supports and we thought itād be easier in blender to JME workflow.
based on this, if default normalType value is ācompatibleā with blender, then it should always work if normalType not defined. But for some reason its not. so need change normalType or re-generate tangents via JME. or its about .gltf exporter.
normalType will not fix tangents. Tangents will not fix normal type. These are two completely different things.
Tangents tell us the orientation of the normalmap image relative to the model. Normal type tells us which way to interpret the green channel. The only cases where these two things will even remotely align are when your tangents are EXACTLY (1, 0, 0).
ānormalType not definedā can mean 100 different thingsā¦ only ONE of which is āit was never set by anythingā. Iām not convinced that you have confirmed thatā¦ or at least I have not seen a runtime dump of the actual material parameters used at runtime to render the model at runtime.
99 things along the way could have set normal type.
normalType will not fix tangents. Tangents will not fix normal type. These are two completely different things.
Tangents tell us the orientation of the normalmap image relative to the model. Normal type tells us which way to interpret the green channel. The only cases where these two things will even remotely align are when your tangents are EXACTLY (1, 0, 0).
then im really not sure why both models were working with opposite normalTypes when tangents were generated via .gltf exporter (-1 for first and 1 for second) .
and when i generated Tangents via SDK, it suddently work for both models with normalType -1 (and also undefined normalType too)
maybe like you said āalign are when your tangents are EXACTLY (1, 0, 0).ā condition was met
ānormalType not definedā can mean 100 different thingsā¦ only ONE of which is āit was never set by anythingā. Iām not convinced that you have confirmed thatā¦ or at least I have not seen a runtime dump of the actual material parameters used at runtime to render the model at runtime.
99 things along the way could have set normal type.
not sure if i understand correctly.
i were changing normalType dynamically in SDK and see efect on model immidietly. correct, if i removed param from material, i needed to re-open model to see change. i dont think SDK lie somewhere, runtime parameters i think cant be changed via SDK not via material.
Yeah, Iām not sitting in front of your computer so I do not know all of the different variables. I can only keep repeating (over and over) the facts about how it actually works in the renderer.
Letās say you have a cube and youāve unrolled it in such a way that the UVās look like this:
Flipping the y value of the normal map to an incorrect value will look ok for at least one side but totally bonkers (in completely different ways) for the other sides.
The tangents are telling us where the bases of each of those sides are.
Conceptually:
(Itās actually the inverse of this because the texture already knows what itās ābaseā isā¦ the tangents are telling where the REAL texture base is in 3D spaceā¦ but think of it like if you wanted to project the visual 3D base back into texture space for that image.)
I can only tell you that this is definitely 100% how it works. I canāt tell you why your asset pipeline is giving you different results that you havenāt figured out the variables for. It could be a bunch of different things (one model still has mirror modifier, the other has it applied, etcā¦ too many things to guess.)
It seems like if the upper left corner is the UV map then there is no issue because tangents will align perfectly with the base of the texture.
Base of texture: the bottom of the texture. t = 0 (v=0),ā¦ the base. The texture base. Not sure how else to say the bottom line of the texture.
The tangent vector shows us which direction the bottom line, v=0, of the texture is in 3D space relative to some vertex.
If you think of my example where the base of the sides is the line that adjoins the BOTTOM of the cube, then you can imagine that the tangent vectors point in very different directions for each vertex.
normalType ONLY DEALS WITH HOW TO INTERPRET THE GREEN CHANNEL. Effectively, this means the y of the normalmap normalā¦ which as shown can point in entirely different directions on the model itself.
so what tangent do, is just telling what is BASE(bottom line of the texture - vector of it) of each face(because each face have some UV coord) in current point of view of model.
so now i also dont know how tangents would help for this normalType issueā¦ but it doā¦ its oddā¦
but anyway one question. why some materials(like unshaded) still work without generating tangents? i understand generator make binormals(needed for normalmaps) or however name it, this is something more than just telling base of texture as i understand.
You only need tangents for normal maps and height maps so you know which direction āawayā isā¦ ie: which direction to project the surface.
Normal maps and height maps = lighting. If you donāt have lighting then you donāt have normal maps and height maps.
Unshaded = no lighting = no normal maps or height maps = no tangents.
The binormal is the third axis of the TBN space (second axis in order of tangent, binormal, normal). Tangent points along the base of the texture (v=0) binormal points along the side of the texture (u=0) and normal points āoutā.
Just like the normal can curve across the surface, so must the tangent and binormal. So each fragment has its own local interpolated TBN letting it know which direction that normal map (or height map) vector actually points. ie: TBN turns normap map x,y,z into 3D x,y,z.
we have binormal direction from tangent of current pixel(im not sure what pass tangents further).
so each pixel it check binormal direction, and the more it match colors(RGB - depend on vector direction) the more lit pixel.
so when in my example i have seam in middle and same line go from left to up in texture and in second it go left to down in texture, so tangent binormal say right-up is direction of āholeā down side for (right one on screenshot) and it say left-up for second(left on screenshot)
now sure how normalType just flip Y. if i think correct that is not from vector, but matrix (xyzw) so its not always predictible.
btw. looking at my models now, any direction of view and light seems correct.
And in that picture, if you set the normalType backwards then you are effectively telling rendering that the binormals are upside down. You can see how if the normals were not generated with that in mind that it would create a seam down the middle. They will be pointing in strange opposite directions now.