Commit Graph

633 Commits (cb1569345a6f17da08241e645ab03cb2e1b78d2f)

Author SHA1 Message Date
Rémi Verschelde 139cf025c9
Merge pull request #94629 from RandomShaper/fix_undef_position
Fix position from vertex shader partially uninitialized
2024-07-24 09:59:24 +07:00
Pedro J. Estébanez 0064532c1e Fix position from vertex shader partially uninitialized 2024-07-23 09:04:54 +07:00
Rémi Verschelde 587f1d0cb0
Merge pull request #92817 from Alex2782/fix_glsl_Mali-G
Fix glsl shader for Android Mali-GXXx GPUs and Vulkan API 1.3.xxx
2024-07-22 17:24:04 +07:00
Alexander Hartmann 78ede4f8b6 Fix glsl shader for Android Mali-GXXx GPUs and Vulkan API 1.3.xxx 2024-07-20 22:01:35 +07:00
Rémi Verschelde c5e5fa3d9f
Merge pull request #94289 from clayjohn/MOBILE-multimesh-spec-constant
Use a spec constant to control whether the MultiMesh branch is used in the vertex shader.
2024-07-17 12:24:01 +07:00
Rémi Verschelde c2375d0b12
Merge pull request #94184 from mertkasar/ssr-rotation-fix
Fix SSR orientation issues when using orthogonal camera
2024-07-17 11:43:25 +07:00
clayjohn 4cbc967f50 Use a spec constant to control whether the MultiMesh branch is used in the vertex shader.
This works around a bug on the Quest3 and slightly improves performance on all mobile devices at the cost of increased pipeline count.
2024-07-12 15:44:06 +07:00
Mert Kasar 56ed2cb6d1 Fix SSR orientation issues when using orthogonal camera
- Use negative clip space values to fix reversed rotations in reflections
- Use constant -z view vector when raymarching to fix perspective in reflections
2024-07-12 21:56:31 +07:00
clayjohn e0f736ec10 Properly linearize depth buffer for SSAO when using orthogonal camera 2024-07-09 15:29:45 +07:00
ueshita e1d6ab4c80 Fix userdata not copied when trails started 2024-06-25 23:33:26 +07:00
clayjohn d61fae36f3 Various fixes for transmittance effect
Use correct shadow sampling for omni and spot lights

Disable transmittance if shadows are disabled

Correct DirectionalLight transmittance bias to match shadow bias (its still pretty sensitive though)
2024-06-21 18:15:27 +07:00
Stuart Carnie 98e9578d66
Remove unused flag and code
Related #48894
2024-06-20 13:50:20 +07:00
Rudolph Bester f666c76a9c Fixed collided 3D GPU particles sometimes jittering 2024-05-28 14:09:08 +07:00
clayjohn 6fbef0669d Disable all sources of ambient light when `ambient_light_disabled` render mode is used 2024-05-21 10:42:12 +07:00
Rémi Verschelde 7d03b1de0b
Style: Trim trailing whitespace and ensure newline at EOF
Found by apply the file_format checks again via #91597.
2024-05-08 10:12:46 +07:00
Rémi Verschelde 4b070e8031
Fix various typos with codespell
Using 2.2.7.dev217+g10c2abcf.

Had to add `colour` to the ignore list as we used it as an alias/keyword for the
documentation of color-related APIs.
Also ignore recommendations to change `thirdparty` to either `third-party` or
`third party`, which are correct but we use the former fairly consistently.
2024-05-07 10:08:42 +07:00
Bastiaan Olij 9042ddf19f Improvements to VRS/Foveated rendering 2024-05-03 17:20:30 +07:00
QbieShay e41064388e reverted naming to premul alpha (no T)
Initially 3d had premulT alpha as a keyword.
Since Canvas item uses mixed premul and premult as keywords,
3D is changed as well to keep consistency with 2D.
Unfortunately this keeps inconsistency with the internal ENUM.
2024-05-01 22:24:49 +07:00
QbieShay 41a2b0e83e Added premult alpha blending to 3D (spatial) shaders.
Co-authored-by: jitspoe <jitspoe@yahoo.com>
Co-authored-by: Clay John <claynjohn@gmail.com>
2024-05-01 00:53:29 +07:00
Chris Clyne 1ca0eeac28 Fix inverted GPUParticlesCollisionHeightField3D 2024-04-26 17:30:50 +07:00
Bastiaan Olij d2d22748b4 Fix issue in shadow to opacity 2024-04-26 21:54:26 +07:00
Rémi Verschelde 853740e2ad
Merge pull request #91191 from clayjohn/RD-soft-shadows
Properly calculate penumbra for soft shadows with reverse z
2024-04-26 11:09:02 +07:00
Rémi Verschelde 22c8a2785d
Merge pull request #90920 from clayjohn/2D-light-cull
Exit light calculation early when pixel outside of light bounding rectangle
2024-04-26 11:08:29 +07:00
clayjohn 4e5e81c7d4 Properly calculate penumbra for soft shadows with reverse z
Also fix a related bug where the DirectionalLight3D size was ignored unless a positional light with soft shadows touched the mesh
2024-04-25 17:06:49 +07:00
Rob Blanckaert ffe0b869f5 Add LIGHT_VERTEX to fragment shader
Adds a new variable to the fragment shader to specify
the vertex position used when calculating lighting.
2024-04-25 06:56:02 +07:00
Bastiaan Olij 226ca2f04c Fix issue with copy shader not working in multiview 2024-04-23 21:46:39 +07:00
clayjohn 506e93a207 Exit light calculation early when pixel outside of light bounding rectangle
This hugely improves the performance of rendering PointLight2Ds
2024-04-19 16:10:11 +07:00
clayjohn adfc9ccc44 Use a src rect for copying from screen with CanvasGroup in the mobile backend 2024-04-17 15:19:20 +07:00
Khasehemwy d950f5f838
Use Reverse Z for the depth buffer 2024-04-04 13:54:15 +07:00
Bastiaan Olij df8ff797b7 Consistantly use USE_MULTIVIEW as the define in shaders 2024-03-11 14:40:00 +07:00
Eidolon 08f4560e69 Add optional depth fog 2024-02-17 22:39:34 +07:00
Erik Johnson eab95698cd
Fix shadows for billboarded Sprite3D's 2024-02-13 10:36:38 +07:00
Rémi Verschelde 4a30fe5e7c
Merge pull request #86564 from Giwayume/feature/canvas-item-shader-custom-data
Support CUSTOM shader attributes in 2D
2024-02-08 10:53:24 +07:00
Yuri Sizov 1b83e8ae81 Merge pull request #87460 from BastiaanOlij/stereo_ivec
Add ivec variants to multiview_uv for stereo rendering
2024-01-25 16:27:10 +07:00
Giwayume bb83c4adec Add custom shader attributes to Canvas Item Shaders 2024-01-23 14:36:39 +07:00
Bastiaan Olij 1066f01607 Add ivec variants to multiview_uv for stereo rendering 2024-01-23 16:13:31 +07:00
kleonc 0fe7eead02 Fix 2D normals for transposed texture 2024-01-15 17:34:29 +07:00
Bastiaan Olij 10a8b88165 Fix SSR not working properly in stereo 2024-01-09 23:19:57 +07:00
Dario cc4d39b0c1 Acyclic Command Graph for RenderingDevice.
Adds a new system to automatically reorder commands, perform layout transitions and insert synchronization barriers based on the commands issued to RenderingDevice.
2024-01-08 14:54:56 +07:00
clayjohn 7f1863f83d Tune TAA disocclusion scale to avoid rejecting all samples during motion. 2024-01-04 17:06:57 +07:00
Rémi Verschelde 7abaac631b
Fixup SDFGI shader compilation error after #80390
My mistake, I added this when rebasing and didn't notice that it was a
.glsl file and thus the availability of Math was not confirmed by the
C++ compiler.
2024-01-03 08:51:08 +07:00
EddieBreeg 8747c67d9e
Fix potential integer underflow in rounded up divisions
A new `Math::division_round_up()` function was added, allowing for easy
and correct computation of integer divisions when the result needs to
be rounded up.

Fixes #80358.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2024-01-02 14:14:47 +07:00
clayjohn 43cf21cb71 Use best fit normals for storing screen space normals 2023-12-21 14:41:29 +07:00
Yuri Sizov c1d8b53ca0 Merge pull request #82668 from mrjustaguy/master
Improve split blending logic for Vulkan
2023-12-18 18:17:36 +07:00
clayjohn a5399ab5af Reduce the number of samplers used by the scene shaders
The hard limit for Apple devices is 16 samplers per stage. So we need to ensure we use less than that
2023-12-15 17:13:44 +07:00
clayjohn 2b9e6d2972 Use render pass uniform set to store viewport samplers.
This fixes a bugs where per-viewport samplers were being used for internal texture fetches (probes, sky, etc.).

This also fixes a bug when using multiple viewports in the same scene.

This also fixes a bug where the texture bias would override the bias from 3D scale.
2023-11-08 23:26:08 +07:00
Bastiaan Olij e3b8af723e Fix cubemap downsampler logic 2023-10-31 10:36:42 +07:00
clayjohn 57ba7ded87 Fix bug with alpha to coverage by enabling depth discard when using alpha to coverage 2023-10-30 23:07:30 +07:00
Rémi Verschelde 09b92a144d
Merge pull request #79921 from mandryskowski/ssr_transparency
Make Fresnel darken SSR instead of blending with specular
2023-10-11 22:37:02 +07:00
mandryskowski 5b2e54c17b Fresnel should darken the SSR reflections instead of blending them with specular light. 2023-10-11 18:58:22 +07:00
QbieShay c228fe1a0d Particle internal refactor and additions for more artistic control
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Co-authored-by: Raul Santos <raulsntos@gmail.com>
Co-authored-by: Mew Pur Pur <85438892+MewPurPur@users.noreply.github.com>
Co-authored-by: Clay John <claynjohn@gmail.com>
2023-10-10 20:03:35 +07:00
clayjohn af1d81d95a Only perform modelview transform on tangent and binormal when vertex shader is in local space 2023-10-05 22:08:36 +07:00
Rémi Verschelde 950139e489
Merge pull request #82546 from viksl/volumetric-fog-spot-light-artifacts
Fix cluster artifacts and negative light
2023-10-05 22:50:12 +07:00
clayjohn 51ed3aef63 Vertex and attribute compression to reduce the size of the vertex format.
This allows Godot to automatically compress meshes to save a lot of bandwidth.

In general, this requires no interaction from the user and should result in
no noticable quality loss.

This scheme is not backwards compatible, so we have provided an upgrade
mechanism, and a mesh versioning mechanism.

Existing meshes can still be used as a result, but users can get a
performance boost by reimporting assets.
2023-10-05 12:02:23 +07:00
mrjustaguy dd3d380a01 Improve Split Blending
Improve Split Blending Logic
2023-10-02 13:22:51 +07:00
viksl 8a2d345a85 Fixes spotlight's cluster artifacts and negative light. 2023-10-01 09:13:30 +07:00
Raffaele Picca de42258154 Optimizing glow behaviour 2023-09-26 11:56:28 +07:00
Dario 057367bf4f Add FidelityFX Super Resolution 2.2 (FSR 2.2.1) support.
Introduces support for FSR2 as a new upscaler option available from the project settings. Also introduces an specific render list for surfaces that require motion and the ability to derive motion vectors from depth buffer and camera motion.
2023-09-25 10:37:47 +07:00
bitsawer dda8846dea Fix LightmapGI shading sometimes being unlit or black 2023-09-20 01:41:32 +07:00
Rémi Verschelde 9a1b4f338b
Merge pull request #81160 from paddy-exe/canvas-uv-world-space
Add render mode to use world coordinates in canvas item shader
2023-09-19 09:03:18 +07:00
Rémi Verschelde 3815b2f98e
Merge pull request #81315 from conorlawton/z-billboard-y-velocity-no-scale
Fix z-billboard + y to velocity transform alignment to correctly respect non-uniform scale
2023-09-08 23:14:27 +07:00
Conor Lawton 9ecafcc491 Fixed z-billboard-y-velocity to correctly respect non-uniform scale instead of averaging scale 2023-09-08 20:01:57 +07:00
Milan Gruner 45a33cc749 Implement render mode fog_disabled and BaseMaterial3D setting Disable Fog 2023-09-05 18:15:02 +07:00
Patrick c98ab5aba3 Add option to use world coordinates in canvas item shader
By using the render mode `world_vertex_coords` you can automatically use the vertex coordinates in world space
2023-08-30 15:32:18 +07:00
Rémi Verschelde a6c72f9829
Merge pull request #81074 from DarioSamo/flip-motion-vectors
Flip convention of motion vectors.
2023-08-29 12:46:44 +07:00
Rémi Verschelde 9d74c24232
Merge pull request #80723 from DarioSamo/debug-motion-vectors
Improve visual feedback when using the motion vectors debug view option
2023-08-29 12:44:45 +07:00
Dario 293302ccd8 Add motion vector support for GPU 3D Particles.
Add the capability of resizing the transforms buffer for particles to be double its size and alternate where the current output is written to. Only works for particles that use index as their draw order.
2023-08-28 10:56:02 +07:00
Dario e7d3a7c2aa Improve visual feedback when using the motion vectors debug view option.
Replaces the current method of showing the raw values of the motion vectors buffer to display a grid of lines instead with a new shader.
2023-08-28 10:14:21 +07:00
Dario f14c944c21 Flip convention of motion vector to point from current pixel to the previous pixel. 2023-08-28 09:30:20 +07:00
Bastiaan Olij 8449331f13 Fix missing decal mask in mobile renderer 2023-08-23 11:14:10 +07:00
Dario e2984af013 Add motion vector support for animated surfaces like skeletons or blend shapes.
Extends mesh instances that required custom vertex buffers to create two alternating buffers that are written to and binds them to use them as the previous vertex buffer when generating motion vectors.
2023-08-16 11:37:42 +07:00
Rémi Verschelde 1163dac9e3
Merge pull request #80215 from clayjohn/HDR-2D
Add option to enable HDR rendering in 2D
2023-08-08 16:57:33 +07:00
Rémi Verschelde 40ca09364d
Merge pull request #80311 from darksylinc/matias-fullscreen-tri
Use fullscreen tri instead of quad
2023-08-07 14:54:21 +07:00
Rémi Verschelde faaf27f284
Fix various typos with codespell
Also includes typo fixes from #79993, #80068, #80276, and #80303.

Co-authored-by: betalars <contact@betalars.de>
Co-authored-by: spaceyjase <429978+spaceyjase@users.noreply.github.com>
Co-authored-by: Swarkin <102416174+Swarkin@users.noreply.github.com>
Co-authored-by: Raul Santos <raulsntos@gmail.com>
2023-08-07 13:09:47 +07:00
clayjohn 57eb762bae Add option to enable HDR rendering in 2D
This is needed to allow 2D to fully make use of 3D effects (e.g. glow), and can be used to substantially improve quality of 2D rendering at the cost of performance

Additionally, the 2D rendering pipeline is done in linear space (we skip linear_to_srgb conversion in 3D tonemapping) so the entire Viewport can be kept linear.
This is necessary for proper HDR screen support in the future.
2023-08-07 11:24:03 +07:00
Matias N. Goldberg 79c9edab3b Draw sky as a fullscreen triangle 2023-08-05 17:55:43 +07:00
Matias N. Goldberg 6e7d87fb25 Use fullscreen tri instead of quad 2023-08-05 17:09:06 +07:00
Clay 7c812cd7e9 Fix use of discard in shaders
discard was being included in all shaders set to depth pass opaque, which is the majority of shaders

Instead it should only be used with alpha prepass materials
2023-07-24 23:21:04 +07:00
mandryskowski 33e46aac13
Revert the change of the limit for interpolation of R0 with respect to metallic and SSR
Commit 2c000cb72f changed the interpolation limits from (0.04, 1.0) to (0.04, 0.37). This is incorrect, as we want to have an F0 of 0.04 for dielectrics (materials with metalness of 0.0) and an F0 of 1.0 for metals.
The Schlick approximation uses an F0 of 0.04 for all dielectrics and it's good enough.
Having it lower than 1.0 leads to an incorrect application of the Fresnel effect for metals and leads to bugs like #79549
2023-07-18 19:18:19 +07:00
Yuri Sizov 0fa808ba5e Merge pull request #77085 from BastiaanOlij/visualise_direction_shadowmap_frustum
Draw frustum splices ontop of direction shadow atlas for debug purposes
2023-07-12 21:02:25 +07:00
Yuri Sizov bb15241e06 Merge pull request #77740 from ChibiDenDen/simplify_vulkan
Replace sampler arrays with constant sampler elements, simplify and reuse code for all shaders
2023-07-12 17:16:12 +07:00
ChibiDenDen 35715e510f replace sampler arrays with constant sampler elements 2023-06-22 01:11:57 +07:00
Bastiaan Olij 952b4b3f38 Apply reprojection in multiview for our cluster lookup 2023-06-21 11:17:01 +07:00
Bastiaan Olij 66272ea26e Fix volumetric fog in stereo by projection vertex in combined space 2023-06-20 14:36:14 +07:00
Bastiaan Olij d9eb9665da Draw frustum splices ontop of direction shadow atlas for debug purposes 2023-06-11 11:48:11 +07:00
Rémi Verschelde 9ce42d176d
Merge pull request #76977 from manueldun/light-shader-builtins
Enable the use of all supported builtins on the light shader
2023-06-09 11:04:46 +07:00
Manuel Dun e2321c21db Enable the use of all builtins on the light shader
When using the light process in spatial shader,
the built-ins work as spected, now they work in forward+,
mobile and compatibility renderer.
2023-06-08 14:14:14 +07:00
Yuri Sizov f6dcd7f51a
Merge pull request #75181 from dalexeev/fix-light-only-mode
Fix "Light Only" mode of `CanvasItemMaterial`
2023-05-27 17:28:29 +07:00
Rémi Verschelde 852740a627
Merge pull request #76053 from MightiestGoat/fix-sky-auto-exposure
Fix the grainy sky while using debanding.
2023-05-24 08:46:28 +07:00
Rémi Verschelde 9ecb929da6
Merge pull request #76565 from clayjohn/debug-PSSM-splits
Re-implement the PSSM_SPLITS debug option
2023-05-15 09:33:01 +07:00
Danil Alexeev 43b0702a02
Fix "Light Only" mode of `CanvasItemMaterial` 2023-05-13 09:06:09 +07:00
Pedro J. Estébanez 6465432570 Save cluster render shader from being optimized out entirely 2023-05-08 18:39:49 +07:00
clayjohn fb77021559 Use proper UV in cubemap downsampler raster
This removes bias in cubemap downsampling shader that resulted in the bottom of cubemaps being over represented
2023-05-03 01:06:34 +07:00
clayjohn ca23d06a31 Re-implement the PSSM_SPLITS debug option
This uses a render_mode instead of shadow_color to avoid adding a cost to the basic shader
2023-04-28 17:53:56 +07:00
Pedro J. Estébanez 09aa1bbdb3 Fix unsupported sampler filter used for voxel GI 2023-04-26 20:54:06 +07:00
Johan Aires Rastén 14a8124ffe Add LIGHT_IS_DIRECTIONAL built-in for spatial shaders 2023-04-20 14:33:30 +07:00
clayjohn ab603e347f Clamp normal when calculating 2D lighting to avoid artifacts 2023-04-18 17:26:17 +07:00
mightygoat 69f634ac78 Fix the grainy sky while using debanding 2023-04-15 10:43:46 +07:00
Rémi Verschelde 34a842b5d1
Merge pull request #75462 from joao-pedro-braz/use_modelview_for_vertex_transform_when_double_precision_is_enabled
Use MODELVIEW_MATRIX when on double precision
2023-04-13 09:53:54 +07:00
Erik Johnson 6229c2a1f9 Translate inactive particles to -INF 2023-04-12 19:32:39 +07:00
RandomCatDude c118314fe8 Apply sky fog after luminance multiplier 2023-04-08 12:52:33 +07:00
mightygoat 2c000cb72f Fix the limit for interpolation of R0 with respect to metallic and SSR
Shlick term
2023-04-06 23:14:47 +07:00
João Pedro Braz 63c6f0b93c Use MODELVIEW_MATRIX for vertex transform when double precision is enabled
This commit updates the double precision vertex transform code from
using the MODEL_MATRIX to now use the MODELVIEW_MATRIX instead.

This can be made possible by transforming the MODELVIEW_MATRIX
back into model space (ie, same space as the MODEL_MATRIX) and then using it as if it were the MODEL_MATRIX.

With this in place we now properly handle VERTEX transformations that
a Material Shader might do, such as billboard-ing.
2023-03-29 10:37:30 +07:00
Rémi Verschelde 0511da260f
Merge pull request #74019 from BastiaanOlij/split_last_effects
Move roughness limiter and sort into their own classes
2023-03-10 14:02:14 +07:00
Bastiaan Olij a8ec72cf94 Move roughness limiter and sort into their own classes 2023-03-09 21:58:55 +07:00
RandomCatDude 59c31004f8 fix spotlight shadows in volumetric fog 2023-02-25 16:28:06 +07:00
clayjohn db9dfb7233 Increase SSAO and SSIL bias to account for variance in mipmap generation 2023-02-21 10:25:33 +07:00
clayjohn c9c14410e9 Fix sampling bug when SSAO is using half size 2023-02-16 00:37:12 +07:00
Bastiaan Olij 694c8ec273 Add render buffer support to screen space effects 2023-02-10 10:27:59 +07:00
Rémi Verschelde ab4d8df163
Merge pull request #72485 from BastiaanOlij/add_eye_matrix_access
Expose EYE_OFFSET to gdshader code
2023-02-01 07:33:18 +07:00
Rémi Verschelde 3eb1ac9fd2
Merge pull request #72075 from Maran23/extents-to-size
Replace Extents with Size in VoxelGI, ReflectionProbe, FogVolume, Decal  and GPUParticles*3D
2023-02-01 07:30:09 +07:00
Bastiaan Olij 8c77aea9ab Expose EYE_OFFSET to gdshader code 2023-02-01 12:39:13 +07:00
Marius Hanl a59819630d Replace Extents with Size in VoxelGI, ReflectionProbe, FogVolume, Decal and GPUParticles*3D
- Extents are replaced by Size (Size is Extents * 2)
- The UI text displays 'Size'
- Snapping is adjusted to work with Size
- _set and _get handle extents for compatibility

Co-authored-by: ator-dev <dominic.codedeveloper@gmail.com>
2023-01-31 20:04:11 +07:00
clayjohn eb9c2b878a Automatically transform Skeleton2D calculations so pivots are not needed 2023-01-27 14:55:22 +07:00
Rémi Verschelde 4b0363312e
Merge pull request #71455 from BastiaanOlij/fix_stereo_screen_depth
Make screen texture and depth texture work in Multiview
2023-01-26 01:11:02 +07:00
Bastiaan Olij 85c478e170 Make screen texture and depth texture work in Multiview 2023-01-25 13:35:01 +07:00
Rémi Verschelde a6042b649a
Merge pull request #71832 from Geometror/fix-spotlight-artifacts
Fix some `SpotLight3D` issues (clustering artifacts, leaking light, AABB)
2023-01-24 09:15:26 +07:00
Hendrik Brucker 4bd01a93dc Fix some SpotLight3D issues (clustering artifacts, light leak) 2023-01-24 01:08:32 +07:00
Rémi Verschelde 260daf8a13
Merge pull request #71694 from clayjohn/VoxelGI-reflection
Use proper space for forward GI reflections
2023-01-23 22:29:54 +07:00
Rémi Verschelde 5b1df48c6c
Convert en_GB spelling to en_US with codespell 2023-01-23 11:02:20 +07:00
Hugo Locurcio d84c9523f7
Fix DirectionalLight3D shadow opacity on Forward Mobile rendering backend 2023-01-22 22:25:15 +07:00
clayjohn 2ccc69cd7d Use proper space for forward GI reflections 2023-01-19 12:58:59 +07:00
clayjohn faea9f5c10 Remove SCREEN_TEXTURE, DEPTH_TEXTURE, and NORMAL_ROUGHNESS_TEXTURE
in favour of texture hints
2023-01-18 19:52:47 +07:00
jainl28patel 390f83bf5a fix normal map not flipping in sprite2D 2023-01-14 11:51:56 +07:00
Rémi Verschelde 0abd60b953
Merge pull request #71130 from clayjohn/RD-normal-roughness
Fix multiple issues that make the normal roughness texture unusable
2023-01-12 01:01:24 +07:00
clayjohn 89766848de Fix multiple issues that make the normal roughness texture unusable 2023-01-09 11:56:36 +07:00
Bastiaan Olij 9b549231e4 Move luminance effect into its own class and use new buffers system 2023-01-07 14:40:42 +07:00
Rémi Verschelde d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +07:00
clayjohn aaa9d626f3 Use proper indices for lights, decals, and reflection probes in mobile scene shader 2023-01-04 14:03:48 +07:00
Rémi Verschelde f064898956
Merge pull request #70253 from BastiaanOlij/cleanup_sky_render
Cleanup and improve sky render
2022-12-23 23:44:02 +07:00
Bastiaan Olij e886a7af81 Cleanup and improve sky render 2022-12-23 19:45:19 +07:00
clayjohn 4d301ee21e Check for disabled particle trail particle before initializing particle trail 2022-12-22 11:30:59 +07:00
clayjohn eb10c71d6c Disable particle trails particles when parent parent is not active. 2022-12-21 15:19:57 +07:00
Rémi Verschelde 2b2c372dbc
Merge pull request #70122 from clayjohn/VRS-r8uint
Don't attempt to create or use an R8_UINT texture as storage if VRS is not supported
2022-12-17 12:22:03 +07:00
clayjohn 5e90b90a97 Don't attempt to create or use an R8_UINT texture as storage if VRS is not supported 2022-12-16 09:53:12 +07:00
Rémi Verschelde e1bcadd12d
Merge pull request #56804 from Calinou/ssr-add-max-roughness-cutoff
Add maximum roughness cutoff to SSR to improve performance
2022-12-15 09:20:29 +07:00
Rémi Verschelde 465d4c1d95
Merge pull request #70009 from clayjohn/glow-hq
Remove high quality glow as it is not any higher quality than regular glow
2022-12-13 23:32:15 +07:00
Rémi Verschelde fc517e6c89
Merge pull request #70003 from clayjohn/GLES3-cc
Various fixes and documentation for CanvasGroup
2022-12-13 23:31:43 +07:00
clayjohn bdd4001ef0 Various fixes and documentation for CanvasGroup
Properly apply custom materials with CanvasGroups in the GLES3 backend

Properly blur backbuffer when using a partial rect in forward_plus and
gl_compatibility renderers

Properly set fit_margin when clear_margin is set

Fix shader error during backbuffer clear in mobile renderer
2022-12-13 10:22:18 +07:00
clayjohn 5b5cd2b98b Remove high quality glow as it is not any higher quality than regular glow 2022-12-13 10:15:45 +07:00
Rémi Verschelde 83281e7a42
Merge pull request #69985 from clayjohn/mobile-rim
Ensure that rim lighting uses an exponent base greater than zero
2022-12-13 10:12:00 +07:00
clayjohn a062798b76 Ensure that rim lighting uses a exponent base greater than zero
This avoids the undefined behavior that happens if the base is zero and the exponent is zero
2022-12-12 13:41:28 +07:00
Hugo Locurcio 7745bd42a6
Add maximum roughness cutoff to SSR to improve performance
In a test scene with mixed rough and non-rough materials, this saves
upwards of 0.15 ms of GPU time with very little visual artifacting
(GTX 1080, 2560×1440).
2022-12-10 17:35:18 +07:00
clayjohn e6f8c8517c Fade out SSR with roughness so that it doesn't show at high roughness amounts 2022-12-09 12:59:51 +07:00
NumbuhFour 1b09fd5410 Implement CAMERA_VISIBLE_LAYERS as built-in shader variable 2022-12-03 22:41:27 +07:00
Rémi Verschelde daf168f4c8
Merge pull request #69522 from clayjohn/IBL-black-metal
Allow black metallic materials to reflect IBL
2022-12-03 12:46:30 +07:00
clayjohn 1e05dd3504 Allow black metallic materials to reflect IBL 2022-12-02 19:54:59 +07:00
clayjohn b2b89d7294 Properly remap roughness when reading from radiance map
This ensures that we consistently use perceptual roughness which matches the behaviour of most other PBR renderers like Blender, Ue4 and Godot 3
2022-12-02 15:39:20 +07:00
Rémi Verschelde 3a43d44656
Merge pull request #68830 from Ayush-singla27/issuebranch
fixed incorrect mesh normals in shaders
2022-11-20 11:35:52 +07:00
clayjohn 0e5a98cdd8 Fix drawing of 2D skeletons in the RD renderer.
Also clean up skeleton code in preparation for adding them to GLES3

Properly update Mesh2D AABBs when skeleton is updated
2022-11-18 23:36:40 +07:00
Ayush Singla 75ba0a7957 fixed incorrect mesh normals in shaders 2022-11-19 11:06:03 +07:00
Rémi Verschelde 58cb11b396
Merge pull request #68710 from BastiaanOlij/fix_vrs
Fix VRS issues
2022-11-18 16:19:22 +07:00
clayjohn 21ac6d7d8e Finish implementing Canvas Background mode 2022-11-17 12:51:26 +07:00
Bastiaan Olij 616ba8745f Fix VRS issues 2022-11-17 00:32:42 +07:00
Rémi Verschelde 245e6454a0
Merge pull request #68673 from clayjohn/RD-alpha-hash
Fix alpha hash by correcting typos and doing calculations in object space
2022-11-15 10:28:59 +07:00
Rémi Verschelde 1e9a61cd40
Merge pull request #68487 from clayjohn/RD-mobile-raster
Use raster versions of copy effects for 2D operations when using the mobile renderer
2022-11-15 10:27:43 +07:00
clayjohn 81d8b502cc Fix alpha hash by correcting typos and doing calculations in object space 2022-11-14 17:57:49 +07:00
Rémi Verschelde 014fac8f28
Merge pull request #67746 from SonnyBonds/fix_cluster_shader_mvk
Fix cluster_render.glsl failing on some Macs
2022-11-11 21:05:20 +07:00
Rémi Verschelde c41b9c5f5b
Merge pull request #67972 from and-rad/vector-field-consistency
Fix inconsistency between vector field texture and world space directions
2022-11-11 21:05:00 +07:00
clayjohn 8e41221404 Use raster versions of copy effects for 2D operations when using the mobile renderer
This PR implements a few basic copy operations in raster that weren't available before
2022-11-10 12:47:26 +07:00
Rémi Verschelde d147adc591
Merge pull request #67915 from RevoluPowered/fix-intel-macbook-crash-subgroups
Ensure vulkan subgroups are disabled for MoltenVK
2022-10-31 10:53:30 +07:00
clayjohn 31c1a06ab5 Fix ss_effects_flags uniform in clustered forward renderer
This comes from an uncaught merge conflict resulting from the split of scene_data into
scene_data and implementation_data
2022-10-27 15:37:38 +07:00
Clay John 0d711cad30
Merge pull request #66107 from devloglogan/ambient-light-disabled-fix
Fix ambient_light_disabled render mode flag
2022-10-27 10:08:29 +07:00
Andreas Raddau a5828cd0e3 Improved consistency between vector field texture and world space 2022-10-27 15:43:24 +07:00
Gordon MacPherson 381d457a2a Ensure vulkan subgroups are disabled for MoltenVK
We found they don't work on intel macbooks properly at all.

Possible future solutions:
- update to moltenvk.
- update to spirv may resolve it.
2022-10-26 20:12:06 +07:00
Anders Stenberg bbb1f900dd Fix cluster_render.glsl failing on some Macs
Some Macs encounter an internal error when compiling cluster_render.glsl
caused by a likely bug in the MVK/Metal
compiler when using gl_HelperInvocation.
2022-10-22 12:27:13 +07:00
Markus Sauermann b8031bb7d6 Code simplifications
1. Viewport::get_visible_rect().position is always zero.
So Control::get_window_rect is identical to Control::get_global_rect.
Remove Control::get_window_rect since it is not used in the source code.

2. sqrt(a * a) = abs(a) for doubles

3. Simplify affine_inverse combination

4. Simplify calculation in shaders
2022-10-18 12:47:40 +07:00
Rémi Verschelde 367a9b8056 Merge pull request #67335 from clayjohn/GLES3-2d-lights
Add 2D lights to OpenGL3 canvas renderer
2022-10-13 09:05:36 +07:00
clayjohn e600fb93a5 Add 2D lights to OpenGL3 canvas renderer
This is an initial implementation using the same single-pass approach as the RenderingDevice.
2022-10-12 17:55:01 +07:00
Hugo Locurcio 6aebc7b66e
Fix volumetric fog not rendering at densities lower than or equal to 0.001
This allows volumetric fog to render with the lowest density that
can be specified in the inspector (0.0001).
2022-10-13 00:45:49 +07:00
Bastiaan Olij d09ad714bf Fixing artifacts in SSR 2022-10-04 23:47:13 +07:00
clayjohn 3126619aa5 Update Instance flags in shaders to match instance flags in engine 2022-10-02 21:37:06 +07:00
Rémi Verschelde 166df0896c Fix typos with codespell
Using codespell 2.3-dev from current git.

And fix typo in `methods.py` for `vsproj=yes` option (still won't work
though).
2022-09-30 14:23:36 +07:00
Rémi Verschelde 67961d875d Merge pull request #66178 from clayjohn/double-precision-rendering
Emulate double precision for regular rendering operation when REAL_T_IS_DOUBLE
2022-09-30 09:59:45 +07:00
Rémi Verschelde 7a0500d9a3 Merge pull request #66626 from danboo/fix-typo-run-debug-collisons
Fix typos - "collison" -> "collision"
2022-09-30 09:58:25 +07:00
danboo eba8be6e45 Fix typo - "collison" -> "collision" 2022-09-29 13:56:26 +07:00
clayjohn 1a0890122f Clean up canvas light shader API.
Expose LIGHT_ENERGY and LIGHT_IS_DIRECTIONAL.
Add LIGHT_DIRECTION
2022-09-28 11:46:58 +07:00
Rémi Verschelde b8870b91b5 Merge pull request #66466 from clayjohn/FXAA-fix
Take FXAA samples from half-pixel coordinates to improve quality
2022-09-27 09:58:22 +07:00
Rémi Verschelde 2ad63f68b3 Merge pull request #66370 from bitbrain/fix-light2d-blend-modes
Fix broken 2D light blending, addresses #49922
2022-09-27 09:57:44 +07:00
Rémi Verschelde 5ecaa676cc Merge pull request #66317 from clayjohn/debanding-bug
Move deband to end of tonemapping.
2022-09-27 09:54:45 +07:00
clayjohn dbcc0fa2a6 Take FXAA samples from half-pixel coordinates to improve quality 2022-09-26 11:54:29 +07:00
Rémi Verschelde 5ae6379e5d Merge pull request #66394 from bitbrain/fix-unshaded-canvas-modulate
Fix Unshaded CanvasItem for Vulkan
2022-09-26 08:24:45 +07:00
Bastiaan Olij 56d6a13fd7 Make dependencies with shader includes in subfolders 2022-09-26 12:29:19 +07:00
Miguel Gonzalez Sanchez 125f0be8b7
do not apply modulate on canvas when unshaded is set 2022-09-25 12:13:46 +07:00
Miguel Gonzalez Sanchez 2047be4516
fix broken 2D light blending, addresses #49922 2022-09-24 20:13:12 +07:00
clayjohn fe69fedc1a Move deband to end of tonemapping.
This avoids artifacts when using adjustments and color correction
2022-09-23 11:46:40 +07:00
clayjohn 27a3014f50 Emulate double precision for regular rendering operation.
We calculate the lost precision on the CPU and pass it into the GPU
so that it can calculate an error-corrected version of the vertex position
2022-09-20 23:40:01 +07:00
Logan Lang e61d8b6f53 enabled ambient_light_disabled render mode flag 2022-09-19 17:12:32 +07:00
Bastiaan Olij 02ea1de7d0 Extract shared scene data into a separate class 2022-09-15 12:09:57 +07:00
Rémi Verschelde ecaa7b634e
Merge pull request #65322 from ceLoFaN/fix-dof-artifact-at-high-blur 2022-09-15 00:03:40 +07:00
Clay John f709596631
Merge pull request #65418 from JFonS/taa_multimesh
Add motion vectors support for MultiMeshInstance
2022-09-14 09:06:27 +07:00
clayjohn 8fa76a5272 Move debanding into internal sky shader code so that it is applied after everything else.
This ensures that the debanding does not scale with exposure or any other effect.
2022-09-13 10:39:04 +07:00
Rémi Verschelde 79b21e96ad
Merge pull request #65544 from clayjohn/lambert-wrap
Apply energy conservation to LAMBERT_WRAP diffuse mode by dividing by PI
2022-09-12 20:42:27 +07:00
clayjohn 97be1fb7b6 Apply energy conservation to LAMBERT_WRAP and TOON diffuse modes by dividing by PI 2022-09-12 08:45:40 +07:00
jfons 74cdee4cb5 Add motion vectors support for MultiMeshInstance
Transparently handle changes in multimesh transforms so they get reflected in the motion vectors buffer.
2022-09-12 15:28:12 +07:00
clayjohn 65f0113bc6 Properly scale SSR reflection based on metallic value for dielectric materials 2022-09-09 16:52:02 +07:00
ceLoFaN e844b95eaf Fix DoF artifacting at high blur amounts 2022-09-05 21:38:40 +07:00
Rémi Verschelde d63c6fc463 Merge pull request #60185 from Calinou/environment-fog-and-sky-affect 2022-09-01 23:52:34 +07:00
Hugo Locurcio 699e9f7966
Add Environment properties to control fog rendering on background sky
Values lower than 1.0 can be used to make the fog rendering not fully
obstruct the sky. This can be desired when using fog as a purely
atmospheric effect, without intending to use fog for open world fog
fading.

When set to 0.0, fog rendering behavior will be similar to Godot 3.x
where sky rendering was never affected by fog.
2022-09-01 19:07:39 +07:00
Bastiaan Olij 2cd84be64d Extracting render buffers and changing it to a more generic solution 2022-09-01 20:01:45 +07:00
clayjohn 385ee5c70b Implement Physical Light Units as an optional setting.
This allows light sources to be specified in physical light units in addition to the regular energy multiplier. In order to avoid loss of precision at high values, brightness values are premultiplied by an exposure normalization value.

In support of Physical Light Units this PR also renames CameraEffects to CameraAttributes.
2022-08-31 12:14:46 +07:00
Rémi Verschelde c40855f818
Merge pull request #65130 from BastiaanOlij/fix_mobile_signed_tangent
Fix vector type for signed tangent in mobile shader
2022-08-31 09:12:31 +07:00
Bastiaan Olij 708222bb9a Fix vector type for signed tangent in mobile shader 2022-08-31 16:35:54 +07:00
Hugo Locurcio 09bedcead4
Add a per-light volumetric fog energy property
Per-light energy gives more control to the user on the final result of
volumetric fog. Specific lights can be fully excluded from volumetric fog
by setting their volumetric fog energy to 0, which improves performance
slightly. This can also be used to prevent short-lived dynamic effects
from poorly interacting with volumetric fog, as it's updated over several
frames by default unless temporal reprojection is disabled.

Volumetric fog shadows now obey Light3D's Shadow Opacity property as well.

The shadow fog fade property was removed as it had little visible impact
on the final scene's rendering.
2022-08-30 20:03:38 +07:00
bruvzg bcc3643989
Add font LCD sub-pixel anti-aliasing support. 2022-08-23 08:47:21 +07:00
Rémi Verschelde 7b4927bb5f
Merge pull request #60309 from The-O-King/oct 2022-08-22 19:29:21 +07:00
Omar El Sheikh 61522d8491 Add Blendshape Support
Update the blendshape shader to decode/encode octahedral normals
2022-08-20 20:59:28 +07:00
Omar El Sheikh 78881b3cc3 Octahedral Normal/Tangent Compression
Implementation of Octahedral normal compression into Godot 4.0
2022-08-13 08:09:32 +07:00
clayjohn 7d6287f616 Properly scale depth in bokeh_dof effect so that setting distance to blur effect is accurate again 2022-08-12 16:39:05 +07:00
Rémi Verschelde 8734ef1f7a
Merge pull request #62547 from clayjohn/ref_vec_pbr 2022-08-08 10:18:32 +07:00
Hugo Locurcio baaa7503c7
Add a shadow opacity property to Light3D
This can be used to make shadows translucent for a specific light.

The light distance fade system also uses this to smoothly fade the shadow
when the light fade transition distance is greater than 0.
2022-08-07 11:06:32 +07:00
Hugo Locurcio d38671827b
Fade screen-space reflection towards inner margin
- Fade reflection towards inner margin and clip it at screen edges
  instead of external margin.
- Round edges of the fade margin if both are being cut off to prevent
  sharp corners.

Co-authored-by: puchik <puchik@users.noreply.github.com>
2022-08-03 01:55:42 +07:00
Rémi Verschelde bda2274969
Merge pull request #63627 from and-rad/vector-field-attractor-fix
Fix vector field particle attractor texture sampling
2022-08-02 07:13:04 +07:00
Rémi Verschelde 2cdef4d532
Merge pull request #63589 from RandomShaper/sdfgi_debug_pc
Keep SdfgiDebug shader's push constant size <= 128
2022-08-02 07:11:58 +07:00
Rémi Verschelde 677f565ce8
Merge pull request #63587 from clayjohn/specular-occlusion
Treat specular less than 0.02 as occlusion
2022-08-01 07:54:57 +07:00
clayjohn 0c65ed38a6 Treat specular less than 0.02 as occlusion
This is a very common hack used in almost all PBR renderers to allow removing specular contribution in dielectric materials
2022-07-31 15:45:21 +07:00
Hugo Locurcio 0e26fee3b7
Make Decal's `modulate` property affect emission color as well
This can be used to recolor special effects such as fake area fog
without having to create separate textures for each color.

- Improve the Decal class documentation.
2022-07-30 21:41:48 +07:00
Andreas Raddau dfc6035ce1 Fix vector field particle attractor texture sampling 2022-07-29 16:52:54 +07:00
Pedro J. Estébanez 278950f731 Keep SdfgiDebug shader's push constant size <= 128 2022-07-29 13:25:11 +07:00
Hugo Locurcio 4b42379c8f
Rename RenderingServer global shader uniform methods to be more explicit
The `global_shader_uniform` name is longer, but it makes it much
easier to find the methods when searching in the class reference.
2022-07-28 18:46:59 +07:00
Bastiaan Olij bad5c659a4 Move Sky(RD) into environment
Move Fog logic from render scene render to fog
2022-07-26 10:19:40 +07:00
Rémi Verschelde 4f7bfacfcd
Merge pull request #62478 from BastiaanOlij/split_effects_20220628 2022-07-22 23:44:52 +07:00
luz paz 38aaaa3cf9 Fix various typos not caught by codespell
Revert upstream `core/input/gamecontrollerdb.txt`. Upstream fix: https://github.com/gabomdq/SDL_GameControllerDB/pull/600
2022-07-21 07:38:23 +07:00
Bastiaan Olij eefcb5ed67 Move screen space effects into a separate class 2022-07-19 13:27:39 +07:00
Bastiaan Olij d139131aab Adding Variable Rate Shading support to Godot
Improve GI renderer and add VRS support
Implement render device has_feature and move subgroup settings to limit_get
2022-07-17 15:42:24 +07:00
Hugo Locurcio 0f18bd244e
Fix dead link in TAA resolve shader comment
Spartan Engine has recently removed its own internal TAA in favor
of FSR 2.0. The link has been changed to point to a fixed commit,
so the link will keep working as long as the repository exists.
2022-07-09 22:51:54 +07:00
Rémi Verschelde 6bbfd160b0 SCons: Properly track codegen script dependency for generated GLSL headers 2022-07-02 16:01:48 +07:00
clayjohn 93c82ab4b9 Evaluate specular reflections using specular dominant direction instead of assuming mirror reflections 2022-06-29 23:36:18 +07:00
Pedro J. Estébanez fc6ac4a155 Consider uniform writability part of the interface of the set 2022-06-27 21:56:18 +07:00
Bastiaan Olij 6224b00365 Moved cube_to_dp and cubemap logic into CopyEffects 2022-06-24 18:04:28 +07:00
Rémi Verschelde 051fb86fb0
Merge pull request #61221 from BastiaanOlij/split_gi_effects 2022-06-23 12:28:10 +07:00
Rémi Verschelde e21db7723a
Merge pull request #62286 from JFonS/taa_global_time 2022-06-22 16:59:08 +07:00
jfons 0f38e79617 Move TIME to a global shader variable
This makes it work consistently for motion vectors in all functions, including user-defined ones.
2022-06-22 12:24:37 +07:00
JFonS 9b4e07f866 Workaround MoltenVK shader conversion error 2022-06-22 11:58:50 +07:00
Bastiaan Olij 997810e417 Split GI effects and fix stereoscopic rendering of GI effects 2022-06-22 12:50:17 +07:00
Rémi Verschelde 3a2b409c5a
Merge pull request #62106 from BastiaanOlij/eye_offset
Introduce eye_offset for correcting stereoscopic reflections
2022-06-18 10:40:57 +07:00
Bastiaan Olij b4821fe2e0 Introduce eye_offset for correcting stereoscopic reflections
Use view instead of vertex for reflections.
2022-06-17 19:39:34 +07:00
Hugo Locurcio 787a1e006b
Fix glow in Mix mode not working correctly when FXAA is enabled
Glow must be performed after FXAA to ensure correct appearance.
2022-06-15 22:23:56 +07:00
jfons 36382ab7eb Workaround MoltenVK error found in TAA implementation 2022-06-09 16:40:00 +07:00
jfons ba832d83b2 Initial TAA implementation
Initial TAA support based on the implementation in Spartan Engine.

Motion vectors are correctly generated for camera and mesh movement, but there is no support for other things like particles or skeleton deformations.
2022-06-07 13:14:44 +07:00
clayjohn 06f356d41e Add and improve license attribution for SSAO and SSIL shader code 2022-05-31 09:42:50 +07:00
Hugo Locurcio e85459dcd1
Add Cone and Cylinder shapes to FogVolume
This complements the existing Ellipsoid and Box local fog shapes.

This can be used to represent a light cone coming from a SpotLight.
2022-05-25 12:35:53 +07:00
Rémi Verschelde a53434639f
Merge pull request #61214 from somnathsarkar/particle-attractor-fix
Fix GPUParticles3D disappearance at attractor origins
2022-05-21 08:48:36 +07:00
Somnath Sarkar 99911bfa79 Fix GPUParticles3D disappearance at attractor origins 2022-05-20 19:56:32 +07:00
Windy Darian a3e016e07e Fix normal and tangent blending in blend shapes 2022-05-20 07:59:45 +07:00
Yuri Rubinsky 5322b171de Fix tonemapper shader to correctly apply alpha channel 2022-05-18 06:43:07 +07:00
clayjohn 600d8105d8 Fix custom irradiance bug in Vulkan mobile renderer 2022-05-16 11:57:41 +07:00
Somnath Sarkar 52aeaf5d16 Fix computation of screen_uv 2022-05-16 00:00:01 +07:00
Bastiaan Olij 9939cfc4c4 Split out bokeh_dof and copy effects 2022-05-11 11:08:56 +07:00
Bastiaan Olij 3b2267ba6d Splitting tonemapper into its own class 2022-04-28 15:00:30 +07:00