Made some tweaks
Signed-off-by: Robear Selwans <robear.selwans@outlook.com>
This commit is contained in:
@@ -81,15 +81,12 @@ void main()
|
||||
|
||||
vec3 ambient = vec3(0.2) * albedo;
|
||||
|
||||
vec3 color = ambient + Lo;
|
||||
vec3 color = ambient + Lo;
|
||||
|
||||
color += spec * specFactor;
|
||||
// color = mix(color, spec, specFactor);
|
||||
|
||||
//color = color / (color + vec3(1.0));
|
||||
// float reflectance = max(max(F.x, F.y), F.z);
|
||||
// float reflectance = max(max(F0.x, F0.y), F0.z);
|
||||
// color = color / (color + vec3(1.0));
|
||||
|
||||
outColor = vec4(color, 1.0);
|
||||
// outColor = vec4(vec3(reflectance), 1.0);
|
||||
// outColor = vec4(spec * specFactor, 1.0);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,4 @@ void main()
|
||||
outColor = vec4(rgbA, 1.0);
|
||||
else
|
||||
outColor = vec4(rgbB, 1.0);
|
||||
|
||||
if(uv.x < 0.5)
|
||||
outColor = vec4(rgbM, 1.0);
|
||||
}
|
||||
|
||||
+19
-25
@@ -4,17 +4,7 @@
|
||||
#include "shaders://_builtins/constants.glsl"
|
||||
#include "shaders://_builtins/srgb_ops.glsl"
|
||||
#include "shaders://_builtins/PBR.glsl"
|
||||
|
||||
struct Material {
|
||||
vec4 baseColor;
|
||||
uint albedoTexture;
|
||||
|
||||
uint normalTexture;
|
||||
|
||||
float metallicFactor;
|
||||
float roughnessFactor;
|
||||
uint metallicRoughnessTexture;
|
||||
};
|
||||
#include "shaders://_builtins/types.glsl"
|
||||
|
||||
struct Light {
|
||||
vec3 color;
|
||||
@@ -86,30 +76,34 @@ void main() {
|
||||
if(material.metallicRoughnessTexture == 0) {
|
||||
outSpecular.b = material.metallicFactor;
|
||||
outSpecular.g = material.roughnessFactor;
|
||||
outSpecular.r = 1;
|
||||
outSpecular.r = 1.0;
|
||||
} else {
|
||||
outSpecular = LinearToSRGB(texture(texSampler[material.metallicRoughnessTexture], uv)).xyz;
|
||||
|
||||
float metallicFactor = outSpecular.z;
|
||||
float roughnessFactor = outSpecular.y;
|
||||
// vec3 F0 = mix(vec3(0.04), outColor, (metallicFactor - roughnessFactor));
|
||||
// float reflectance = max(max(F0.x, F0.y), F0.z);
|
||||
// float reflectance = (metallicFactor + roughnessFactor) * 0.5;
|
||||
float reflectance = 1.0 - roughnessFactor;
|
||||
|
||||
gNormal.w = outSpecular.x;
|
||||
gAlbedo.w = roughnessFactor;
|
||||
gPosition.w = metallicFactor;
|
||||
gSpecular.w = reflectance;
|
||||
}
|
||||
|
||||
float metallicFactor = outSpecular.z;
|
||||
float roughnessFactor = outSpecular.y;
|
||||
float ao = outSpecular.x;
|
||||
|
||||
gNormal.w = ao;
|
||||
gAlbedo.w = roughnessFactor;
|
||||
gPosition.w = metallicFactor;
|
||||
|
||||
float reflectance = 1.0 - roughnessFactor;
|
||||
gSpecular.w = reflectance;
|
||||
|
||||
vec3 I = normalize(outpos.xyz - cameraPos);
|
||||
vec3 R = reflect(I, normalize(outNormal));
|
||||
//R = R * -1;
|
||||
outSpecular = texture(skybox, R).rgb;
|
||||
|
||||
if(material.emissiveTexture != 0) {
|
||||
gSpecular.w = 1.0;
|
||||
outSpecular += texture(texSampler[material.emissiveTexture], uv).rgb * material.emissiveFactor.xyz;
|
||||
}
|
||||
|
||||
gPosition = outpos;
|
||||
|
||||
gPosition.xyz = outpos.xyz;
|
||||
gNormal.xyz = outNormal;
|
||||
gAlbedo.xyz = outColor;
|
||||
gSpecular.xyz = outSpecular;
|
||||
|
||||
Reference in New Issue
Block a user