mirror of
https://github.com/X0nk/Bliss-Shader.git
synced 2025-06-22 00:37:35 +08:00
clean up; dimension support
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
#define BLOCK_EMPTY 0
|
||||
|
||||
#define BLOCK_WATER 8
|
||||
|
||||
#define BLOCK_BEACON 1001
|
||||
|
@ -1,9 +1,16 @@
|
||||
// LPV falloff curve
|
||||
const float LpvBlockPower = 4.0;
|
||||
|
||||
// LPV block brightness scale
|
||||
const float LpvBlockBrightness = 3.0;
|
||||
|
||||
|
||||
vec4 SampleLpvNearest(const in ivec3 lpvPos) {
|
||||
vec4 lpvSample = (frameCounter % 2) == 0
|
||||
? imageLoad(imgLpv1, lpvPos)
|
||||
: imageLoad(imgLpv2, lpvPos);
|
||||
|
||||
lpvSample.b = pow(lpvSample.b, 4) * LpvBlockSkyRange.x;
|
||||
lpvSample.b = pow(lpvSample.b, LpvBlockPower) * LpvBlockSkyRange.x;
|
||||
lpvSample.rgb = HsvToRgb(lpvSample.rgb);
|
||||
|
||||
return lpvSample;
|
||||
@ -37,7 +44,7 @@ vec4 SampleLpvLinear(const in vec3 lpvPos) {
|
||||
}
|
||||
|
||||
vec3 GetLpvBlockLight(const in vec4 lpvSample) {
|
||||
return 3.0 * lpvSample.rgb;
|
||||
return LpvBlockBrightness * lpvSample.rgb;
|
||||
}
|
||||
|
||||
float GetLpvSkyLight(const in vec4 lpvSample) {
|
||||
|
@ -4,10 +4,3 @@ const uint VoxelSize = uint(exp2(LPV_SIZE));
|
||||
const uvec3 VoxelSize3 = uvec3(VoxelSize);
|
||||
|
||||
const float voxelDistance = 64.0;
|
||||
|
||||
#define BLOCK_EMPTY 0
|
||||
|
||||
ivec3 GetVoxelIndex(const in vec3 playerPos) {
|
||||
vec3 cameraOffset = fract(cameraPosition);
|
||||
return ivec3(floor(playerPos + cameraOffset) + VoxelSize3/2u);
|
||||
}
|
||||
|
@ -1,6 +0,0 @@
|
||||
uint GetVoxelBlock(const in ivec3 voxelPos) {
|
||||
if (clamp(voxelPos, ivec3(0), ivec3(VoxelSize3-1u)) != voxelPos)
|
||||
return BLOCK_EMPTY;
|
||||
|
||||
return imageLoad(imgVoxelMask, voxelPos).r;
|
||||
}
|
@ -1,3 +1,8 @@
|
||||
ivec3 GetVoxelIndex(const in vec3 playerPos) {
|
||||
vec3 cameraOffset = fract(cameraPosition);
|
||||
return ivec3(floor(playerPos + cameraOffset) + VoxelSize3/2u);
|
||||
}
|
||||
|
||||
void SetVoxelBlock(const in vec3 playerPos, const in uint blockId) {
|
||||
ivec3 voxelPos = GetVoxelIndex(playerPos);
|
||||
if (clamp(voxelPos, ivec3(0), ivec3(VoxelSize-1u)) != voxelPos) return;
|
||||
|
Reference in New Issue
Block a user