The following content is generally based on GLSL 300
Some of the following lines of code are "pseudocode", and most of them are renderDoc reverse engineering to generate standard code.
I have zero foundation in OpenlGL, and I don't plan to learn it all over again.
Table of contents
Clip() remove function discard;
FS final color output out and final color addition equation
Clip() remove function discard;
_21 = texture(_7, _14);
//.................
_26 = _21.w + (-_33._m4);
_29 = _21.xyz * _33._m3.xyz;
_24 = _26 < 0.0;
if (_24)
{
discard;
}
From the discard; command, we can know that it is usually eliminated through transparency, _26 == color.a
_21.w just corresponds to color.a
Obviously: _21 == _color; is the color of v2f
Push it up and learn that _14 == uv
FS module color output out and final color addition equation
#if FS
layout(location = 0) out vec4 _17;
//因为 —17为最终输出,所以通过逆向如下
//关键在于下面的方程式 _125 = XXXXXX + _XX;
main(){
vec3 _125 = (_29 * vec3(_26)) + _28;
_17 = vec4(_125.x, _125.y, _125.z, _17.w);
_17.w = 1.0;//这行代码,不重要
}
For, this equation (find -_125 color)
vec3 _125 = (_29 * vec3(_26)) + _28;
We assume it is diffuse + ambient light (ambient)
So, _28 may be diffuse or ambient
Because the first half of the equation is multiplied by a dot product (dot direction), the first half is likely to be diffuse reflection
Therefore, _28 is inferred as ambient light, because ambient light is not needed
_26 = dot(_27, _19);
_28 = _29 * _33._m1.xyz;// _33.m1 是很奇怪的传入(binding==1)
_29 *= _33._m2.xyz;//虽然_33.m2也很奇怪
References - Extra:
Layout Qualifier (GLSL) - OpenGL Wiki (khronos.org)
opengl - GLSL Uniform layout binding and textures - Stack Overflow
Advanced GLSL - LearnOpenGL-CN
The above links include wikis, technical forum discussions, Chinese forums and other information. They are all rare first-hand information (in fact, they are quite bad. Search online and you will find a lot of them).