SL-17702: PBR: Add PBR materials to point light shaders

meow-7.2.2
Ptolemy 2022-07-15 17:31:25 -07:00
parent 314f27d1b1
commit 35a97efcb7
2 changed files with 21 additions and 3 deletions

View File

@ -88,6 +88,24 @@ void main()
vec3 colorEmissive = spec.rgb; // PBR sRGB Emissive. See: pbropaqueF.glsl
vec3 packedORM = texture2DRect(emissiveRect, tc).rgb; // PBR linear packed Occlusion, Roughness, Metal. See: pbropaqueF.glsl
vec3 c_diff, reflect0, reflect90;
float alphaRough, specWeight;
initMaterial( diffuse, packedORM, alphaRough, c_diff, reflect0, reflect90, specWeight );
for (int light_idx = 0; light_idx < LIGHT_COUNT; ++light_idx)
{
vec3 lightColor = light_col[ light_idx ].rgb;
float lightSize = light [ light_idx ].w;
vec3 lv =(light [ light_idx ].xyz - pos);
calcHalfVectors(lv, n, v, h, l, nh, nl, nv, vh, lightDist);
if (nl > 0.0 || nv > 0.0)
{
vec3 intensity = getLightIntensityPoint(lightColor, lightSize, lightDist);
colorDiffuse += intensity * nl * BRDFLambertian (reflect0, reflect90, c_diff , specWeight, vh);
colorSpec += intensity * nl * BRDFSpecularGGX(reflect0, reflect90, alphaRough, specWeight, vh, nl, nv, nh);
}
}
final_color = colorDiffuse + colorSpec;
}
else

View File

@ -99,9 +99,9 @@ void main()
if (nl > 0.0 || nv > 0.0)
{
vec3 intensity = size * color;
colorDiffuse += intensity * nl * BRDFLambertian ( reflect0, reflect90, c_diff , specWeight, vh );
colorSpec += intensity * nl * BRDFSpecularGGX( reflect0, reflect90, alphaRough, specWeight, vh, nl, nv, nh );
vec3 intensity = getLightIntensityPoint(color, size, lightDist);
colorDiffuse += intensity * nl * BRDFLambertian (reflect0, reflect90, c_diff , specWeight, vh);
colorSpec += intensity * nl * BRDFSpecularGGX(reflect0, reflect90, alphaRough, specWeight, vh, nl, nv, nh);
}
final_color = colorDiffuse + colorSpec;