mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-22 10:29:47 +00:00
feat: entity translucent pass & test layered transparency pipeline
This commit is contained in:
parent
e7f030f226
commit
7522016e84
19 changed files with 484 additions and 111 deletions
|
|
@ -1,13 +1,12 @@
|
|||
#include <shadows>
|
||||
#include <deferred_light>
|
||||
#include <fog>
|
||||
|
||||
#define CLOUDS_FOG_FACTOR_MUL 0.3f
|
||||
#define CLOUDS_FOG_CURVE_MUL 0.4f
|
||||
#define COLOR_TEMPERATURE_COMPENSATION 1.14f
|
||||
|
||||
vec4 effect() {
|
||||
vec4 pos = texture(u_position, v_uv);
|
||||
float light = 1.0;
|
||||
float ao = 1.0;
|
||||
|
||||
#ifdef ENABLE_SSAO
|
||||
vec2 texel = 2.0 / u_screenSize;
|
||||
|
|
@ -23,7 +22,7 @@ vec4 effect() {
|
|||
wsum += w;
|
||||
}
|
||||
}
|
||||
light = sum / wsum;
|
||||
ao = sum / wsum;
|
||||
#endif // ENABLE_SSAO
|
||||
|
||||
vec4 modelpos = u_inverseView * pos;
|
||||
|
|
@ -31,18 +30,7 @@ vec4 effect() {
|
|||
vec3 dir = modelpos.xyz - u_cameraPos;
|
||||
|
||||
float emission = texture(u_emission, v_uv).r;
|
||||
|
||||
float rg = 1.0;
|
||||
#ifdef ENABLE_SHADOWS
|
||||
float shadow_mul = calc_shadow(modelpos, normal, length(pos));
|
||||
light *= shadow_mul;
|
||||
rg *= min(1.0, shadow_mul + emission) * COLOR_TEMPERATURE_COMPENSATION;
|
||||
light *= 2.0;
|
||||
#endif
|
||||
|
||||
light = max(light, emission);
|
||||
|
||||
light = pow(light, u_gamma);
|
||||
vec3 light = calc_deferred_light(modelpos, normal, length(pos), emission, ao);
|
||||
|
||||
vec3 fogColor = texture(u_skybox, dir).rgb;
|
||||
float fog = calc_fog(
|
||||
|
|
@ -50,5 +38,5 @@ vec4 effect() {
|
|||
mix(1.0, CLOUDS_FOG_FACTOR_MUL, emission),
|
||||
mix(1.0, CLOUDS_FOG_CURVE_MUL, emission)
|
||||
);
|
||||
return vec4(mix(texture(u_screen, v_uv).rgb * mix(1.0, light, 1.0) * vec3(rg, 0.5 + rg * 0.5, 1.0), fogColor, fog), 1.0);
|
||||
return vec4(mix(texture(u_screen, v_uv).rgb * light, fogColor, fog), 1.0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue