Commit graph

50 commits

Author SHA1 Message Date
QuantumCoderQC 0636eb85c6 add morph attribute to shaders 2021-11-02 13:42:06 +01:00
Moritz Brückner c56a0c3a72 Fix accidental module reloading caused by name conflicts of global vars 2021-08-11 14:32:21 +02:00
Moritz Brückner ea8c13686c Implement basic addon reloading 2021-08-04 22:56:11 +02:00
QuantumCoderQC 5a591fa15a set default vector and float parameter 2021-06-24 18:13:13 +02: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 05c14238f2 shader.py: add API to set texture params 2021-03-25 23:03:08 +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
N8n5h 3ef380978e Make sure compiled.inc is always first when parsing shaders for clusters 2021-02-14 20:21:51 -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 a1b121a2a7 Add per-material custom UI for drivers 2020-11-17 18:54:53 +01:00
Moritz Brückner 6165c43321 Properly indent shader code in write_attrib() 2020-11-12 20:10:08 +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
Moritz Brückner cd63597fad Add ParserState class for better handling of cycles.py state 2020-10-05 20:42:59 +02:00
Moritz Brückner da8fca1b3b Move node parsing into subpackages part 1 2020-10-05 01:36:33 +02:00
Moritz Brückner 8d8526a389 Shader export: don't add duplicate ins/out/includes 2020-08-19 17:12:58 +02:00
Moritz Brückner 32613312b3 Add newline after shader functions 2020-06-28 20:26:05 +02:00
Moritz Brückner 620cb1f26e Custom shader names in shader make functions 2020-06-28 20:06:38 +02:00
luboslenco b0cd02d68e Allow multiple color attachment formats 2020-05-10 10:46:12 +02:00
Lubos Lenco 967f69b24a Color attachment format 2020-05-06 18:11:02 +02:00
Moritz Brückner 1e4d94a77e Fix docstring 2020-04-18 22:18:38 +02:00
Moritz Brückner 146c890349 New Shader.add_const() method to add global constants 2020-04-18 21:26:45 +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
unknown 5b2b6428d5 Use per-target color mask 2019-04-06 13:03:04 +02:00
Lubos Lenco 44c8cdb679 Fix legacy shaders flag 2019-02-10 20:37:38 +01:00
luboslenco a531b52b9f UI style 2018-12-19 13:33:17 +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 687f4e71ce Voxel ao for hlsl 2018-12-04 19:06:01 +01:00
luboslenco 9f241a89b5 Armory now takes Image node - Color Space into account 2018-11-13 16:51:19 +01:00
unknown a27adbf42e Runtime shader gen 2018-10-26 19:45:07 +02:00
luboslenco 5278226b4c More shader write fixes 2018-03-27 10:10:12 +02:00
luboslenco 310511bbf4 Fix shader.contains 2018-03-26 19:45:15 +02:00
luboslenco 3e5fff8d9d Writing shader attribs 2018-03-26 18:15:02 +02:00
luboslenco df96e7d663 Pre-fetch shader textures 2018-03-26 18:04:11 +02:00
Lubos Lenco 42b4185187 Reduce shader count 2017-12-20 15:37:58 +01:00
Lubos Lenco 42242b835d Python clean up 2017-11-20 14:32:36 +01:00
Lubos Lenco f87bee5bc8 Shader compiler fixes 2017-11-10 15:18:44 +01:00
Lubos Lenco 8ab1b45dbb Fix Mapping node for normals 2017-10-30 18:37:45 +01:00
Lubos Lenco 7befa00fb6 Begin fast voxels for maxwell 2017-10-26 22:13:21 +02:00
Lubos Lenco 21c89b3eec Faster voxels 2017-10-23 16:24:57 +02:00
Lubos Lenco 9d0e83b3ce Shader compilation fixes 2017-10-06 19:44:10 +02:00
Lubos Lenco 70c30c308f Improve restricted materials 2017-09-09 13:46:32 +02:00
Lubos Lenco 4a992ebd19 Atomic ops for voxels 2017-08-03 14:01:04 +02:00
Lubos Lenco 9d9f39aeb4 New material bind system 2017-05-25 16:48:41 +02:00
Lubos Lenco 56190c05f2 More VR, restricted materials gen 2017-04-26 14:21:22 +02:00
Lubos Lenco 46223379c5 Use floats 2017-04-12 13:25:09 +02:00
Lubos Lenco 44f257f6ba Deferred+ renderer 2017-03-28 14:30:51 +02:00
Lubos Lenco 140e69fde8 Fix wpos write 2017-03-23 12:01:25 +01:00
Lubos Lenco d7be94d6e1 Merge logic nodes 2017-03-21 03:06:38 +01:00
Lubos Lenco 0fc938911c Move py sources to arm package 2017-03-15 12:30:14 +01:00
Renamed from blender/armmaterial/shader.py (Browse further)