mirror of
https://github.com/minetest/minetest.git
synced 2025-03-06 20:48:40 +01:00
Remove shadow direction quantization, increase shadow update frames instead (#15665)
* This removes shadow direction quantization and defaults shadow_update_frames to 16 instead.
This commit is contained in:
parent
d044c27b5f
commit
d15214af52
3 changed files with 3 additions and 15 deletions
|
@ -1899,7 +1899,7 @@ shadow_poisson_filter (Poisson filtering) bool true
|
||||||
# Minimum value: 1; maximum value: 16
|
# Minimum value: 1; maximum value: 16
|
||||||
#
|
#
|
||||||
# Requires: enable_dynamic_shadows, opengl
|
# Requires: enable_dynamic_shadows, opengl
|
||||||
shadow_update_frames (Map shadows update frames) int 8 1 16
|
shadow_update_frames (Map shadows update frames) int 16 1 32
|
||||||
|
|
||||||
# Set to true to render debugging breakdown of the bloom effect.
|
# Set to true to render debugging breakdown of the bloom effect.
|
||||||
# In debug mode, the screen is split into 4 quadrants:
|
# In debug mode, the screen is split into 4 quadrants:
|
||||||
|
|
|
@ -13,18 +13,6 @@
|
||||||
|
|
||||||
using m4f = core::matrix4;
|
using m4f = core::matrix4;
|
||||||
|
|
||||||
static v3f quantizeDirection(v3f direction, float step)
|
|
||||||
{
|
|
||||||
|
|
||||||
float yaw = std::atan2(direction.Z, direction.X);
|
|
||||||
float pitch = std::asin(direction.Y); // assume look is normalized
|
|
||||||
|
|
||||||
yaw = std::floor(yaw / step) * step;
|
|
||||||
pitch = std::floor(pitch / step) * step;
|
|
||||||
|
|
||||||
return v3f(std::cos(yaw)*std::cos(pitch), std::sin(pitch), std::sin(yaw)*std::cos(pitch));
|
|
||||||
}
|
|
||||||
|
|
||||||
void DirectionalLight::createSplitMatrices(const Camera *cam)
|
void DirectionalLight::createSplitMatrices(const Camera *cam)
|
||||||
{
|
{
|
||||||
static const float COS_15_DEG = 0.965926f;
|
static const float COS_15_DEG = 0.965926f;
|
||||||
|
@ -74,7 +62,7 @@ void DirectionalLight::createSplitMatrices(const Camera *cam)
|
||||||
v3f boundVec = (cam_pos_scene + farCorner * sfFar) - center_scene;
|
v3f boundVec = (cam_pos_scene + farCorner * sfFar) - center_scene;
|
||||||
float radius = boundVec.getLength();
|
float radius = boundVec.getLength();
|
||||||
float length = radius * 3.0f;
|
float length = radius * 3.0f;
|
||||||
v3f eye_displacement = quantizeDirection(direction, M_PI / 2880 /*15 seconds*/) * length;
|
v3f eye_displacement = direction * length;
|
||||||
|
|
||||||
// we must compute the viewmat with the position - the camera offset
|
// we must compute the viewmat with the position - the camera offset
|
||||||
// but the future_frustum position must be the actual world position
|
// but the future_frustum position must be the actual world position
|
||||||
|
|
|
@ -341,7 +341,7 @@ void set_default_settings()
|
||||||
settings->setDefault("shadow_map_color", "false");
|
settings->setDefault("shadow_map_color", "false");
|
||||||
settings->setDefault("shadow_filters", "1");
|
settings->setDefault("shadow_filters", "1");
|
||||||
settings->setDefault("shadow_poisson_filter", "true");
|
settings->setDefault("shadow_poisson_filter", "true");
|
||||||
settings->setDefault("shadow_update_frames", "8");
|
settings->setDefault("shadow_update_frames", "16");
|
||||||
settings->setDefault("shadow_soft_radius", "5.0");
|
settings->setDefault("shadow_soft_radius", "5.0");
|
||||||
settings->setDefault("shadow_sky_body_orbit_tilt", "0.0");
|
settings->setDefault("shadow_sky_body_orbit_tilt", "0.0");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue