mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-13 06:51:51 +00:00
feat: deferred shading (day 2)
This commit is contained in:
parent
a585b52aa2
commit
0bd901d1a6
23 changed files with 236 additions and 92 deletions
|
|
@ -1,12 +1,6 @@
|
|||
#ifndef LIGHTING_GLSL_
|
||||
#define LIGHTING_GLSL_
|
||||
|
||||
uniform float u_fogFactor;
|
||||
uniform float u_fogCurve;
|
||||
uniform float u_weatherFogOpacity;
|
||||
uniform float u_weatherFogDencity;
|
||||
uniform float u_weatherFogCurve;
|
||||
|
||||
float calc_torch_light(vec3 normal, vec3 modelpos) {
|
||||
return max(0.0, 1.0 - distance(u_cameraPos, modelpos) / u_torchlightDistance)
|
||||
* max(0.0, -dot(normal, normalize(modelpos - u_cameraPos)));
|
||||
|
|
@ -16,13 +10,4 @@ vec3 calc_screen_normal(vec3 normal) {
|
|||
return transpose(inverse(mat3(u_view * u_model))) * normal;
|
||||
}
|
||||
|
||||
float calc_fog(float depth) {
|
||||
return min(
|
||||
1.0,
|
||||
max(pow(depth * u_fogFactor, u_fogCurve),
|
||||
min(pow(depth * u_weatherFogDencity, u_weatherFogCurve),
|
||||
u_weatherFogOpacity))
|
||||
);
|
||||
}
|
||||
|
||||
#endif // LIGHTING_GLSL_
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue