Full Changelog: 4.x-2024.12.07...4.x-2024.12.22
Implemented tweaks:
- Far plane (z-far) upper limit is set to 9e18 meters.
- Large World Coordinates are used when compiling (double precision floats).
- Increased editor zoom out distance to galactic scale (depth buffer must be adjusted for such scales, see below).
- Implemented tweaks to mobile rendering back-end to fix possible precision-related issues.
- Increased editor zoom increment for faster zooming.
Suggested:
- Use logarithmic depth in your spatial shaders to achieve rendering at extreme distances (if reverse depth buffer is not enough)
without z-fighting. Keep in mind that this may break some depth-related effects and shadow-casting.
// Add this before your vertex shader.
// Edit "Fcoef" to adjust for desirable view distance. Lesser number means further distance limit.
uniform float Fcoef = 0.001;
varying float gl_Position_z;
// Add this to your vertex shader.
void vertex()
{
vec4 gl_Position = MODELVIEW_MATRIX*vec4(VERTEX, 1.0);
gl_Position_z = gl_Position.z;
}
//Add this to your fragment shader.
void fragment()
{
DEPTH = log2(max(1e-6, 1.0 -gl_Position_z)) * Fcoef;
}
- Use spatial shader material dithering for better de-banding on per-material basis.
// Add this before your vertex shader.
// Edit "dither_darken" to adjust the brightness of dither pattern (optional).
uniform float dither_darken : hint_range(0.5, 1.0, 5e-4) = 0.75;
const float dither_x = 172.7;
const float dither_y = 232.6;
const float dither_r = 105.5;
const float dither_g = 99.0;
const float dither_b = 110.0;
vec3 interleaved_gradient_noise(vec2 frag_coord) {
vec3 dither = vec3(dot(vec2(dither_x, dither_y), frag_coord));
dither.rgb = fract(dither.rgb / vec3(dither_r, dither_g, dither_b));
return (dither.rgb - vec3(dither_darken)) / 255.0;
}
//Add this to your fragment shader.
void fragment()
{
vec2 frag_coord = FRAGCOORD.xy;
ALBEDO += interleaved_gradient_noise(frag_coord);
}