Commit graph

166 commits

Author SHA1 Message Date
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
Moritz Brückner 24093d15df Fix writing to gl_Position before instancing code 2021-03-25 22:02:59 +01:00
N8n5h 72dde10fb0 Fix forward+single atlas failing to compile with just 1 light
This should fix an issue where the uniform for shadowMapAtlas used with the single atlas option was not added when having just 1 light.
2021-03-02 20:20:31 -03:00
Alexander Kleemann aec10274f4 Add option to ignore irradiance for baked environments 2021-02-20 15:30:18 +01:00
Alexander Kleemann f1858550d0 Blending fix
Fix for https://github.com/armory3d/armory/issues/1615
2021-02-20 13:51:25 +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
Moritz Brückner ac51183a15 Fix declaration order for some shader attributes 2020-11-12 20:11:42 +01:00
Moritz Brückner b49bd54901 Fix usage of normals in shaders 2020-11-12 20:09:25 +01:00
Moritz Brückner 13cf5d12a5 Check for uniqueness when adding init statements to shader main() (+ indent) 2020-10-08 23:08:37 +02:00
QuantumCoderQC 14a8d8698f Spoort for displacement in instanced objects 2020-09-08 00:26:44 +02:00
Moritz Brückner 9a47d77594 Implement receive shadow setting for mobile path + all light types 2020-07-13 23:20:58 +02:00
Lubos Lenco e30a8c7f46 Metal fixes 2020-05-11 09:03:13 +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
Lubos Lenco 967f69b24a Color attachment format 2020-05-06 18:11:02 +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 38451d7a9a Format 2019-05-01 21:27:19 +02:00
luboslenco 46a7e81f40 Textured emission fixes 2019-05-01 21:24:39 +02:00
luboslenco aa5c4f7e73 Link to embedded data 2019-04-26 11:12:09 +02:00
unknown 5240249982 Use voxelao instead of voxelgi, gi will be reworked into raytracing 2019-04-06 18:52:21 +02:00
unknown 27197cc94f Force gpu particles 2019-04-06 14:30:11 +02:00
luboslenco 5522955748 Mobile shader fix 2019-04-04 11:23:53 +02:00
luboslenco c7214e2aa7 Include tex data 2019-04-04 11:23:18 +02:00
luboslenco 9cd951819a Fix raytracer 2019-02-19 10:09:42 +01:00
luboslenco 97003c893f Match bias 2019-02-12 17:17:46 +01:00
luboslenco 24b2cc23cd Cube shadow fixes 2019-02-12 12:39:41 +01:00
luboslenco 92fa1b4fb3 No pow for vertex colors 2019-02-11 11:12:41 +01:00
Lubos Lenco 44c8cdb679 Fix legacy shaders flag 2019-02-10 20:37:38 +01:00
luboslenco a1da8b0824 Expose cone aperture 2019-02-09 15:34:16 +01:00
luboslenco cd7a25db37 Correct displace amount 2019-02-04 21:47:46 +01:00
luboslenco 7cff5f8642 More shader fixes 2019-02-01 17:33:22 +01:00
luboslenco 4df19ef970 Format 2019-01-30 17:45:54 +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 9be8646008 Fix translucency mixing 2019-01-27 15:01:39 +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 00602d721d Fix array 2019-01-23 13:54:16 +01:00
luboslenco 68b5e1bb3b Implement ssr for forward path 2019-01-23 13:45:58 +01:00
luboslenco c81d4949ca No need for material tilesheet flag 2019-01-22 12:38:47 +01:00
luboslenco 2eab2c1adb Shadow fixes 2019-01-09 21:25:09 +01:00
luboslenco b2db6b86da Restore vertex colors 2019-01-07 10:42:45 +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 975f995796 Faster and smaller vertex data 2018-12-14 15:27:43 +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