Commit graph

125 commits

Author SHA1 Message Date
Moritz Brückner b3162d8f6e Fix visual artifacts caused by invalid gbuffer2 on OpenGL 2021-07-10 22:41:19 +02:00
N8n5h ead7dc9d32 Moved biasLWVP matrix uniform reference to a new one for sun
This was done because the original "_biasLightWorldViewProjectionMatrix"
relies on renderpath.light, which is problematic when rendering the
deferred light pass and there is a sun and other lights of different
type on the scene. Which would result on the wrong light being picked up
for the calculation of the uniform value.
2021-03-29 10:55:58 -03:00
N8n5h 7463de6140 Add cast_shadow to lightArray data
This was done to undo the hardcoded nature of "receiveShadows", which
doesn't play nice when you have multiple lights of the same type and
one or several have cast_shadow set to false.

By simply "passing" the cast_shadow parameter within the lightArray it
was possible to detect lights that don't cast shadows before actually
wasting gpu cycles to render shadows with garbage data.

Support for deferred desktop and mobile, and forward was added.
2021-03-14 23:20:57 -03:00
Alexander Kleemann aec10274f4 Add option to ignore irradiance for baked environments 2021-02-20 15:30:18 +01:00
N8n5h 1c3e24a8fd Add support for shadow map atlasing
With this it is now possible to enable atlasing of shadow maps, which solves the existing limitation of 4 lights in a scene. This is done by
grouping the rendering of shadow maps, that currently are drawn into their own images for each light, into one or several big textures. This was
done because the openGL and webGL version Armory targets do not support dynamic indexing of shadowMapSamplers, meaning that the index that
access an array of shadow maps has to be know by the compiler before hand so it can be unrolled into if/else branching. By instead simply
using a big shadow map texture and moving the dynamic part to other types of array that are allowed dynamic indexing like vec4 and mat4, this
limitation was solved.

The premise was simple enough for the shader part, but for the Haxe part, managing and solving where lights shadow maps should go in a shadow map
can be tricky. So to keep track and solve this, ShadowMapAtlas and ShadowMapTile were created. These classes have the minimally required logic
to solve the basic features needed for this problem: defining some kind of abstraction to prevent overlapping of shadowmaps, finding available
space, assigning such space efficiently, locking and freeing this space, etc. This functionality it is used by drawShadowMapAtlas(), which is a
modified version of drawShadowMap().

Shadow map atlases are represented with perfectly balanced 4-ary trees, where each tree of the previous definition represents a "tile" or slice
that results from dividing a square that represents the image into 4 slices or sub-images. The root of this "tile" it's a reference to the
tile-slice, and this tile is divided in 4 slices, and the process is repeated depth-times. If depth is 1, slices are kept at just the initial
4 tiles of max size, which is the default size of the shadow map. #arm_shadowmap_atlas_lod allows controlling if code to support more depth
levels is added or not when compiling.

the tiles that populate atlases tile trees are simply a data structure that contains a reference to the light they are linked to, inner
subtiles in case LOD is enabled, coordinates to where this tile starts in the atlas that go from 0 to Shadow Map Size, and a reference to a
linked tile for LOD. This simple definition allows tiles having a theoretically small memory footprint, but in turn this simplicity might make
some functionality that might be responsibility of tiles (for example knowing if they are overlapping) a responsibility of the ones that
utilizes tiles instead. This decision may complicate maintenance so it is to be revised in future iterations of this feature.
2021-02-04 17:53:59 -03:00
N8n5h 893b313643 Solve artifact with clustering of lights
Changed how a spot light is detected when sampling light, which caused false positives and produced
that visual artifact when a cluster/pixel was detected incorrectly as being lit with a spot light when maybe none were there.
This issue seems somewhat related to that issue that prevents rendering spotlights and point lights shadow at the same time.
2020-12-27 16:02:35 -03:00
luboslenco fbe144decc Fix material id access in deferred light 2020-07-20 23:15:36 +02:00
Moritz Brückner 3654d34997 Update more shaders for receive shadow option 2020-07-13 23:28:43 +02:00
Lubos Lenco c970c5db6c Pass irradiance uniform as argument 2020-05-10 19:43:02 +02:00
luboslenco b0cd02d68e Allow multiple color attachment formats 2020-05-10 10:46:12 +02:00
Lubos Lenco df6346c1d1 Color attachment format 2020-05-06 21:30:59 +02:00
unknown 8e2f037d9b Fix packing inline 2019-07-14 16:45:34 +02:00
luboslenco f82be5bc64 Improve packing 2019-07-07 22:02:07 +02:00
luboslenco 00237fdd42 Fix ssrs 2019-05-30 20:22:57 +02:00
luboslenco 2da0e03d17 Micro shadowing 2019-05-21 21:53:57 +02:00
luboslenco aa5c4f7e73 Link to embedded data 2019-04-26 11:12:09 +02:00
luboslenco 82235ef194 Fix resolve pass 2019-04-16 13:30:35 +02:00
unknown 5240249982 Use voxelao instead of voxelgi, gi will be reworked into raytracing 2019-04-06 18:52:21 +02:00
luboslenco c29e8fdbd0 Shadows cleanup 2019-03-23 10:56:30 +01:00
luboslenco a1da8b0824 Expose cone aperture 2019-02-09 15:34:16 +01:00
luboslenco dc08938884 Disable cone trace for zero intensity 2019-02-07 21:33:04 +01:00
luboslenco 7b7260d647 Update volumetric 2019-01-28 11:28:21 +01:00
luboslenco 4172e0a2c6 Fix LTC shadow 2019-01-27 23:48:54 +01:00
luboslenco da84a870f1 Fix LTC 2019-01-27 20:13:21 +01:00
luboslenco e17d06225c Expose voxel shadow 2019-01-27 19:12:00 +01:00
luboslenco 9ba53d172d Transluc + sss fixes 2019-01-24 12:47:51 +01:00
luboslenco 89cad4e25e Emission fixes 2019-01-23 18:09:53 +01:00
luboslenco d64441b7d3 Update voxelgi 2019-01-10 21:54:36 +01:00
luboslenco bee4f02103 Fix cloud texture 2019-01-10 12:35:13 +01:00
luboslenco 2eab2c1adb Shadow fixes 2019-01-09 21:25:09 +01:00
unknown 87a895d3b6 Shadowmap size cleanup 2018-12-28 13:31:43 +01:00
luboslenco 9c9fd0881e Uniform fixes 2018-12-15 19:03:11 +01:00
luboslenco 7dcb443060 Use shadow samplers, remove arm_dev 2018-12-15 15:07:30 +01:00
luboslenco 914030e7f4 Shadowmap arrays 2018-12-11 23:05:18 +01:00
luboslenco d8f78638bd Begin shadow index 2018-12-10 23:29:04 +01:00
luboslenco bd03fd0465 Forward clusters 2018-12-10 18:18:32 +01:00
luboslenco 6176a26e22 Improved light sampling 2018-12-10 17:25:29 +01:00
luboslenco 023668221e Update shadowmap props 2018-12-10 00:02:40 +01:00
luboslenco 25ae41f9c3 Cleanup 2018-12-09 19:27:11 +01:00
luboslenco 835792f7fc Shader fixes 2018-12-07 13:48:40 +01:00
luboslenco 13bb02e337 Fast clear 2018-12-06 20:36:56 +01:00
luboslenco 93cc102bf5 Faster 2018-12-06 15:23:08 +01:00
luboslenco 0cc0915e44 Need for speed 2018-12-05 17:47:45 +01:00
luboslenco bf639496e9 Faster shadow sample 2018-11-29 23:43:33 +01:00
luboslenco 62b23aa2f0 Depth bind fixes 2018-11-28 10:26:48 +01:00
luboslenco 7075374c8f Use HLSL define 2018-11-27 21:44:56 +01:00
luboslenco 368a9a37b3 Fix ssrs 2018-11-23 18:03:27 +01:00
luboslenco 48ad43fd4e Forward clusters 2018-11-22 22:47:14 +01:00
luboslenco 7f261b4365 Save gbuffer slot 2018-11-22 18:07:32 +01:00
luboslenco 850dade8a5 Merge clustered rendeder - wip, unstable 2018-11-22 11:08:03 +01:00