Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #version 450
- layout(set = 0, binding = 0, std140) uniform _9_12
- {
- uint _m0;
- uint _m1[8];
- vec4 _m2;
- int _m3;
- float _m4[73];
- } _12;
- layout(set = 0, binding = 20, std140) uniform fp_c1
- {
- vec4 _m0[4096];
- } fp_c1_1;
- layout(set = 0, binding = 23, std140) uniform fp_c4
- {
- vec4 _m0[4096];
- } fp_c4_1;
- layout(set = 2, binding = 128) uniform sampler2D albedo;
- layout(set = 2, binding = 129) uniform sampler2D normals;
- layout(set = 2, binding = 130) uniform sampler2D packed_tex;
- layout(location = 0) in vec3 _36;
- layout(location = 1) in vec3 _38;
- layout(location = 2) in vec3 _44;
- layout(location = 3) in vec2 texcoord;
- layout(location = 4) in vec3 scale;
- layout(location = 5) in vec4 _42;
- layout(location = 6) in vec4 _40;
- layout(location = 0) out vec4 outDiffuse;
- layout(location = 1) out vec4 outSpecSmooth;
- layout(location = 2) out vec4 outNormals;
- layout(location = 3) out vec4 outMotion;
- layout(location = 4) out vec4 outDepth;
- void main()
- {
- //load textures
- vec2 packed_GB = texture(packed_tex, vec2(texcoord.x, texcoord.y)).yz;
- vec3 alb = texture(albedo, vec2(texcoord.x, texcoord.y)).xyz;
- vec3 norm = texture(normals, vec2(texcoord.x, texcoord.y)).xyz;
- float _216 = _40.x * (1.0 / _40.w);
- float _218 = _40.y * (1.0 / _40.w);
- float _268 = fma(1.0 / _42.w, _42.y, -_218);
- float _276 = fma(1.0 / _42.w, _42.x, -_216);
- float _268 = fma(1.0 / _42.w, _42.y, -_218);
- float _276 = fma(1.0 / _42.w, _42.x, -_216);
- //Normalize light
- vec3 nrm_1 = normalize(_36);
- vec3 nrm_2 = normalize(_38);
- vec3 nrm_3 = normalize(_44);
- //Convert from [0,1] to [-1,1] ?
- float norm_R = fma(norm.x, 2.0, -1.0);
- float norm_G = fma(norm.y, 2.0, -1.0);
- float norm_B = fma(norm.z, 2.0, -1.0);
- vec3 nrm_4 = normalize((norm_R * nrm_2) + (norm_G * nrm_3) + (norm_B * nrm_1));
- float _340 = max(max(abs(_276 * 0.5), abs(_268 * 0.5)), 1.0);
- float _362 = (_268 * 0.5) * (1.0 / _340);
- float _364 = (_276 * 0.5) * (1.0 / _340);
- float _376 = float(_362 >= 0.0);
- float _388 = float(_364 >= 0.0);
- float _384 = floor(_42.z * 8.0);
- //G-Buffer
- outDiffuse = vec4(alb * scale, 0.0);
- outSpecSmooth.x = fp_c4_1._m0[0].x;
- outSpecSmooth.y = packed_GB.x; //G
- outSpecSmooth.z = 0.0;
- outSpecSmooth.w = 0.0043137255124747753143310546875;
- outNormals.x = fma(nrm_4.x, 0.5, 0.5);
- outNormals.y = fma(nrm_4.y, 0.5, 0.5);
- outNormals.z = packed_GB.y * max(scaleB, max(scaleR, scaleG)); //find the max scale of all channels and use that to scale B
- outNormals.w = fma(nrm_4.z, 1000.0, 0.5);
- outMotion.x = 1.0 / inversesqrt(abs(_364));
- outMotion.y = 1.0 / inversesqrt(abs(_362));
- outMotion.z = 0.0;
- outMotion.w = fma(_388, fp_c1_1._m0[0].x, _376 * 0.666666686534881591796875) + 0.00999999977648258209228515625;
- outDepth.x = (_42.z * 8.0) - _384;
- outDepth.y = (_384 / 255) - floor(_384 / 255);
- outDepth.z = floor(_384 / 255) / 255;
- outDepth.w = 0.0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement