Commit Graph

60 Commits

Author SHA1 Message Date
sfan5 9fcd7f2dc0 Fix clang-tidy type promotion errors 2024-02-26 20:47:47 +01:00
lhofhansl 518ecd7f4e
Slight optimizations in ClientMap (#14251) 2024-01-12 16:53:08 -08:00
lhofhansl 4bf95703a0
Allow access into MapSector::m_blocks (#14232)
* New API to allow access into MapSector::m_blocks
* Use this API on ClientMap::touchMapBlocks(), ClientMap::updateDrawList(), and ClientMap::updateDrawListShadow() to speed them up
2024-01-10 09:17:26 -08:00
DS 3eab5e9002
Replace clientmap's MeshBufListList with a hashmap 2024-01-03 21:56:38 +01:00
x2048 e36b2226b9
Skip face culling in shadows for double-sided materials (e.g. plantlike) (#13500)
* Skip face culling in shadows for double-sided materials (e.g. plantlike)

* Keep previous face culling for transparent surfaces e.g. water
2023-09-17 21:42:14 +02:00
Gregor Parzefall aea9242a96
Allow nodes to have their post_effect_color affected by lighting (#13637)
Co-authored-by: DS <ds.desour@proton.me>
2023-08-24 20:16:36 +02:00
Gregor Parzefall 72ef90885d
Clean up texture filtering settings (#13683) 2023-08-24 10:50:47 +02:00
Gregor Parzefall 6f0d36c41a Fixes and improvements 2023-07-20 22:15:47 +02:00
Gregor Parzefall 7473e4cafd Expose all OpenGL filtering modes, use OpenGL names for them
Because of a review comment on the Irrlicht PR by numberZero.
2023-07-20 22:15:47 +02:00
Gregor Parzefall 6bf63d4b41 Rename SMaterial::TextureLayer -> SMaterial::TextureLayers
It's not the "texture layer" of the material, but an array of texture layers.
2023-07-20 22:15:47 +02:00
Gregor Parzefall 9bef3c136a Split up texture filtering properties of SMaterialLayer into MinFilter and MagFilter
You can	now set	the filter used	when scaling textures down and the filter used when scaling textures up separately.
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
lhofhansl 8f25f487fe
Instrument touchMapBlocks and block loading/deserialization. (#13314) 2023-06-19 16:59:08 -07: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 7048fc25dd Take mesh-bounding-sphere into account in updateDrawListShadow 2023-04-03 13:57:05 -07:00
Lars b01f85d573 Revert "Add mesh-holding blocks to shadow drawlist. (#13203)"
This reverts commit 2a8becd650.
2023-04-03 13:57:05 -07:00
x2048 6c0a6925fc
Corrections to loops and BFS cullers (#13375)
* Reset usage timers in loops culler
* Correctly touch map blocks when using bfs culler
* Align use of variables
* Report statistics when using loop culler
2023-04-01 22:41:00 +02:00
x2048 93898957b6
Return 'loops' occlusion culler under a setting (#13352)
* Add occlusion_culler setting to minetest.conf.example
* Add raytraced occlusion culling to 'loops' algorithm

---------

Co-authored-by: sfan5 <sfan5@live.de>
2023-03-30 00:10:23 +02:00
lhofhansl 3e148e2810
Fix infinite viewing_range (#13225)
Use a simplified version of the old loops culler for infinite viewing range.
2023-03-12 09:37:47 -07:00
x2048 705195b43e
Scale culler steps proportionally to the mesh sizes (#13250) 2023-03-11 14:10:26 +01:00
x2048 2553db5c81
Fix rounding errors when slicing the shadow draw list (#13226) 2023-02-20 21:01:05 +01:00
lhofhansl 2a8becd650
Add mesh-holding blocks to shadow drawlist. (#13203)
When mesh chunking and shadows are enabled, make sure that the mesh-holding blocks are added to the shadow drawlist.
Otherwise those portions of the shadows will not be rendered.
2023-02-16 15:43:08 -10:00
lhofhansl d3a6ee00e6
Generalize mesh chunking, and make it configurable. (#13179)
* Generalize mesh chunking. Set 3x3x3 chunks.

* Make mesh chunk size configurable... Default to 1 (off).

* Extract all mesh grid maths into a dedicated class

---------

Co-authored-by: x2048 <codeforsmile@gmail.com>
2023-02-08 13:42:12 -08:00
lhofhansl 56d2567b5d
Separate drawlist from non-rendered blocks. (#13176) 2023-02-01 08:41:23 -08:00
x2048 69fc206109
8x block meshes (#13133)
Reduce the number of drawcalls by generating a mesh per 8 blocks (2x2x2). Only blocks with even coordinates (lowest bit set to 0) will get a mesh.

Note: This also removes the old 'loops' algorithm for building the draw list, because it produces visual artifacts and cannot be made compatible with the approach of having a mesh for every 8th block without hurting performance.

Co-authored-by: Jude Melton-Houghton <jwmhjwmh@gmail.com>
Co-authored-by: Lars <larsh@apache.org>
Co-authored-by: sfan5 <sfan5@live.de>
2023-01-31 17:30:59 +01:00
x2048 b8aaad4f1e
Remove the 'loops' occlusion culler (#13169) 2023-01-23 10:58:29 +01:00
x2048 2715cc8bf6
Occlusion culling algorithm based on recursive descend (#13104)
Co-authored-by: DS <vorunbekannt75@web.de>
2023-01-06 22:31:06 +01: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
lhofhansl b829231992
Fix incorrect culling introduced by ##12710 (#12887) 2022-10-28 09:52:54 -07:00
Jude Melton-Houghton 9676364c1f
Optimize lighting calculation (#12797) 2022-10-09 10:50:26 -04:00
DS c9ed059d91
Client map: do frustum culling via planes (#12710) 2022-09-18 15:28:53 +02:00
Herman Semenov 038da00e79
Code optimizations / refactor (#12704)
Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com>
Co-authored-by: sfan5 <sfan5@live.de>
2022-09-06 11:21:09 +01:00
x2048 d1cbb4bd8a
Reduce the use of porting::getTimeMs() when rendering frames (#12679)
* Avoid calling TimeTaker too frequently in renderMapXXX
* Calculate animation timer once per frame
* Remove code that breaks rendering frame at 2000ms

Co-authored-by: sfan5 <sfan5@live.de>

Co-authored-by: sfan5 <sfan5@live.de>
2022-08-13 22:33:26 +02:00
x2048 7c261118e0
Release shadow mapping resources when not needed (#12497) 2022-07-09 22:26:39 +02:00
sfan5 575caa8015 Properly keep noclip state in Game and ClientMap 2022-06-03 21:48:52 +02:00
paradust7 2742fef458
Fixes needed to use irrArray backed by std::vector (#12263) 2022-05-22 00:11:49 +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
ShadowNinja 7993909fab Spacing fixes 2022-04-08 14:55:21 +01:00
Dmitry Kostenko 23516acd0b Remove obsolete commented code (follow up to #12166) 2022-04-07 22:38:01 +02:00
x2048 48f7c5603e
Adjust shadowmap distortion to use entire SM texture (#12166) 2022-04-07 22:13:50 +02:00
x2048 b0b9732359
Add depth sorting for node faces (#11696)
Use BSP tree to order transparent triangles
https://en.wikipedia.org/wiki/Binary_space_partitioning
2022-04-02 10:42:27 +02:00
x2048 982e03f60d
Improvements to colored shadows (#11516) 2021-10-01 16:21:53 +02:00
x2048 f5040707fe
Order drawlist by distance to the camera when rendering (#11651) 2021-09-27 17:46:08 +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
Loic Blot 1bc855646e refacto: protect some RenderingEngine::get_scene_manager
* protect it from Camera, Sky, ClientMap object calls
* rename Game::sky to Game::m_sky
2021-05-03 19:49:19 +02:00
sfan5 f0bad0e2ba
Reserve vectors before pushing and other code quality changes (#11161) 2021-04-05 13:38:31 +02:00
hecks 225e69063f
Keep mapblocks in memory if they're in range (#10714)
Some other minor parts of clientmap.cpp have been cleaned up along the way
2021-02-26 21:23:46 +01:00
Lars 289425f6bd Minor profiler fixes. 2020-12-23 14:48:08 -08:00
hecks 6d7067fd37
Implement mapblock camera offset correctly (#10702)
Implement mapblock camera offset correctly - reduce client jitter

Co-authored-by: hecktest <>
2020-12-05 15:03:40 -08:00