implement per-stage normalscale#231
Conversation
2996cfb to
3ed2b3a
Compare
ce5466a to
aff530d
Compare
|
This seems ready to me. |
a70f392 to
bcae383
Compare
341255a to
42c5c43
Compare
7797e1f to
2e91742
Compare
|
I added a commit to remove the |
2e91742 to
7fadc70
Compare
|
I noticed I forgot to make the dead liquid shader using |
|
@slipher, I added a small commit I want your advice on. This commit is just done to reduce boilerplate. But it replaces a definition by an affectation, do you think a compiler is able to optimize it, or, if not, this is negligible? If you think it's OK I'll squash it, otherwise I'll drop it. |
|
Removing r_normalScale define seems good. Not sure what you mean about stuff needing to be optimized as you simply removed the extra instructions from GLSL. |
45d8e5b to
0931071
Compare
instead of this in 8 places: vec3_t normalScale = { 1, 1, 1 };
SetNormalScale( pStage, normalScale );I do this in 8 places: vec3_t normalScale;
SetNormalScale( pStage, normalScale );And this in 1 place (in normalScale[ 0 ] = 1;
normalScale[ 1 ] = 1;
normalScale[ 2 ] = 1;The code is more compact this way, and less prone to errors, but in first case the vec3 is defined to 1,1,1, in the second case the vec3 is defined to 0,0,0 then set to 1,1,1. |
1a6b5c7 to
ffd5a9e
Compare
ffd5a9e to
dc1c627
Compare
|
Does anyone have something to say against that? |
…hannels rename the old normalScale expression keyword as normalIntensity
…rmal map no need to hack normalScale with a fourth channel to tell it's customized anymore
dc1c627 to
927b640
Compare
This PR sits above #230.
This is a demonstration of what ca be achieved thanks to #230.
Previously in #180 I introduced a per-material
normalFormatoption that would be able to flip channels. But then I discovered that other engines relies on anormalScaleoption that can both scale (and flip) channels.A proper implementation required to be done on the stage scope.
Note that ioq3 seems to only read
normalScale X Ywhile we are able to readnormalScale X Y Z, if Z is missing, default one is used instead, to keep compatibility with material that may already exists.As an example, we can look at some materials from tex-vega_src.dpkdir that have a flipped X channel.
Before:
After:
They can be easily compared this way:
or with a slider there: https://imgsli.com/OTI4Mw
To do fix them, their materials were edited from this:
to this:
In the process we also moved from separate stages that has to be collapsed by the engine to a multi texture stage that is collapsed from the start.
Also note we inherited from XreaL another
normalScalekeyword that is currently only used by broken liquid shader, and this keyword is expecting an expression. We have to rename it. It is now named normalIntensity, this applies on XY normal map channels and can be computed on every frame by using expressions.It would have been better to keep the
normalScalekeyword for that feature (as existsfresnelScalefor example) and usenormalChannelScalefor the par-channel-scaling-and-flipping variable, butnormalScaleis already widely used by other idtech3 derivated engines, while our liquid shader is used by no one yet, even not by us.