mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-25 09:33:50 +00:00
clamp factor entriely for getXXXLight calcs, and take metalness into account for reducing direct light diffusion imact (while this seems to make it match the tooling, I can't say I've seen this exact approach used, so might want to re-review the methodology)
This commit is contained in:
parent
c0b6007b9f
commit
39574e7fee
2 changed files with 4 additions and 4 deletions
|
|
@ -229,14 +229,14 @@ vec3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight)
|
|||
|
||||
vec3 getDirectionalLight(Surface surface, SurfaceToLight surfaceToLight, vec3 lightColor, float lightIntensity, float shadow)
|
||||
{
|
||||
vec3 factor = lightColor * max(surfaceToLight.NdotL, 0.0f) * shadow * lightIntensity;
|
||||
vec3 factor = lightColor * max(surfaceToLight.NdotL * shadow * lightIntensity*(1.0-surface.metalness), 0.0f);
|
||||
return evaluateStandardBRDF(surface,surfaceToLight) * factor;
|
||||
}
|
||||
|
||||
vec3 getPunctualLight(Surface surface, SurfaceToLight surfaceToLight, vec3 lightColor, float lightIntensity, float radius, float shadow)
|
||||
{
|
||||
float attenuation = getDistanceAtt(surfaceToLight.Lu, radius);
|
||||
vec3 factor = lightColor * max(surfaceToLight.NdotL, 0.0f) * shadow * lightIntensity * attenuation;
|
||||
vec3 factor = lightColor * max(surfaceToLight.NdotL * shadow * lightIntensity * attenuation*(1.0-surface.metalness), 0.0f);
|
||||
return evaluateStandardBRDF(surface,surfaceToLight) * factor;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -230,14 +230,14 @@ float3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight)
|
|||
|
||||
float3 getDirectionalLight(Surface surface, SurfaceToLight surfaceToLight, float3 lightColor, float lightIntensity, float shadow)
|
||||
{
|
||||
float3 factor = lightColor * max(surfaceToLight.NdotL, 0.0f) * shadow * lightIntensity;
|
||||
float3 factor = lightColor * max(surfaceToLight.NdotL* shadow * lightIntensity*(1.0-surface.metalness), 0.0f) ;
|
||||
return evaluateStandardBRDF(surface,surfaceToLight) * factor;
|
||||
}
|
||||
|
||||
float3 getPunctualLight(Surface surface, SurfaceToLight surfaceToLight, float3 lightColor, float lightIntensity, float radius, float shadow)
|
||||
{
|
||||
float attenuation = getDistanceAtt(surfaceToLight.Lu, radius);
|
||||
float3 factor = lightColor * max(surfaceToLight.NdotL, 0.0f) * shadow * lightIntensity * attenuation;
|
||||
float3 factor = lightColor * max(surfaceToLight.NdotL* shadow * lightIntensity * attenuation*(1.0-surface.metalness), 0.0f) ;
|
||||
return evaluateStandardBRDF(surface,surfaceToLight) * factor;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue