foliage uses new lighting flow
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
This commit is contained in:
parent
0c15941efa
commit
1c7dfd26cf
@ -5,6 +5,13 @@
|
|||||||
|
|
||||||
//foliage.fs
|
//foliage.fs
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transparency of the foliage
|
||||||
|
*/
|
||||||
|
#define FOLIAGE_TRANSPARENCY 1.0
|
||||||
|
|
||||||
|
|
||||||
in vec3 FragPos;
|
in vec3 FragPos;
|
||||||
in vec3 ViewFragPos;
|
in vec3 ViewFragPos;
|
||||||
in vec3 Normal;
|
in vec3 Normal;
|
||||||
@ -58,38 +65,23 @@ void main(){
|
|||||||
//grab light intensity
|
//grab light intensity
|
||||||
vec3 lightIntensity = vec3(calcLightIntensityTotal(norm));
|
vec3 lightIntensity = vec3(calcLightIntensityTotal(norm));
|
||||||
|
|
||||||
//get color of base texture
|
// Calculate the light to apply
|
||||||
// vec3 textureColor = vec3((norm.x + 1) / 2.0, norm.y, 1.0 - (norm.x + 1) / 2.0);
|
vec3 light = getTotalLight(
|
||||||
// vec3 textureColor = vec3(TexCoord,1.0);
|
material,
|
||||||
// vec3 textureColor = vec3(0.17647,0.4,0.09411);//texture(material.diffuse, TexCoord).rgb;
|
textureColor,
|
||||||
|
vec3(viewPos.xyz),
|
||||||
//shadow
|
FragPosLightSpace,
|
||||||
float shadow = ShadowCalculation(FragPosLightSpace, normalize(-directLight.direction.xyz), norm);
|
ViewFragPos,
|
||||||
|
FragPos,
|
||||||
//
|
norm,
|
||||||
//point light calculations
|
viewDir
|
||||||
uint clusterIndex = findCluster(ViewFragPos, zNear, zFar);
|
);
|
||||||
uint pointLightCount = clusters[clusterIndex].count;
|
|
||||||
for(int i = 0; i < pointLightCount; i++){
|
|
||||||
uint pointLightIndex = clusters[clusterIndex].lightIndices[i];
|
|
||||||
PointLight pointLight = pointLight[pointLightIndex];
|
|
||||||
lightIntensity = lightIntensity + CalcPointLight(pointLight, norm, FragPos, viewDir);
|
|
||||||
}
|
|
||||||
//error checking on light clusters
|
|
||||||
if(pointLightCount > MAX_LIGHTS_PER_CLUSTER){
|
|
||||||
FragColor = vec4(1.0f,0.0f,0.0f,1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//calculate final color
|
//calculate final color
|
||||||
vec3 finalColor = textureColor * lightIntensity;// * max(shadow,0.4);
|
vec3 finalColor = light;
|
||||||
// vec3 lightAmount = CalcDirLight(norm, viewDir);
|
|
||||||
// for(int i = 0; i < NR_POINT_LIGHTS; i++){
|
|
||||||
// lightAmount += CalcPointLight(i, norm, FragPos, viewDir);
|
|
||||||
// }
|
|
||||||
|
|
||||||
//this final calculation is for transparency
|
//this final calculation is for transparency
|
||||||
FragColor = vec4(finalColor, 1.0);//texture(ourTexture, TexCoord);//vec4(result, 1.0);
|
FragColor = vec4(finalColor, FOLIAGE_TRANSPARENCY);
|
||||||
}
|
}
|
||||||
|
|
||||||
float easeIn(float interpolator){
|
float easeIn(float interpolator){
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user