Commit Graph

25 Commits

Author SHA1 Message Date
sfan5 d53ef90a73 Remove Irrlicht versioning 2024-03-27 20:55:48 +01:00
sfan5 e9ab5bc223 Factor shadow constants out of MainShaderConstantSetter 2024-02-29 17:20:49 +01:00
sfan5 9fcd7f2dc0 Fix clang-tidy type promotion errors 2024-02-26 20:47:47 +01:00
Lars Müller 4acbd59162
Support absent scene node names (#14330)
Contains a hack to support IrrlichtMT revision 14 for now (until we release revision 15)
2024-02-18 11:39:16 +01:00
Rising Leaf 660151572f
Do not render objects that are invisble into the shadow map 2023-08-26 20:12:17 +02:00
Gregor Parzefall 6f0d36c41a Fixes and improvements 2023-07-20 22:15:47 +02:00
Gregor Parzefall 307e380f30 Refactor the way you set material properties
Instead of using SMaterial::setFlag, you now set them directly on SMaterial or SMaterialLayer.
2023-07-20 22:15:47 +02:00
Desour 8b73743baa Reduce number of recursively included headers
This should improve compilation speed.

Things changed:
* Prefer forward-declarations in headers.
* Move header-includes out of headers if possible.
* Move some functions definitions out of headers.
* Put some member variables into unique_ptrs (see Client).
2023-04-27 18:50:33 +02:00
Lars 8982998681 Add a default direction light for shadows 2023-04-09 07:10:17 -10:00
sfan5 c26e122485 Move video_driver default selection to runtime 2023-04-08 20:19:35 +02:00
Loïc Blot 322c8cf270
Reduce exposure of various internals (#12885)
* refactoring(StaticObjectList): don't expose m_active and m_stored anymore

This prevents our old crap code where anyone can access to StaticObjectList. use proper modifiers. It also permits to do a short cleanup on MapBlock using a helper

* refactoring(MapBlock): reduce a bit exposed m_active_blocks variable

* refactoring: MapBlock::m_node_timers is now private

We already had various helpers to perform this privatization, just use it. Also factorize the MapBlock stepping code for timers using already existing code and importing them from ServerEnvironment to MapBlock.

It's currently done pretty straight forward without any inheritance as MapBlock is just used everywhere, maybe in a future we'll have ServerMapBlock over MapBlock. Currently for a simple function let's just use proper objects and add a comment warning

* refactoring(Server): fix duplicated function for add/remove node

* refactoring(guiFormSpecMenu): add removeAll function to prevent duplicated code

* refactoring(ShadowRenderer) + perf: code quality  + increase performance

* All callers are already using the point and we should never test a function with nullptr node, it's a bug. Removed workaround which was hacky and fix the bug
* Drop clientmap lookup from shadowrendered, just use directly its
  pointer and forbid to push it in the generic list
* Reduce memory pressure on the renderShadowObject by preventing
  deallocating and reallocating multiple vectors on each node

* refactoring(MapBlock): reduce exposure of MapBlock::m_static_objects

It's not complete as some parts of the code are pretty nested, but it's better than before :)

* fix: better working on new functions & drop unwanted 2 lines

Co-authored-by: Jude Melton-Houghton <jwmhjwmh@gmail.com>

Co-authored-by: Jude Melton-Houghton <jwmhjwmh@gmail.com>
2022-11-03 17:35:31 +01:00
x2048 88820cd31c
Shadow list improvements (#12898)
* Remove redundant checks when attaching SM texture to entities.
  Some of the checks were broken, leading to crashes when shadow intensity is set to 0
* Avoid memory leak in shadow casters list when wield mesh changes item stacks
2022-10-26 22:26:09 +02:00
x2048 ff6dcfea82
Implement rendering pipeline and post-processing (#12465)
Co-authored-by: Lars Mueller <appgurulars@gmx.de>
Co-authored-by: sfan5 <sfan5@live.de>
Co-authored-by: lhofhansl <lhofhansl@yahoo.com>
2022-09-06 08:25:18 +02:00
x2048 7c261118e0
Release shadow mapping resources when not needed (#12497) 2022-07-09 22:26:39 +02:00
x2048 ef22c0206f
Force-update shadows when the world is changed (#12364) 2022-05-26 22:28:34 +02:00
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
sfan5 a89afe1229 Deal with compiler warnings 2022-04-30 16:49:41 +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
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 4801bdf45a Correct normal bias for entities
Remove use of magic constants.
Apply cameraOffset
Calculate distance projected on SM plane
2022-03-07 23:45:26 +01:00
x2048 442e48b84f
Move updating shadows outside of RenderingCore::drawAll. (#11491)
Fixes indirect rendering modes such as some 3D modes mentioned in #11437 and undersampled rendering.
Does not fully fix anaglyph 3d mode.
2021-08-12 20:07:09 +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
Liso c47313db65
Shadow mapping render pass (#11244)
Co-authored-by: x2048 <codeforsmile@gmail.com>
2021-06-06 18:51:21 +02:00