Merge branch 'zesterer/glowing-sprites' into 'master'

Added support for glowing sprites

See merge request veloren/veloren!3771
This commit is contained in:
Joshua Barretto 2023-01-19 22:31:30 +00:00
commit 75e07c04f0
5 changed files with 17 additions and 13 deletions

View File

@ -656,12 +656,6 @@ vec3 greedy_extract_col_light_terrain(texture2D t_col_light, sampler s_col_light
return greedy_extract_col_light_attr(t_col_light, s_col_light, f_uv_pos, f_light, f_glow, f_ao, _f_attr, f_sky_exposure);
}
vec3 greedy_extract_col_light_sprite(texture2D t_col_light, sampler s_col_light, vec2 f_uv_pos, out float f_light) {
float _f_sky_exposure, _f_light, _f_glow, _f_ao;
uint _f_attr;
return greedy_extract_col_light_attr(t_col_light, s_col_light, f_uv_pos, f_light, _f_glow, _f_ao, _f_attr, _f_sky_exposure);
}
vec3 greedy_extract_col_light_figure(texture2D t_col_light, sampler s_col_light, vec2 f_uv_pos, out float f_light, out uint f_attr) {
float _f_sky_exposure, _f_light, _f_glow, _f_ao;
return greedy_extract_col_light_attr(t_col_light, s_col_light, f_uv_pos, f_light, _f_glow, _f_ao, f_attr, _f_sky_exposure);

View File

@ -42,7 +42,8 @@ const float FADE_DIST = 32.0;
void main() {
float f_ao;
vec3 f_col = greedy_extract_col_light_sprite(t_col_light, s_col_light, f_uv_pos, f_ao);
uint material = 0xFFu;
vec3 f_col = greedy_extract_col_light_figure(t_col_light, s_col_light, f_uv_pos, f_ao, material);
#ifdef EXPERIMENTAL_BAREMINIMUM
tgt_color = vec4(simple_lighting(f_pos.xyz, f_col, f_ao), 1);
@ -124,6 +125,13 @@ void main() {
reflected_light *= point_shadow;
emitted_light *= point_shadow;
// Apply emissive glow
// For now, just make glowing material light be the same colour as the surface
// TODO: Add a way to control this better outside the shaders
if ((material & (1u << 0u)) > 0u) {
emitted_light += 20 * surf_color;
}
surf_color = illuminate(max_light, view_dir, surf_color * emitted_light, surf_color * reflected_light);
surf_color += f_select * (surf_color + 0.1) * vec3(0.15, 0.15, 0.15);

Binary file not shown.

View File

@ -3468,8 +3468,8 @@ Lantern: Some((
variations: [
(
model: "voxygen.voxel.sprite.lantern.lantern-orange",
offset: (-2.5, -2.5, 0.0),
lod_axes: (0.0, 0.0, 0.0),
offset: (-3.0, -3.0, 0.0),
lod_axes: (0.5, 0.5, 0.2),
),
],
wind_sway: 0.0,

View File

@ -236,8 +236,10 @@ where
|atlas_pos, pos, norm, &meta| create_opaque(atlas_pos, pos, norm, meta),
));
},
make_face_texel: move |flat: &mut _, pos, light, glow, ao| {
TerrainVertex::make_col_light(light, glow, get_color(flat, pos), ao)
make_face_texel: move |flat: &mut _, pos, light, _glow, _ao| {
let cell = flat_get(flat, pos);
let (glowy, shiny) = (cell.is_glowy(), cell.is_shiny());
TerrainVertex::make_col_light_figure(light, glowy, shiny, get_color(flat, pos))
},
});