|
@@ -143,16 +143,16 @@ fun sh_irradiance(nor: float3): float3 {
|
|
|
var cl21: float3 = float3(constants.shirr5.y, constants.shirr5.z, constants.shirr5.w);
|
|
|
var cl22: float3 = float3(constants.shirr6.x, constants.shirr6.y, constants.shirr6.z);
|
|
|
return (
|
|
|
- c1 * cl22 * (nor.y * nor.y - (-nor.z) * (-nor.z)) +
|
|
|
- c3 * cl20 * nor.x * nor.x +
|
|
|
- c4 * cl00 -
|
|
|
- c5 * cl20 +
|
|
|
- 2.0 * c1 * cl2m2 * nor.y * (-nor.z) +
|
|
|
- 2.0 * c1 * cl21 * nor.y * nor.x +
|
|
|
- 2.0 * c1 * cl2m1 * (-nor.z) * nor.x +
|
|
|
- 2.0 * c2 * cl11 * nor.y +
|
|
|
- 2.0 * c2 * cl1m1 * (-nor.z) +
|
|
|
- 2.0 * c2 * cl10 * nor.x
|
|
|
+ cl22 * c1 * (nor.y * nor.y - (-nor.z) * (-nor.z)) +
|
|
|
+ cl20 * c3 * nor.x * nor.x +
|
|
|
+ cl00 * c4 -
|
|
|
+ cl20 * c5 +
|
|
|
+ cl2m2 * 2.0 * c1 * nor.y * (-nor.z) +
|
|
|
+ cl21 * 2.0 * c1 * nor.y * nor.x +
|
|
|
+ cl2m1 * 2.0 * c1 * (-nor.z) * nor.x +
|
|
|
+ cl11 * 2.0 * c2 * nor.y +
|
|
|
+ cl1m1 * 2.0 * c2 * (-nor.z) +
|
|
|
+ cl10 * 2.0 * c2 * nor.x
|
|
|
);
|
|
|
}
|
|
|
|
|
@@ -208,7 +208,8 @@ fun deferred_light_frag(input: vert_out): float4 {
|
|
|
n.z
|
|
|
)
|
|
|
);
|
|
|
- envl /= PI;
|
|
|
+ // envl /= PI;
|
|
|
+ envl = envl / PI;
|
|
|
|
|
|
var reflection_world: float3 = reflect(-v, n);
|
|
|
var lod: float = mip_from_roughness(roughness, float(constants.envmap_num_mipmaps));
|
|
@@ -217,16 +218,20 @@ fun deferred_light_frag(input: vert_out): float4 {
|
|
|
envl.rgb = envl.rgb * albedo;
|
|
|
// Indirect specular
|
|
|
// var env_brdf: float2 = senvmap_brdf[uint2(roughness * 256.0, (1.0 - dotnv) * 256.0)].xy;
|
|
|
- var env_brdf: float4 = senvmap_brdf[uint2(roughness * 256.0, (1.0 - dotnv) * 256.0)];
|
|
|
- envl.rgb += prefiltered_color * (f0 * env_brdf.x + env_brdf.y) * 1.5;
|
|
|
+ var env_brdf: float4 = senvmap_brdf[uint2(uint(roughness * 256.0), uint((1.0 - dotnv) * 256.0))];
|
|
|
+
|
|
|
+ //envl.rgb += prefiltered_color * (f0 * env_brdf.x + env_brdf.y) * 1.5;
|
|
|
+ envl.rgb = envl.rgb + (prefiltered_color * (f0 * env_brdf.x + env_brdf.y) * 1.5);
|
|
|
envl.rgb *= constants.envmap_data.w * occ;
|
|
|
|
|
|
var color: float4;
|
|
|
- color.rgb = envl;
|
|
|
+ color.rgb = envl.rgb;
|
|
|
color.rgb = color.rgb * sample_lod(ssaotex, sampler_linear, input.tex, 0.0).r;
|
|
|
|
|
|
- if (matid == uint(1)) { // Emission
|
|
|
- color.rgb += g1.rgb; // materialid
|
|
|
+ // if (matid == uint(1)) { // Emission
|
|
|
+ if (matid == uint(1.0)) { // Emission
|
|
|
+ //color.rgb += g1.rgb; // materialid
|
|
|
+ color.rgb = color.rgb + g1.rgb; // materialid
|
|
|
albedo = float3(0.0, 0.0, 0.0);
|
|
|
}
|
|
|
|