Commit graph

170 commits

Author SHA1 Message Date
Moritz Brückner ccc427c04a Cleanup 2021-05-27 22:57:53 +02:00
Lubos Lenco 98eeccd71d
Merge pull request #2082 from armory3d/blender2.9
Blender 2.9 LTS support
2021-05-10 11:14:39 +02:00
N8n5h ddc3da7799 Fix artifact with point light soft shadow in sm atlas 2021-04-26 16:45:20 -03:00
Moritz Brückner f64419dd06 Merge branch 'master' into blender2.9
# Conflicts:
#	blender/arm/material/shader.py
#	blender/arm/props_collision_filter_mask.py
#	blender/arm/props_ui.py
2021-04-03 14:12:54 +02:00
Moritz Brückner c5be90d0b0 Cleanup 2021-03-31 20:33:52 +02:00
Moritz Brückner 420033c86d Add API to set Nishita density parameters 2021-03-26 20:59:26 +01:00
Moritz Brückner 8d812548c4 Use 2D LUT for Nishita skies 2021-03-25 23:29:34 +01:00
N8n5h efcef7dd25 Fix shadow rendering for deferred and forward mobile 2021-03-14 22:04:47 -03:00
N8n5h 8e972f75fd Fix light visual artifact when close to the camera
This fixes a current problem with lights that occurs when getting too
close to the camera. The issue is related to the clustering algorithm
and cluster near.

Cluster near explanation:

Because of the logarithmic nature of how the Z slice is calculated,
clusters slices get "burned" too quickly at the start of the frustum,
which is not ideal. To aid this, and offset is applied to the start of
the cluster frustum, and that is clusterNear.

Cluster near solves that problem but creates another one: There is a gap
between the near plane and the cluster near offset that gets completely
ignored when calculating. And this results in the visual artifact of
slices not being affected by light whatsoever.

The proposed solution is make the gap resolve to the first slice of Z
clusters.
2021-03-13 13:30:19 -03:00
Moritz Brückner 5f55b00710 Begin with Nishita LUT implementation for better performance 2021-03-11 23:16:44 +01:00
N8n5h cf99e5a382 Fixed point lights breaking for Krom Windows with shadow map atlas
https://github.com/armory3d/armory/issues/2110#issuecomment-787913813
2021-03-01 18:39:32 -03:00
N8n5h 5f8b92f9c3 Applied flip workaround for point light too for html5 and atlas
The same concept for spot lights was applied for point lights;
the difference is that because point lights require to do the projection in the shader, the first inversion was applied in sampleCube() when returning the uv coordinates.
"_FlipY" was added to replace "_InvY" in "PCFFakeCube()" because the inversion is only necessary for shaders and not anything else, otherwise it would break rendering of other parts.
2021-03-01 18:39:32 -03:00
N8n5h c07de1cc25 Remove the inversion in shader of spot light uv for atlas
With the change in iron, there is no longer a need to do this in the shader.
2021-03-01 18:39:32 -03:00
Moritz Brückner 742b9ce1e1 Nishita sky: add support for ozone density 2021-02-22 18:52:56 +01:00
Moritz Brückner 28011bcc00 Nishita sky: add sun disk drawing 2021-02-13 18:23:37 +01:00
N8n5h c64b47548e Added support for direct3d-like texture coords uv for shadow atlases
See http://thedev-log.blogspot.com/2012/07/texture-coordinates-tutorial-opengl-and.html,
the "opengl coordinates" where inverted for proper support of direct3d texture coordinate system.
2021-02-10 21:03:10 -03: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 288ead64dc Nishita sky: implement air and dust density 2021-01-21 21:14:05 +01:00
Moritz Brückner 396e60574a Optimize Nishita sky shader 2021-01-21 20:36:03 +01:00
Moritz Brückner 22d3530863 Blender 2.9: Add Nishita sky model implementation 2021-01-21 16:12:32 +01:00
onelsonic a89e3923e7
Update math.glsl
fixing the float
2020-12-16 18:57:25 +01:00
Moritz Brückner dac91efeb1 Fix indentation (spaces -> tabs) 2020-07-13 23:36:49 +02:00
Moritz Brückner 3654d34997 Update more shaders for receive shadow option 2020-07-13 23:28:43 +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
N8n5h decf89305c Fix support for box/triplanar mapping
I modified the shader parser so that triplanar mapping of textures is supported.
Normals are supported.
Currently tested with Armory PBR and Principled BSDF.
2020-03-14 23:44:15 -03:00
Alexander 60f72e7e0e Merge in PPM
Redone and ready to be merged with Armory
2020-03-04 17:45:19 +01:00
luboslenco 1c4df223cc Add denoise shader 2019-12-02 14:34:56 +01: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 17a11473c5 Add packing helpers 2019-07-03 09:28:33 +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 9802016556 Cleanup 2019-05-19 15:23:56 +02:00
luboslenco 82235ef194 Fix resolve pass 2019-04-16 13:30:35 +02:00
luboslenco 9a9e433b35 Fix ltc uniforms 2019-04-10 22:08:45 +02:00
unknown 86b28c733b Code cleanup 2019-04-06 18:54:46 +02:00
unknown 5240249982 Use voxelao instead of voxelgi, gi will be reworked into raytracing 2019-04-06 18:52:21 +02:00
unknown 4ecec19ad3 Force gpu skinning 2019-04-06 14:13:38 +02:00
luboslenco fc2635e673 Calibrate area light 2019-02-27 21:31:21 +01:00
luboslenco 5942ee72ea Cleanup ltc 2019-02-26 23:35:00 +01:00
luboslenco 24b2cc23cd Cube shadow fixes 2019-02-12 12:39:41 +01:00
luboslenco a1da8b0824 Expose cone aperture 2019-02-09 15:34:16 +01:00
luboslenco c9a896845d Attenuate for area light 2019-02-07 21:33:27 +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