voxel weight change
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2024-11-22 20:42:14 -05:00
parent c8e6c02a1e
commit 745dbe224b
4 changed files with 9 additions and 8 deletions

View File

@ -1125,6 +1125,8 @@ Foliage manager non-collision engine height lookups
Fix foliage manager not respecting graphics settings
Small noise sampling refactor
Fix test data for main menu render test
Change voxel weight reporting from server to align with foliage
Use jenkins data for unit test temporarily
# TODO

View File

@ -69,7 +69,7 @@ public class FoliageModel {
/**
* Cutoff to place foliage at, weight-wise
*/
static final double FOLIAGE_CUTOFF = 0.0;
static final double FOLIAGE_CUTOFF = -1.0;
/**
* Cutoff for the cummulative weight to place foliage at

View File

@ -5,7 +5,6 @@ import electrosphere.game.data.voxel.sampler.SamplerFile;
import electrosphere.server.terrain.generation.interfaces.GeneratedVoxel;
import electrosphere.server.terrain.generation.interfaces.GenerationContext;
import electrosphere.server.terrain.generation.noise.NoiseSampler;
import io.github.studiorailgun.MathUtils;
/**
* Generates voxels based on a noise config
@ -54,14 +53,14 @@ public class NoiseVoxelGen implements VoxelGenerator {
double heightDiff = realY - surfaceHeight;
double sample = this.sampler.getValue(0, realX, realY, realZ);
if(sample <= 0){
voxel.weight = -1.0f;
voxel.weight = (float)(sample * 2);
voxel.type = 0;
return;
}
if(heightDiff < -strideMultiplier * SURFACE_VOXEL_WIDTH){
//below surface
double finalSurface = MathUtils.clamp(sample,0,1);
voxel.weight = (float)finalSurface * 2 - 1;
double finalSurface = sample;
voxel.weight = (float)finalSurface;
voxel.type = 1;
} else if(heightDiff > 0) {
//above surface
@ -69,8 +68,8 @@ public class NoiseVoxelGen implements VoxelGenerator {
voxel.type = 0;
} else if(heightDiff < -strideMultiplier){
//generate full-size surface-type voxel
double finalHeight = MathUtils.clamp(sample,0,1);
voxel.weight = (float)finalHeight * 2 - 1;
double finalHeight = sample;
voxel.weight = (float)finalHeight;
voxel.type = 2;
} else {
//surface
@ -78,7 +77,7 @@ public class NoiseVoxelGen implements VoxelGenerator {
if(surfacePercent > 1.0 || surfacePercent < 0){
throw new Error("surfacePercent " + surfacePercent + " " + realY + " " + surfaceHeight + " " + heightDiff + " " + strideMultiplier);
}
double finalHeight = MathUtils.clamp(sample,0,1) * surfacePercent;
double finalHeight = sample * surfacePercent;
voxel.weight = (float)finalHeight * 2 - 1;
voxel.type = 2;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB