mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-22 22:00:54 +00:00
Merge pull request #379 from Azaezel/alpha40_lightreview
light review (hdr and metalness vs direct lighting)
This commit is contained in:
commit
d8e82d1ba6
4 changed files with 12 additions and 12 deletions
|
|
@ -61,5 +61,5 @@ void main()
|
|||
average = vec4( 0.0f, 0.0f, 0.0f, 1.0f );
|
||||
|
||||
// Write the colour to the bright-pass render target
|
||||
OUT_col = hdrEncode( average );
|
||||
OUT_col = hdrEncode( saturate(average) );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,5 +58,5 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
|
|||
average = float4( 0.0f, 0.0f, 0.0f, 1.0f );
|
||||
|
||||
// Write the colour to the bright-pass render target
|
||||
return hdrEncode( average );
|
||||
return hdrEncode( saturate(average) );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -231,24 +231,24 @@ vec3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight)
|
|||
float D = D_GGX(surfaceToLight.NdotH, surface.linearRoughnessSq);
|
||||
vec3 Fr = D * F * Vis;
|
||||
|
||||
#if (CAPTURING == 1)
|
||||
return mix(Fd + Fr,surface.f0,surface.metalness);
|
||||
#ifdef CAPTURING
|
||||
return saturate(mix(Fd + Fr,surface.f0,surface.metalness));
|
||||
#else
|
||||
return Fd + Fr;
|
||||
return saturate(Fd + Fr);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -232,24 +232,24 @@ float3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight)
|
|||
float D = D_GGX(surfaceToLight.NdotH, surface.linearRoughnessSq);
|
||||
float3 Fr = D * F * Vis;
|
||||
|
||||
#if CAPTURING == true
|
||||
return lerp(Fd + Fr,surface.f0,surface.metalness);
|
||||
#ifdef CAPTURING
|
||||
return saturate(lerp(Fd + Fr,surface.f0,surface.metalness));
|
||||
#else
|
||||
return Fd + Fr;
|
||||
return saturate(Fd + Fr);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
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