@survivor said:
@nehon: There are only two solutions:
Change handedness in TBG as it was in RC2.
no shader has to change
models with saved tangents stay compatible
you have to dig into TBG, which sounds like pain for you
Change handedness in shaders
pro/con: inverse of 1.
Iād change it, so that models are compatible to ogre or other formats. Donāt know if there is a quasi standard how the tangent buffer should look like.
1 is reverting back to more issues with normal mapping. The TBG is some kind of math hell (or paradise depending of your freakishness level) and last time I kind of managed my way out of it without my eyes bleeding and a fixed issueā¦Iād rather not revert this change
I basically translated from C++ changes made in Ogreās TBG to handle mirrored uvs and distorted tangents. So the base was solid.
2 seems like the way to go ⦠We have a normal.y = -normal.y line commented in and out since a long time fluctuating with the changes to the TBG. Iast time we removed it because thatās one more operation per pixel that can be avoided by reverting the green channel in the normal mapā¦butā¦if you have a large number of assetā¦going through all normal maps and inverting the green channel can be very painfulā¦
So I guess the -normal.y thing is the safest routeā¦
Iād like to hear what @Momoko_Fan, and @pspeed think of this.
So this has nothing to do with parallax mapping and only to do with normal mapping?
I liked the change that fixed the flip problem. It seemed weird to have to do an extra step to every normal map⦠so I didnāt mind regenerating a few of them.
@survivor said:
Ok, the problem is the "handedness" of the tangent which should normally come in "inTangent.w".
Changing line 174 of āLighting.vertā from
[java]
mat3 tbnMat = mat3(wvTangent, wvBinormal * -inTangent.w,wvNormal);
[/java]
to
[java]
mat3 tbnMat = mat3(wvTangent, wvBinormal * inTangent.w, wvNormal);
[/java]
fixes the problem.
The question @devs, @nehon is: Did the handedness change accidentally or by purpose? (TangentBinormalGenerator.java)
Actually, if this is the patch we say is working then this seems like the right one as the -inTangent.w thing always seemed like a hack to me. Like, āWell, TBG seems to be giving us the opposite of what we need so weāll invert it.ā
ā¦I think I removed that minus from my own shaders a long time ago.
@pspeed said:
Actually, if this is the patch we say is working then this seems like the right one as the -inTangent.w thing always seemed like a hack to me. Like, "Well, TBG seems to be giving us the opposite of what we need so we'll invert it."
ā¦I think I removed that minus from my own shaders a long time ago.
Yeah that too :p.
The real fix is to apply survivor change AND to invert the normal y value. So no operation will be needed on normal maps, butā¦weāll have that additional operation once per fragment. Thatās no big deal IMOā¦but still.
@nehon said:
Yeah that too :p.
The real fix is to apply survivor change AND to invert the normal y value. So no operation will be needed on normal maps, but....we'll have that additional operation once per fragment. That's no big deal IMO...but still.
Compared to all of the other stuff⦠I doubt that little multiply will make any difference.