Commit Graph

49 Commits (master)

Author SHA1 Message Date
x2048 dc45b85a54
Improve shadow filters (#12195)
* Rewrite shadow filtering for the new distortion
* Calculate penumbra radius using a single sample
* Avoid peter-panning effect due to filtering of short shadows
* Add adaptive filter quality for soft shadows
* Avoid sharp shadows on surfaces without normals (e.g. plants)
* Increase default and maximum soft shadow radius
* Make line numbers in shader errors match the code
2022-05-21 16:49:30 +02:00
x2048 a5d29fa1d4
Implement shadow offsets for the new SM distortion function (#12191)
* Move shadow position calculation to vertex shaders
* Animate entire scene before rendering shadows to prevent lagging of shadows
* Remove unnecessary use of PolygonOffsetFactor
* Apply normal offset to both nodes and objects
* Rename getPerspectiveFactor -> applyPerspectiveDistortion
* Remove perspective distortion from fragment shaders
2022-04-14 22:49:30 +02:00
ShadowNinja 7993909fab Spacing fixes 2022-04-08 14:55:21 +01:00
x2048 48f7c5603e
Adjust shadowmap distortion to use entire SM texture (#12166) 2022-04-07 22:13:50 +02:00
x2048 31578303a4
Tune shadow perspective distortion (#12146)
* Pass perspective distortion parameters as uniforms
* Set all perspective bias parameters via ShadowRenderer
* Recalibrate perspective distortion and shadow range to render less shadow geometry with the same quality and observed shadow distance
2022-03-31 22:40:06 +02:00
x2048 0f25fa7af6
Add API to control shadow intensity from the game/mod (#11944)
* Also Disable shadows when sun/moon is hidden. Fixes #11972.
2022-03-26 16:58:26 +01:00
Dmitry Kostenko b651bbf446 Reuse normal offset calculation for nodes 2022-03-07 23:45:26 +01:00
Dmitry Kostenko 12896b22d8 Remove debugging code 2022-03-07 23:45:26 +01:00
Dmitry Kostenko a684a91bf5 Fix shadow rendering with filtering disabled 2022-03-07 23:45:26 +01:00
Dmitry Kostenko f2cccf8da7 Improve self-shadowing based on light/normal angle
Add compatibility with colored shadows.
2022-03-07 23:45:26 +01:00
Dmitry Kostenko 71317b8579 Make sure nightRatio is always greater than zero.
To avoid underfined behavior of GLSL pow()
2022-01-22 18:52:12 +01:00
x2048 835524654e
Fix shadow mapping when PCF is disabled (#11888) 2022-01-02 13:45:55 -08:00
x2048 cef016d393
Apply shadow only to the naturally lit part of the fragment color (#11722)
Fragment color for nodes is now calculated from:

 * Texture color, highlighted by artificial light if present (light color conveyed via vertex color).
 * Texture color highlighted by natural light (conveyed via vertex color) filtered by shadow.
 * Reflected day/moonlight filtered by shadow (color and intensity), assuming some portion of the light is directly reflected from the materials.
2021-10-31 19:18:30 +01:00
x2048 982e03f60d
Improvements to colored shadows (#11516) 2021-10-01 16:21:53 +02:00
sfan5 ea250ff5c5 Fix GLES2 discard behaviour (texture transparency) 2021-09-17 18:13:50 +02:00
x2048 bf3acbf388
Distribute shadow map update over multiple frames to reduce stutter (#11422)
Reduces stutter and freezes when playing.

 * Maintains double SM and SM Color textures
 * Light frustum update triggers incremental generation of shadow map into secondary 'future' textures.
 * Every incremental update renders a portion of the shadow draw list (split equally).
 * After defined number of frames (currently, 4), 'future' and 'current' textures are swapped, and DirectionalLight 'commits' the new frustum to use when rendering shadows on screen.

Co-authored-by: sfan5 <sfan5@live.de>
2021-07-25 12:36:23 +02:00
x2048 ff2d2a6e93
Add smooth light-shadow transition at noon (#11430)
Node faces with normals pointing East/West (+X/-X) will transition between light
and shadow at noon. This code makes the transition smooth.
2021-07-25 12:35:12 +02:00
x2048 f5706d444b
Improve shadow rendering with non-default camera FOV (#11385)
* Adjust minimum filter radius for perspective

* Expand shadow frustum when camera FOV changes, reuse FOV distance adjustment from numeric.cpp

* Read shadow_soft_radius setting as float

* Use adaptive filter radius to accomodate for PSM distortion

* Adjust filter radius for texture resolution
2021-07-11 08:15:19 -07:00
Liso c47313db65
Shadow mapping render pass (#11244)
Co-authored-by: x2048 <codeforsmile@gmail.com>
2021-06-06 18:51:21 +02:00
Vitaliy 03540e7140
Fix GLES shader support after #9247 (#10727) 2020-12-22 14:53:52 +01:00
Vitaliy ccbf8029ea
Cleanup shader generation code (#10663)
Shader generation is a mess. This commit cleans some parts up, including dropping remains of HLSL support which was never actually implemented.
2020-12-19 20:57:10 +01:00
HybridDog e73c5d4585
Fix MSAA stripes (#9247)
This only works when shaders are enabled.
The centroid varying avoids that the textures (which repeat themselves out of bounds) are sampled out of bounds in MSAA.
If MSAA (called FSAA in minetest) is disabled, the centroid keyword does nothing.
2020-12-04 20:16:12 +01:00
Vitaliy 707c8c1e95
Shaders for Android (GLES 2) (#10506)
Shader support for OpenGL ES 2 devices (Android)

Co-authored-by: sfan5 <sfan5@live.de>
2020-10-25 18:01:03 +01:00
Lars ed22260822 Remove all bump mapping and parallax occlusion related code. 2020-10-17 13:09:16 -07:00
hecks fcff9f2911
Remove "generate normal maps" feature (#10313)
Erase all traces of normal "generation" from fragment shaders
Remove the "feature" from the engine and default config
Remove any leftover documentation of it
2020-09-14 19:27:25 +02:00
mntmn 44c98089cf
shaders: Fix transparency on GC7000L (#10036)
Workaround for the missing GL_ALPHA_TEST implementation in Mesa (etnaviv driver).
2020-08-25 20:49:51 +02:00
lhofhansl 5fde69798c
Simple shader fixes. (#8991)
1. Pass current camera offset to shader, so shader have access to the global coordinates
2. Pass animation timer to fragment shader. C++ code is already there, just wasn't declared in the shader
3. Delay animation timer wrap-around (from 100s to about 16 minutes)
2019-09-26 13:57:39 -07:00
numberZero 74afe6fe6b Fix fog weirdness (#5146) 2017-01-31 08:42:39 +01:00
Lars Hofhansl 923a8f1983 Shaders: Remove unnecessary 'if' statements
Pull if GENERATE_NORMALMAPS == 1 into the template to avoid evaluating
it for each fragment.
Remove if (fogDistance != 0.0).
2016-12-24 00:22:16 +00:00
Lars Hofhansl 075833e393 Fog: Make fraction of visible distance at which fog starts configurable
Optimise the fetching of global settings 'camera_smoothing',
'cinematic' and 'cinematic_camera_smoothing'.
Cache 'cam_smoothing'.
2016-12-07 04:07:54 +00:00
Rogier-5 5f0dc8e78a Fix unexplained shader issue (glsl compiler bug??) (#4757) 2016-11-17 02:56:05 +10:00
lhofhansl 198ed60cab Shaders: Remove special handling for liquids. (#4670) 2016-10-26 16:24:45 +02:00
Lars Hofhansl 98176481c1 Shaders: Apply tone mapping before fog calculation. 2016-10-25 07:49:19 +02:00
Lars Hofhansl 779d2c5f64 Shaders: Harmonize Irrlicht and shader fog calculations 2016-10-24 07:41:00 +01:00
Lars Hofhansl 0ad40fd484 Use range-based fog instead of z-plane based. 2016-10-13 23:30:15 +02:00
RealBadAngel e8a3d22cbe Shaders: fix fog not affecting opaque liquids 2016-02-23 23:51:41 +00:00
RealBadAngel eb3840a3f8 Filmic HDR tone mapping 2016-02-09 02:55:59 -05:00
RealBadAngel a64d78a37e Speed up and make more accurate relief mapping
using linear + binary search.
2015-12-10 18:24:11 +01:00
RealBadAngel 8b8d17b22b Remove use of engine sent texture tiling flags - theyre no longer needed 2015-08-20 02:41:40 +02:00
RealBadAngel 655fc6010f Fix relief mapping issues 2015-07-16 15:36:48 +02:00
RealBadAngel 8a85e5e58d Shaders fixes and cleanup relief mapping code. 2015-07-02 21:36:45 +02:00
RealBadAngel 1455267c9e Bugfix: variable type mismatch 2015-06-28 21:11:54 +02:00
RealBadAngel 53efe2ef42 Remove textures vertical offset. Fix for area enabling parallax. 2015-06-21 00:11:09 +02:00
RealBadAngel 43fcfbfe05 Improved parallax mapping. Generate heightmaps on the fly. 2015-06-14 21:13:36 +02:00
Loic Blot 46821f1156 Optimize bumpmapping mathematics
OpenGL_vertex:
* bufferize a duplicate calcul
* Factorize vertexes
2015-01-16 20:54:04 +10:00
Craig Robbins 516f1bcd16 Revert "Optimize bumpmapping mathematics"
This reverts commit 148fffb0f2.
2015-01-16 01:30:03 +10:00
Loic Blot 148fffb0f2 Optimize bumpmapping mathematics
OpenGL_vertex:
* bufferize a duplicate calcul
* Factorize vertexes
2015-01-15 23:12:45 +10:00
RealBadAngel a0f78659f3 Improved faces shading with and without shaders. 2014-06-17 00:56:17 +02:00
RealBadAngel 6c98fd6658 Unite nodes shaders.
Pass drawtype and material type to shaders.
Move shaders generation to startup only.
Allow assign shaders per tile.
Initial code to support water surface shader.
2014-06-15 05:40:33 +02:00