Commit Graph

536 Commits

Author SHA1 Message Date
31ee691fbf Implemented a very simple SSAO in GLES3. 2025-10-27 06:02:04 -07:00
0c7f013c55 Improve Environment color adjustments; specifically brightness and HDR 2D contrast.
This commit changes adjustments to behave as follows for all rendering configurations:

- Apply brightness to linear-encoded values, preventing contrast, saturation, and hue from being affected.
- Apply contrast to perceptually uniform (nonlinear sRGB-encoded) values, matching existing behavior when HDR 2D is disabled and producing optimal visual quality.
- Apply saturation with even color channel weights. This causes brightness of certain colors to change, but matches existing behavior when HDR 2D is disabled.

Adjustments are applied after glow and tonemapping to match existing behavior.
2025-10-23 11:08:49 -04:00
36b92128b1 Merge pull request #110671 from allenwp/environment-glow-consistent
Blend glow before tonemapping and change default to screen.
2025-10-14 21:29:43 -07:00
cafc012b05 Blend Environment glow before tonemapping and change default blend mode to screen.
Additionally, change the minimum `tonemap_white` parameter to `1.0`; users can increase `tonemap_exposure` for a similar effect to decreasing `tonemap_white` below `1.0`.

Co-authored-by: Hei <40064911+Lielay9@users.noreply.github.com>
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2025-10-10 12:08:08 -04:00
3a003b2d96 Ensure uv2_attrib(_input) is available when rendering lightmap. 2025-10-10 14:17:34 +11:00
cb164a38f2 Merge pull request #107384 from Kaleb-Reid/compat-directional-cull-mask
Implement DirectionalLight3D cull masks in Compatibility
2025-10-07 11:54:42 -05:00
79b1a6defc Implement DirectionalLight3D cull masks in Compatibility 2025-10-04 16:08:27 -07:00
c20ab940aa Apply sun scatter from lights with shadows in compatibility 2025-10-04 00:35:31 -07:00
8fef9a689e Implement motion vectors in compatibility renderer 2025-09-30 09:42:17 -05:00
dd8bab9f89 Fix shader compilation errors in Compatibility when using depth_texture
Globals were defined too early, which means some uniforms were not available
at the point they were defined in.
2025-09-04 00:33:45 +02:00
f766e401db [MSDF] Fix outline bleed out at small sizes. 2025-08-31 23:35:33 +03:00
6a3941b5d9 Fix MSDF outline size clamping. 2025-08-19 08:28:33 +03:00
86e61a311f Use MSDF instead of MTSDF for font rendering.
Co-authored-by: K. S. Ernest (iFire) Lee <ernest.lee@chibifire.com>
2025-08-09 10:41:16 +03:00
5dc25db6da Fix lightmap dynamic objects with physical lights 2025-07-17 20:58:03 -03:00
2096e4c007 Fix division by zero in clearcoat
Prevents the clearcoat model from generating NaN values at grazing angles
2025-07-08 01:58:37 +00:00
37b7f577ad Fix GLES3 stereo output (sRGB + lens distortion) 2025-06-20 10:45:03 +10:00
d503810654 OpenGL: Fix shader compilation failure with shadow_to_opacity and unshaded 2025-06-06 16:29:22 -05:00
bac9427325 Fix sky energy in fog sun scatter + colour space discrepancy in compatibility 2025-06-04 13:59:53 -07:00
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 -03:00
9828c365c3 Add support for bent normals for indirect lighting and specular occlusion 2025-05-12 12:52:04 +02:00
821170f054 Merge pull request #106145 from lander-vr/ambient-light-specular-occlusion
Add specular occlusion from ambient light
2025-05-09 11:29:14 -05:00
56730d0cb2 Add specular occlusion from ambient light
Co-authored-by: guerro323 <kaltobattle@gmail.com>
2025-05-08 23:52:01 +02:00
909f9ca9d4 Compatibility: Disable environment ambient light when affected by light probes 2025-05-07 18:08:54 +02:00
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 +02:00
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
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 -05:00
5640ddd0a5 Scene shader: Improve and document SH evaluation for light probes 2025-04-19 15:08:02 +02:00
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
8714b36171 Fix rendering material when UV2 is compressed 2025-02-06 20:24:46 +01:00
964cd6525e Fix: Mass property particle shader error 2025-01-28 21:00:26 -05:00
0d4696b472 Merge pull request #101515 from allenwp/agx-negative-optimizations
Optimize AgX tonemapper's handling of negative values
2025-01-20 10:05:38 -06:00
dcf4996276 Merge pull request #101159 from brandon515/compatibility_particle_shader_fix
Fix inverted `GPUParticlesCollisionHeightField3D` in compatibility renderer.
2025-01-20 10:05:24 -06:00
990612040a Implemented fix from #91219 in compatibility renderer by reversing the z
axis in the particle shader.
2025-01-18 13:32:10 -05:00
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 -05:00
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 -05:00
e4a12a0299 Merge pull request #101365 from Calinou/agx-compatibility-use-rd-approach
Fix AgX tonemapping using old approach in Compatibility rendering method
2025-01-10 23:06:19 +01:00
5ebafc350f Fix AgX tonemapping using old approach in Compatibility rendering method
Its implementation now matches the one used in RenderingDevice-based
rendering methods.
2025-01-09 20:58:23 +01:00
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 +01:00
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 +01:00
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
1536e0e236 Merge pull request #100441 from StaydMcMuffin/scene-shaders-tbn-fixes
Scene Shaders - TBN Vector Fixes
2024-12-19 19:59:58 -06:00
2fcd8223e8 Merge pull request #99538 from Geometror/lightmap-gi-transparent-surface
Add transparency support for LightmapGI
2024-12-19 19:59:52 -06:00
d3e5b62ea2 Merge pull request #99230 from paddy-exe/instance_uniforms_compatability_renderer
Implement 2D instance uniforms
2024-12-19 19:59:37 -06:00
a3525bc015 Add transparency support for LightmapGI
Co-authored-by: Guerro323 <kaltobattle@gmail.com>
2024-12-18 19:36:16 +01:00
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 +01:00
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
e42def12d0 Implement per-light Specular property in DirectionalLight3D 2024-12-16 19:18:18 +01:00
736dcf72cc Merge pull request #100125 from alessand10/uniform-variable-fix
Move uniform variables up in the `gles3/scene.glsl` template so that they are available within the `#GLOBALS` scope
2024-12-14 18:25:38 +01:00
356fa37f89 Small fixups for the new reflection probe blending 2024-12-12 17:29:21 -08:00
7c015a768f Merge pull request #99958 from lander-vr/reflection-probe-blend-property
Add Blend Distance property to ReflectionProbe
2024-12-12 16:13:32 -06:00