Shader updates
This commit is contained in:
parent
b0d08d27fd
commit
eb569a4263
|
@ -57,25 +57,34 @@ void main()
|
||||||
// normal of fragment
|
// normal of fragment
|
||||||
vec3 normalView = imageLoad(normals, globalThread).rgb;
|
vec3 normalView = imageLoad(normals, globalThread).rgb;
|
||||||
|
|
||||||
|
// light layer index
|
||||||
|
uint lightLayer = imageLoad (lightLayerData, globalThread).r;
|
||||||
|
|
||||||
vec3 fragColor = vec3 (0.0f);
|
vec3 fragColor = vec3 (0.0f);
|
||||||
|
|
||||||
for (int i = 0; i < lightCounts.directionalLights; ++i)
|
for (int i = 0; i < lightCounts.directionalLights; ++i)
|
||||||
{
|
{
|
||||||
// get normalized direction of light
|
if ((lightLayer & DirLightData.dLightData[i].cullingMask) != 0)
|
||||||
vec3 dLightNormalized = normalize (DirLightData.dLightData[i].direction);
|
{
|
||||||
|
// get normalized direction of light
|
||||||
|
vec3 dLightNormalized = normalize (DirLightData.dLightData[i].direction);
|
||||||
|
|
||||||
// Get diffuse strength
|
// Get diffuse strength
|
||||||
float diffuseStrength = max (0, dot (dLightNormalized, normalView));
|
float diffuseStrength = max (0, dot (dLightNormalized, normalView));
|
||||||
|
|
||||||
// Calculate the fragment color
|
// Calculate the fragment color
|
||||||
fragColor += DirLightData.dLightData[i].diffuseColor.rgb * diffuseStrength.rrr * pixelDiffuse;
|
fragColor += DirLightData.dLightData[i].diffuseColor.rgb * diffuseStrength.rrr * pixelDiffuse;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < lightCounts.ambientLights; ++i)
|
for (int i = 0; i < lightCounts.ambientLights; ++i)
|
||||||
{
|
{
|
||||||
// Just do some add
|
if ((lightLayer & AmbLightData.aLightData[i].cullingMask) != 0)
|
||||||
//fragColor += pixelDiffuse.rgb * AmbLightData.aLightData[i].ambientColor.rgb * vec3 (0.5f);
|
{
|
||||||
fragColor += pixelDiffuse.rgb * AmbLightData.aLightData[i].ambientColor.rgb * vec3 (AmbLightData.aLightData[i].strength);
|
// Just do some add
|
||||||
|
//fragColor += pixelDiffuse.rgb * AmbLightData.aLightData[i].ambientColor.rgb * vec3 (0.5f);
|
||||||
|
fragColor += pixelDiffuse.rgb * AmbLightData.aLightData[i].ambientColor.rgb * vec3 (AmbLightData.aLightData[i].strength);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float ssaoVal = imageLoad (ssaoBlurredImage, globalThread).r;
|
float ssaoVal = imageLoad (ssaoBlurredImage, globalThread).r;
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue