Upped default LoD distance

This commit is contained in:
Joshua Barretto 2022-05-10 17:12:12 +01:00
parent c7e51a6c59
commit 7382aab13a
5 changed files with 3 additions and 25 deletions

View File

@ -104,38 +104,23 @@ void main() {
vec3 emitted_light, reflected_light; vec3 emitted_light, reflected_light;
// This is a bit of a hack. Because we can't find the volumetric lighting of each particle (they don't talk to the
// CPU) we need to some how find an approximation of how much the sun is blocked. We do this by fading out the sun
// as the particle moves underground. This isn't perfect, but it does at least mean that particles don't look like
// they're exposed to the sun when in dungeons
const float SUN_FADEOUT_DIST = 20.0;
sun_info.block *= clamp((f_pos.z - f_alt) / SUN_FADEOUT_DIST + 1, 0, 1);
// To account for prior saturation. // To account for prior saturation.
float max_light = 0.0; float max_light = 0.0;
vec3 cam_attenuation = vec3(1); vec3 cam_attenuation = vec3(1);
float fluid_alt = max(f_pos.z + 1, floor(f_alt + 1)); float fluid_alt = max(f_pos.z + 1, floor(f_alt + 1));
vec3 mu = medium.x == MEDIUM_WATER ? MU_WATER : vec3(0.0); vec3 mu = medium.x == MEDIUM_WATER ? MU_WATER : vec3(0.0);
//#if (FLUID_MODE == FLUID_MODE_SHINY)
// cam_attenuation =
// medium.x == MEDIUM_WATER ? compute_attenuation_point(cam_pos.xyz, view_dir, MU_WATER, fluid_alt, /*cam_pos.z <= fluid_alt ? cam_pos.xyz : f_pos*/f_pos)
// : compute_attenuation_point(f_pos, -view_dir, vec3(0), fluid_alt, /*cam_pos.z <= fluid_alt ? cam_pos.xyz : f_pos*/cam_pos.xyz);
//#endif
max_light += get_sun_diffuse2(sun_info, moon_info, voxel_norm, view_dir, f_pos, mu, cam_attenuation, fluid_alt, k_a, k_d, k_s, alpha, voxel_norm, 1.0, emitted_light, reflected_light); max_light += get_sun_diffuse2(sun_info, moon_info, voxel_norm, view_dir, f_pos, mu, cam_attenuation, fluid_alt, k_a, k_d, k_s, alpha, voxel_norm, 1.0, emitted_light, reflected_light);
emitted_light *= f_ao; emitted_light *= f_ao;
reflected_light *= f_ao; reflected_light *= f_ao;
//max_light += lights_at(f_pos, voxel_norm, view_dir, mu, cam_attenuation, fluid_alt, k_a, k_d, k_s, alpha, voxel_norm, 1.0, emitted_light, reflected_light);
vec3 side_color = mix(surf_color, vec3(0.5, 0.6, 1.0), snow_cover); vec3 side_color = mix(surf_color, vec3(0.5, 0.6, 1.0), snow_cover);
vec3 top_color = mix(surf_color, surf_color * 0.3, 0.5 + snow_cover * 0.5); vec3 top_color = mix(surf_color, surf_color * 0.3, 0.5 + snow_cover * 0.5);
surf_color = mix(side_color, top_color, pow(fract(model_pos.z * 0.1), 2.0)); surf_color = mix(side_color, top_color, pow(fract(model_pos.z * 0.1), 2.0));
surf_color = illuminate(max_light, view_dir, surf_color * emitted_light, surf_color * reflected_light); surf_color = illuminate(max_light, view_dir, surf_color * emitted_light, surf_color * reflected_light);
// Temporarily disable particle transparency to avoid artifacts tgt_color = vec4(surf_color, 1.0);
tgt_color = vec4(surf_color, 1.0 /*f_col.a*/);
} }

View File

@ -53,7 +53,6 @@ void main() {
if ((inst_flags & FLAG_SNOW_COVERED) > 0u) { if ((inst_flags & FLAG_SNOW_COVERED) > 0u) {
snow_cover = 1.0; snow_cover = 1.0;
//f_col.rgb = mix(f_col.rgb, vec3(1), pow(max(f_norm.z, 0.0), 0.5));
} else { } else {
snow_cover = 0.0; snow_cover = 0.0;
} }

View File

@ -10,8 +10,7 @@ lazy_static = "1.4.0"
assets_manager = {version = "0.7", features = ["bincode", "ron", "json"]} assets_manager = {version = "0.7", features = ["bincode", "ron", "json"]}
ron = { version = "0.7", default-features = false } ron = { version = "0.7", default-features = false }
dot_vox = "4.0" dot_vox = "4.0"
wavefront = "0.2" wavefront = "0.2" # TODO: Use vertex-colors branch when we have models that have them
#wavefront = { path = "../../../../wavefront" }
image = { version = "0.23.12", default-features = false, features = ["png"] } image = { version = "0.23.12", default-features = false, features = ["png"] }
tracing = "0.1" tracing = "0.1"

View File

@ -31,13 +31,8 @@ impl Vertex {
} }
} }
// impl Default for Vertex {
// fn default() -> Self { Self::new(Vec2::zero(), Vec3::zero(),
// Vec3::zero()) } }
impl VertexTrait for Vertex { impl VertexTrait for Vertex {
const QUADS_INDEX: Option<wgpu::IndexFormat> = None; const QUADS_INDEX: Option<wgpu::IndexFormat> = None;
//Some(wgpu::IndexFormat::Uint16);
const STRIDE: wgpu::BufferAddress = mem::size_of::<Self>() as wgpu::BufferAddress; const STRIDE: wgpu::BufferAddress = mem::size_of::<Self>() as wgpu::BufferAddress;
} }

View File

@ -52,7 +52,7 @@ impl Default for GraphicsSettings {
fn default() -> Self { fn default() -> Self {
Self { Self {
view_distance: 10, view_distance: 10,
lod_distance: 100, lod_distance: 200,
sprite_render_distance: 100, sprite_render_distance: 100,
particles_enabled: true, particles_enabled: true,
lossy_terrain_compression: false, lossy_terrain_compression: false,