Made some tweaks
Signed-off-by: Robear Selwans <robear.selwans@outlook.com>
This commit is contained in:
@@ -84,12 +84,9 @@ void main()
|
||||
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);
|
||||
}
|
||||
|
||||
+13
-19
@@ -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;
|
||||
float ao = outSpecular.x;
|
||||
|
||||
gNormal.w = 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;
|
||||
|
||||
@@ -49,5 +49,5 @@
|
||||
"path": "scenes://Car.evsc"
|
||||
}
|
||||
],
|
||||
"activeScene": "Car"
|
||||
"activeScene": "DamagedHelmetScene"
|
||||
}
|
||||
|
||||
+3146
-66
File diff suppressed because one or more lines are too long
@@ -34,21 +34,9 @@
|
||||
{
|
||||
"components": [
|
||||
{
|
||||
"position": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"rotation": [
|
||||
-180,
|
||||
180,
|
||||
0
|
||||
],
|
||||
"scale": [
|
||||
1,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"position": [ 0, 0, 0 ],
|
||||
"rotation": [ -180, 0, 0 ],
|
||||
"scale": [ 1, 1, 1 ],
|
||||
"type": "TransformComponent"
|
||||
},
|
||||
{
|
||||
@@ -99,9 +87,9 @@
|
||||
},
|
||||
{
|
||||
"color": [1.0, 1.0, 1.0, 1.0],
|
||||
"intensity": 200,
|
||||
"intensity": 20,
|
||||
"type": "LightComponent"
|
||||
},
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -119,9 +107,9 @@
|
||||
},
|
||||
{
|
||||
"color": [1.0, 1.0, 1.0, 1.0],
|
||||
"intensity": 200,
|
||||
"intensity": 20,
|
||||
"type": "LightComponent"
|
||||
},
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -139,9 +127,9 @@
|
||||
},
|
||||
{
|
||||
"color": [1.0, 1.0, 1.0, 1.0],
|
||||
"intensity": 200,
|
||||
"intensity": 20,
|
||||
"type": "LightComponent"
|
||||
},
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user