Commit Graph

633 Commits (cb1569345a6f17da08241e645ab03cb2e1b78d2f)

Author SHA1 Message Date
clayjohn b4adaa291a Fix a few improper memory accesses in the clustered forward vertex shader
draw_call.instance_index should not be used directly since it doesn't take into account auto-batching

scene_data_block.data should not be used directly in the vertex shader since it can change between frames and impact motion vector generation

IN_SHADOW_PASS can only be accessed inside functions, so it needs to be a global and not a constant
2025-06-22 23:41:03 +07:00
LuoZhihao 8a2fd98004 Forward+: Fix builtins in light shader 2025-06-17 20:14:53 +07:00
Rémi Verschelde 9eda3c682d
Merge pull request #107404 from beicause/mobile-spatial-light-shader-builtins
Vulkan Mobile: Fix reading builtins in `light()` of spatial shader
2025-06-12 22:48:58 +07:00
Dario 8804c88443 Change all interpolators to FP32 in mobile renderer. 2025-06-11 15:36:22 +07:00
LuoZhihao 2a1d2afaca Vulkan Mobile: Fix reading builtins in `light()` of spatial shader 2025-06-11 21:32:59 +07:00
Rémi Verschelde a1ef1130ad
Merge pull request #107364 from DarioSamo/adreno-fix-interpolators
Upgrade normal interpolators to FP32 to fix Adreno.
2025-06-10 17:56:29 +07:00
Dario e53b67df03 Upgrade normal interpolators to FP32 to fix Adreno. 2025-06-10 12:26:58 +07:00
David Snopek 951ca21f02 Vulkan Mobile: Fix crash from shader compilation with `USE_RADIANCE_CUBEMAP_ARRAY` 2025-06-10 09:19:32 +07:00
Dario 46277836a6 Optimize Mobile renderer by using FP16 explicitly. 2025-06-09 14:39:35 +07:00
SaracenOne 761d5474dc Shader compilation fix:
Fix shader compilation crash on custom shaders
using VIEW_INDEX on Vulkan Clustered Forward
renderer.
2025-06-08 03:29:47 +07:00
Rémi Verschelde 26df04377e
Merge pull request #107210 from dsnopek/vulkan-mobile-fix-missing-view-index
Fix crash when using `VIEW_INDEX` in shader with Vulkan mobile renderer
2025-06-06 17:38:23 +07:00
Rémi Verschelde e6d0b32566
Merge pull request #106673 from retrotails/master
Fix light range in VoxelGI
2025-06-06 17:37:09 +07:00
David Snopek 56c2ce00d6 Fix crash when using `VIEW_INDEX` in shader with Vulkan mobile renderer 2025-06-06 07:03:35 +07:00
Rémi Verschelde 1e9200d065
Merge pull request #107099 from Kaleb-Reid/fix-sun-scatter
Increase directional light energy in sky for fog sun scatter
2025-06-05 13:13:40 +07:00
Kaleb Reid bac9427325 Fix sky energy in fog sun scatter + colour space discrepancy in compatibility 2025-06-04 13:59:53 +07:00
devloglogan 3b70fbdc3c Implement motion vectors in mobile renderer 2025-05-30 13:09:54 +07:00
Thaddeus Crews de37627404
Merge pull request #102552 from DarioSamo/shader-baker
Add shader baker to project exporter.
2025-05-28 17:09:38 +07:00
Thaddeus Crews 7830c5fadc
Merge pull request #106844 from LiveTrower/dfg-reconstruction
Fix missing ibl reconstruction from DFG multiscattering
2025-05-28 09:47:41 +07:00
Dario 5a30a7e7cd Add shader baker to project exporter.
Metal Support contributed by Migeran (https://migeran.com) and Stuart Carnie.

Co-authored-by: Stuart Carnie <stuart.carnie@gmail.com>
Co-authored-by: Gergely Kis <gergely.kis@migeran.com>
2025-05-27 12:45:27 +07:00
Thaddeus Crews e89c4b0f9f
Merge pull request #102330 from RGDTAB/add_partial_smaa
Add SMAA 1x to screenspace AA options
2025-05-26 11:24:35 +07:00
Alfonso Grimaldo e1e1933244
fix missing ibl reconstruction from dfg multiscattering 2025-05-24 20:10:02 +07:00
Raymond DiDonato 6b99608950 Add SMAA 1x 2025-05-21 15:02:09 +07:00
clayjohn 9a1def8da1 Add new StandardMaterial properties to allow users to control FPS-style objects (hands, weapons, tools close to the camera)
Add new shader built in Z_CLIP_SCALE to easily adjust clipping distance to avoid clipping walls etc.

Add fov_override to StandardMaterial3D to easily have a custom FOV for FPS objects

Add IN_SHADOW_PASS built-in to shaders for tweaking materials without impacting shadow maps
2025-05-21 10:16:05 +07:00
retrotails ba06234309 Fix light range in voxel GI 2025-05-21 06:49:35 +07:00
Dario ff3ababb09 Reduce amount of permutations in mobile shader. 2025-05-16 12:40:21 +07:00
Dario 499fff51fb Rewrite textureProjLod usage to avoid a Vulkan validation error. 2025-05-15 11:35:34 +07:00
Thaddeus Crews d0693d6867
Merge pull request #89988 from LunaCapra/specular-occlusion
Add support for bent normal maps for specular occlusion and indirect lighting
2025-05-14 09:44:06 +07:00
landervr be01c7f5a4 fix reflection probe box projection stretching 2025-05-14 00:02:06 +07:00
Capry 9828c365c3 Add support for bent normals for indirect lighting and specular occlusion 2025-05-12 12:52:04 +07:00
Thaddeus Crews 19bb18716e
Merge pull request #102399 from clayjohn/cull-mask-overhaul
Overhaul the cull mask internals for Lights, Decals, and Particle Colliders
2025-05-09 11:29:28 +07:00
Thaddeus Crews dda0562f2f
Merge pull request #103934 from LiveTrower/dfg-lut
Forward+: Replace the current BRDF approximation with a DFG LUT and add multiscattering energy compensation
2025-05-09 11:29:16 +07:00
clayjohn 305216f558 Overhaul the cull mask internals for Lights, Decals, and Particle Colliders
Properly pair and unpair instances based on cull mask to avoid any unnecessary processing and to ensure that changing the cull_mask and layer_mask actually updates culling behavior
2025-05-08 21:39:12 +07:00
landervr 56730d0cb2 Add specular occlusion from ambient light
Co-authored-by: guerro323 <kaltobattle@gmail.com>
2025-05-08 23:52:01 +07:00
LiveTrower 44408eabaa Replace BRDF approximation with a DFG LUT 2025-05-08 10:23:35 +07:00
dsmtE 4e68f277c6 add REGION_RECT
fix formatting

fix shader compile (region_rect after draw_data)

fix formatting

fix formatting

Review fix (move region_rect in main + remove useless visual shader options)

fix formatting

fix alphabetic order (+ remove useless action for spatial shaders)

typo + remove TYPE_LIGHT option for  region_rect
2025-04-30 11:07:22 +07:00
landervr e3dbf74634 Fix reflection probe dark borders 2025-04-29 17:18:52 +07:00
clayjohn d2dce41681 Fix float/int comparison in acos_approx in sky template shader
Strict GLSL implementations will not automatically convert `0` to a float
2025-04-27 17:06:34 +07:00
mrjustaguy bc746f2962 Implement FXAA 3.11 2025-04-22 22:19:06 +07:00
Thaddeus Crews 1f7a8eac9d
Merge pull request #101973 from clayjohn/sky-material-opt
Optimize ProceduralSkyMaterial by removing uses of acos and simplifying logic
2025-04-22 18:25:51 +07:00
BlueCube3310 5640ddd0a5 Scene shader: Improve and document SH evaluation for light probes 2025-04-19 15:08:02 +07:00
clayjohn 6fede0b951 Optimize SkyMaterials by removing uses of acos and simplifying logic
The results looks almost the same and run much faster.
2025-04-17 22:50:11 +07:00
Thaddeus Crews 4d5f455cf7
Merge pull request #105037 from clayjohn/RD-instance-index-crash
Avoid using a global variable to store instance index in canvas items shader in RD renderer
2025-04-07 08:43:27 +07:00
Thaddeus Crews 5edb235018
CI: Bump various pre-commit hooks 2025-04-07 08:23:35 +07:00
clayjohn bef26b8861 Avoid using a global variable to store instance index in canvas items shader in RD renderer 2025-04-04 16:32:15 +07:00
Rémi Verschelde 408d07109b
Merge pull request #99551 from DarioSamo/fragment-density-map
Implement Fragment density map support.
2025-03-28 14:31:19 +07:00
Dario 76d709be74 Implement support for fragment density maps.
Co-Authored-By: Bastiaan Olij <mux213@gmail.com>
2025-03-24 11:50:04 +07:00
Stuart Carnie b3694662a2 2D: Fix light shader accessing TEXTURE_PIXEL_SIZE 2025-03-06 05:30:20 +07:00
yesfish 93bc18f2b0 Fix 2D instance params crashing using outside of main() 2025-02-27 22:10:56 +07:00
Rémi Verschelde 0bccb0abd1 Merge pull request #102497 from BlueCube3310/mesh-uv-render-compressed-fix
Fix rendering material when UV2 is compressed
2025-02-07 01:40:02 +07:00
Rémi Verschelde 46aeded4b7 Merge pull request #102480 from DarioSamo/dont-unroll-ubershader
Add loop annotations to ubershaders to prevent loop unrolling.
2025-02-07 01:39:48 +07:00
Rémi Verschelde c695eb9159 Merge pull request #101952 from Flarkk/fix_spotlight_peterpanning_regression
Fix shadow peter-panning with default spotlight
2025-02-07 01:39:15 +07:00
BlueCube3310 8714b36171 Fix rendering material when UV2 is compressed 2025-02-06 20:24:46 +07:00
Dario d39ac94c41 Add loop annotations to ubershaders to prevent loop unrolling. 2025-02-06 09:39:18 +07:00
clayjohn 6611c863bd Use a smaller epsilon for omni and spot attenuation cutoff
We just want to avoid calculating shadows when the attenuation is zero, so we should use the smallest epsilon we can get away with
2025-01-31 17:08:23 +07:00
MathdudeMan 964cd6525e Fix: Mass property particle shader error 2025-01-28 21:00:26 +07:00
Thaddeus Crews 5ac6bce58d
Merge pull request #102105 from clayjohn/SDFGI-unflip-normal
Avoid flipping normal based on facing direction when calculating SDF
2025-01-28 09:03:34 +07:00
clayjohn a525e30c27 Avoid flipping normal based on facing direction when calculation SDF. This shader runs for multiple directions, so the flip direction won't be accurate and just creates bad normals 2025-01-27 16:48:29 +07:00
Florent Guiocheau d08ff57148 Fix peter-panning with default spotlight 2025-01-22 17:05:04 +07:00
Allen Pestaluky c5cf73a2e7 Optimize AgX tonemapper's handling of negative values
This change improves performance of the AgX tonemapper by allowing two matrix multiplications to be combined into one. This comes at the cost of loss of color information that could be correctly interpreted as positive RGB values in the Rec. 2020 color space. Additionally, an insignificant amount of error is intentionally introduced to the input color value to prevent the need for a second max function call before log2. The final negative color clipping has been removed to allow the tonemapper to return negative RGB values, similar to other tonemappers in Godot.
2025-01-13 17:35:35 +07:00
Allen Pestaluky 77ddaaaa91 Fix AgX sigmoid contrast curve approximation
This changes the polynomial function so that a lower input always results in a lower output and vice-versa. Additionally, the new function returns a value that is much closer to 1.0 when given an input of 1.0.
2025-01-10 18:17:38 +07:00
Rémi Verschelde 03c83cea1e Style: Enable clang-format's `InsertBraces` config
This was part of our style guide since we started using clang-format
but the feature was only added in clang-format 15, and we hadn't
noticed it yet.
2025-01-09 16:46:51 +07:00
Rémi Verschelde 21721ae344 Merge pull request #87260 from Calinou/tonemap-add-agx
Add AgX tonemapper option to Environment
2025-01-08 18:20:03 +07:00
Hugo Locurcio 084e84be78
Add AgX tonemapper option to Environment
Technical implementation notes:

- Moved linearization step to before the outset matrix is applied and
  changed polynomial contrast curve approximation.
  - This does *not* implement Blender's chroma rotation to address hue shift.
    This hue rotation was found to have a significant performance impact.
- Improved performance by combining the AgX outset matrix with the Rec 2020 matrix.

Co-authored-by: Allen Pestaluky <allenpestaluky@gmail.com>
Co-authored-by: Clay John <claynjohn@gmail.com>
2025-01-08 17:01:16 +07:00
Aarni Koskela f134769506 Fix various typos
* Add TODO notes for typos that should be fixed for 5.0

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2025-01-08 14:47:42 +07:00
Rémi Verschelde 084da581be
Merge pull request #100241 from lander-vr/reflection-probe-priority
Add priority-based blending to reflection probes.
2025-01-07 10:14:38 +07:00
Stuart Carnie 11dc4f2e5e Metal: Add MetalFX upscaling support
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2025-01-06 06:03:18 +07:00
Stayd 40f17127ef Fix User-supplied Normals Being Ignored
Moves the initialization of the geo_normal value
to after the user shader code, so that the normal
supplied by the user is actually used instead of
the interpolated vertex normal.
2024-12-27 13:01:20 +07:00
landervr 1637736c20 ReflectionProbe priority 2024-12-23 21:58:11 +07:00
Thaddeus Crews 1536e0e236
Merge pull request #100441 from StaydMcMuffin/scene-shaders-tbn-fixes
Scene Shaders - TBN Vector Fixes
2024-12-19 19:59:58 +07:00
Thaddeus Crews 2fcd8223e8
Merge pull request #99538 from Geometror/lightmap-gi-transparent-surface
Add transparency support for LightmapGI
2024-12-19 19:59:52 +07:00
Thaddeus Crews 4665faaaa9
Merge pull request #100427 from Namey5/fog-sky-luminance
Separate sky luminance and brightness calculations for consistent fog
2024-12-19 19:59:50 +07:00
Thaddeus Crews 41b468f961
Merge pull request #100544 from Namey5/sdfgi-sky-rotation
Support custom sky rotation in SDFGI
2024-12-19 19:59:46 +07:00
Thaddeus Crews d3e5b62ea2
Merge pull request #99230 from paddy-exe/instance_uniforms_compatability_renderer
Implement 2D instance uniforms
2024-12-19 19:59:37 +07:00
Alex Threlfo e4fd2f003f Support custom sky rotation in SDFGI 2024-12-20 11:26:28 +07:00
Alex Threlfo 5f617663aa fix: separate sky luminance and user brightness calculations around fog 2024-12-20 11:25:11 +07:00
Hendrik Brucker a3525bc015 Add transparency support for LightmapGI
Co-authored-by: Guerro323 <kaltobattle@gmail.com>
2024-12-18 19:36:16 +07:00
kobewi ceefc0d38a Implement 2D instance shader parameters
Co-authored-by: kobewi <kobewi4e@gmail.com>
Co-authored-by: yesfish <huwpascoe@users.noreply.github.com>
Co-authored-by: Álex Román Núñez <eirexe123@gmail.com>
2024-12-17 23:59:16 +07:00
Rémi Verschelde 190ae9f9dc
Merge pull request #100302 from clayjohn/light2d-optimize
Optimize PointLight2D shadow rendering by reducing draw calls and RD state changes
2024-12-17 22:59:54 +07:00
clayjohn 7c61252dd7 Optimize PointLight2D shadow rendering by reducing draw calls and RD state changes.
This dramatically reduces the CPU time spent on rendering shadows for PointLight2Ds
2024-12-17 07:41:09 +07:00
Stayd ed0e3d7da8 Scene Shaders - TBN Fixes
Fixes two errors related to the normal, tangent,
and bitangent vectors, namely normals not always
being inverted on backfaces, and normalization
being reversed from what MikkTSpace expects.
2024-12-16 22:36:23 +07:00
Andrew_Shobbrook e42def12d0
Implement per-light Specular property in DirectionalLight3D 2024-12-16 19:18:18 +07:00
clayjohn 356fa37f89 Small fixups for the new reflection probe blending 2024-12-12 17:29:21 +07:00
Thaddeus Crews 7c015a768f
Merge pull request #99958 from lander-vr/reflection-probe-blend-property
Add Blend Distance property to ReflectionProbe
2024-12-12 16:13:32 +07:00
Rémi Verschelde 562dd1ad85
Merge pull request #100305 from clayjohn/directional-light-2d-mask
Remove positional light mask from directional lights in Canvas Item shaders.
2024-12-12 14:10:24 +07:00
BlueCube3310 189c8eb671 Implement shadowmasks for LightmapGI
Co-authored-by: dearthdev <nathandearthdev@gmail.com>
2024-12-12 11:00:28 +07:00
clayjohn f8827271d7 Remove positional light mask from directional lights in Canvas Item shaders. 2024-12-12 00:20:07 +07:00
Thaddeus Crews 25122e7dd3
Merge pull request #100081 from clayjohn/rd-clearcoat
Ensure schlick is available when using clearcoat with GGX
2024-12-10 14:16:07 +07:00
clayjohn 9320865796 Avoid calculating dynamic lights when lights are baked into LightmapGI using the static bake mode 2024-12-06 10:17:44 +07:00
clayjohn f92018288f Ensure schlick is available when using clearcoat with GGX 2024-12-05 19:11:03 +07:00
landervr 05010180ce ReflectionProbe add Blend Distance 2024-12-05 23:29:47 +07:00
Thaddeus Crews 637239e979
Merge pull request #94193 from BastiaanOlij/buildin_includes
Add ability to include built-in include files
2024-12-05 14:12:23 +07:00
Thaddeus Crews f5d82af1fd
Merge pull request #99136 from DarioSamo/light-compute-attenuation-skip
Improve performance of shader lighting code in Forward renderers.
2024-12-05 14:12:08 +07:00
Thaddeus Crews a4c2e16c19
Merge pull request #100028 from clayjohn/rd-lights-array
Use a vector instead of an array in canvas shader instance buffer
2024-12-05 14:12:05 +07:00
clayjohn e316739a13 Use a vector instead of an array in canvas shader instance buffer.
This avoids a pathological performance cliff on Adreno devices
2024-12-04 16:36:46 +07:00
Dario fa7615be9e Add specialization for directional light split blend and fog. 2024-12-03 15:12:46 +07:00
Thaddeus Crews c58ae91efa
Merge pull request #99220 from Flarkk/fix_sss_reverse_z
Fix regression in SSS with reverse-z
2024-11-27 10:46:56 +07:00
Dario 0ce4c6dac3 Improve performance of shader lighting code in Forward renderers.
- Skip sampling shadows if attenuation is very small.
- Skip computing diffuse and specular light if attenuation and shadow are very small.
2024-11-27 12:20:31 +07:00
Florent Guiocheau 3376b9166b Fix SSS with reverse-z 2024-11-26 10:51:22 +07:00
Bastiaan Olij 1bffefb346 Adding ability to include build-in include files (precursor to custom shader templates) 2024-11-24 08:47:45 +07:00
Thaddeus Crews dcb59f0e7e Merge pull request #99548 from Repiteo/style/clang-format-19-options
Style: Add 19.1.0 LLVM options to `.clang-format`
2024-11-22 14:54:29 +07:00