Commit Graph

633 Commits (cb1569345a6f17da08241e645ab03cb2e1b78d2f)

Author SHA1 Message Date
Thaddeus Crews e8a4b45ce4
Style: Add 19.1.0 LLVM options to `.clang-format` 2024-11-22 09:24:32 +07:00
clayjohn 2b68c63a88 Mask out shadows on CanvasItems that don't have a matching item_shadow_mask
This restores the behavior from 3.x
2024-11-21 22:15:54 +07:00
Thaddeus Crews 8eee5066eb
Merge pull request #94981 from Chaosus/shader_fix_screen_uv_in_spatial_light
Allow `SCREEN_UV` to be used in light function of spatial shader
2024-11-21 17:56:45 +07:00
clayjohn 02efdb28dc Unify y-flip behavior for sky in RD backends 2024-11-19 16:59:04 +07:00
Chaosus a64b3fd3f8 Allow `SCREEN_UV` to be used in light function of spatial shader 2024-11-19 11:39:49 +07:00
clayjohn 2c158c386b Normalize normal tangent and binormal before interpolating in the mobile renderer to avoid precision errors on heavily scaled meshes 2024-11-13 12:24:28 +07:00
Thaddeus Crews edc60c63f1
Merge pull request #98701 from DarioSamo/rd-graph-improvements
Add dependency detection improvements to the render graph.
2024-11-04 21:51:58 +07:00
Dario 53099c56f0 Add multiple specialization constants to Forward+ and Mobile. 2024-11-04 14:35:40 +07:00
Dario 5216ef5f9c Add dependency detection improvements to the render graph.
- Buffers changing their usage are no longer treated as write usage unless the API requires it.
- Draw lists are not treated as being dependent on each other if their regions do not intersect despite both being write commands.
- Particles were tweaked to use different unused buffers to reduce dependencies.
2024-11-01 09:46:52 +07:00
Stuart Carnie 0d1d945727
2D: Fix various issues and minor performance optimisations 2024-10-30 08:36:45 +07:00
Clay John 748f4079e3
Merge pull request #96439 from darksylinc/matias-TheForge-pr03-rebased
Add Swappy & Pre-Transformed Swapchain
2024-10-29 12:34:40 +07:00
Matias N. Goldberg aaa0e2fddf Add Swappy & Pre-Transformed Swapchain
- Adds Swappy for Android for stable frame pacing
- Implements pre-transformed Swapchain so that Godot's compositor is in
charge of rotating the screen instead of Android's compositor
(performance optimization for phones that don't have HW rotator)

============================

The work was performed by collaboration of TheForge and Google. I am
merely splitting it up into smaller PRs and cleaning it up.

Changes from original PR:

- Removed "display/window/frame_pacing/android/target_frame_rate" option
to use Engine::get_max_fps instead.
- Target framerate can be changed at runtime using Engine::set_max_fps.
- Swappy is enabled by default.
- Added documentation.
- enable_auto_swap setting is replaced with swappy_mode.
2024-10-28 18:55:37 +07:00
Dario 427ba09efc Fix soft shadows by increasing the bit count for specialization constants. 2024-10-28 10:26:50 +07:00
Thaddeus Crews c145e85011
Merge pull request #98226 from m-pranav-r/fix-volumetric-shadows
Fix incorrect depth comparison used to calculate volumetric fog shadowing
2024-10-21 16:39:11 +07:00
m-pranav-r c12001a9dc Fix incorrect depth comparison used to calculate volumetric fog shadowing 2024-10-16 14:55:41 +07:00
EnlightenedOne cef515506b Move preprocessor to end of line for iterator, remove redeclaration incompatible with ubershader method definitions 2024-10-14 22:19:16 +07:00
Dario e2c6daf7ef Implement asynchronous transfer queues, thread guards on RenderingDevice. Add ubershaders and rework pipeline caches for Forward+ and Mobile.
- Implements asynchronous transfer queues from PR #87590.
- Adds ubershaders that can run with specialization constants specified as push constants.
- Pipelines with specialization constants can compile in the background.
- Added monitoring for pipeline compilations.
- Materials and shaders can now be created asynchronously on background threads.
- Meshes that are loaded on background threads can also compile pipelines as part of the loading process.
2024-10-02 15:11:58 +07:00
Patrick Owen d720eb80e1 Clamp UV-coordinates to centers of outermost texels when configured to do so
In addition, fix region_filter_clip_enabled documentation to be consistent with AtlasTexture.xml, since that is the option whose behavior was fixed
2024-09-29 05:57:19 +07:00
Rémi Verschelde 285ebed828
Merge pull request #83360 from ywmaa/vertex_shading
Implement vertex shading
2024-09-29 00:46:48 +07:00
ywmaa 0a9ad8f9de
Implement vertex shading
This adds support in all backends, but the Compatibility renderer works the best.
Mobile and Forward+ can only support one directional light shader (the first in the tree)
While the Compatibility renderer supports any number of shadows.

Co-authored-by: Clay John <claynjohn@gmail.com>
2024-09-29 00:36:09 +07:00
clayjohn 4d635b7a3a Combine texture and instance data into one uniform set in the 2D renderer
Co-authored-by: Stuart Carnie <stuart.carnie@gmail.com>
2024-09-27 11:05:46 +07:00
Rémi Verschelde bfe74eca3b
Merge pull request #97428 from clayjohn/shadow-filter-jitter-rebase
Jitter shadow map dithering pattern across frames when TAA is enabled
2024-09-26 12:45:50 +07:00
Rémi Verschelde 991e6c92ab
Merge pull request #96923 from Repiteo/style/warning-admonition
Style: Add `WARNING:` as new comment admonition
2024-09-26 12:45:38 +07:00
Thaddeus Crews 32c83a228d
Style: Add `WARNING:` as new comment admonition 2024-09-25 09:44:42 +07:00
Thaddeus Crews 9f9ee0c813
SCons: Add unobtrusive type hints in SCons files 2024-09-25 09:34:35 +07:00
Rie 5efa6ba489
Fix incorrect Reinhard tonemap operator 2024-09-25 12:34:23 +07:00
Hugo Locurcio 0eb06da057 Jitter shadow map dithering pattern across frames when TAA is enabled
This improves shadow quality by reducing the visibility of the noisy
pattern caused by dithering.

This jittering also applies when FSR2 is enabled, as it provides its own
form of temporal antialiasing.

Co-authored-by: Clay John <claynjohn@gmail.com>
2024-09-24 15:52:07 +07:00
clayjohn e75900e1ad Calculate pixel snap in canvas space instead of world space
This ensures that you are actually snapping to pixels in the viewport and not an arbitrary amount
2024-09-20 17:43:33 +07:00
Thaddeus Crews b37fc1014a
Style: Apply new `clang-format` changes 2024-09-20 08:09:48 +07:00
Stuart Carnie a657ea42f1
2D: Add batching to RendererCanvasRenderRD 2024-09-12 05:26:06 +07:00
BlueCube3310 a89f4fa5a9 LightmapGI: Pack L1 SH coefficients for directional lightmaps 2024-09-05 22:46:58 +07:00
Rémi Verschelde 49ed6c558c
Merge pull request #86809 from clayjohn/TAA-disocclusion
Tune TAA disocclusion scale to avoid rejecting all samples during motion.
2024-09-03 16:13:26 +07:00
Rémi Verschelde 63a8548693
Merge pull request #96426 from clayjohn/RD-reflection-probe-roughness
Use non-linear mapping for ReflectionProbe mip levels to match sky
2024-09-03 11:43:52 +07:00
Rémi Verschelde 667778cf4d
Merge pull request #93448 from clayjohn/transmittance-fixes
Various fixes for transmittance effect
2024-09-03 11:42:57 +07:00
clayjohn 64f5443b14 Use non-linear mapping for ReflectionProbe mip levels to match sky 2024-09-01 01:40:42 +07:00
Chaosus f538376c3b Add `CLIP_SPACE_FAR` built-in to spatial shader 2024-08-27 08:48:46 +07:00
Rémi Verschelde 68d188d521
Merge pull request #95888 from clayjohn/Lightmap-SH-coefficients
Use correct lightmap coefficients to ensure that the directional lightmap mode looks correct
2024-08-25 20:18:18 +07:00
BlueCube3310 4aa145624e LightmapGI: Fix shader data alignment after #89919 2024-08-21 21:37:13 +07:00
clayjohn f4ccba7508 Use correct lightmap coefficients to ensure that the directional lightmap mode looks correct
Also remove the metallic option from directional lightmap as it is guaranteed to return negative numbers in many cases
2024-08-21 10:24:32 +07:00
Stuart Carnie 2d0165574d
Add Metal support for macOS (arm64) and iOS 2024-08-20 12:11:06 +07:00
Rémi Verschelde 8acd82f70e
Merge pull request #89919 from BlueCube3310/bicubic-lightmap
Implement bicubic sampling for lightmaps
2024-08-20 10:01:41 +07:00
Rémi Verschelde 333f0f910f
Merge pull request #86000 from jsjtxietian/add-missing-model_normal_matrix
Add `model_normal_matrix` for fragment shader
2024-08-20 10:01:36 +07:00
jsjtxietian e698351db2 Add model_normal_matrix for fragment shader 2024-08-20 12:39:29 +07:00
Rémi Verschelde c6400a8fe4
Merge pull request #95662 from clayjohn/GLES3-sky-fog
Add fixed fog to the sky in the Compatibility renderer
2024-08-19 12:09:10 +07:00
Rémi Verschelde 824a97120e
Merge pull request #92213 from clayjohn/ambient-disabled
Disable all sources of ambient light when `ambient_light_disabled` render mode is used
2024-08-19 12:08:31 +07:00
BlueCube3310 ef9bb1a207 Implement support for bicubic lightmap filtering
Co-authored-by: Calinou <hugo.locurcio@hugo.pro>
2024-08-19 09:52:09 +07:00
clayjohn 578049b7b9 Add fixed fog to the sky in the Compatibility renderer
And apply luminance multiplier after fog in RD renderer
2024-08-17 23:33:26 +07:00
Rémi Verschelde 851d0a764d
Merge pull request #95536 from jsjtxietian/rename-alpha-scissor
Fix undefined `alpha_scissor` in standard shader
2024-08-16 14:35:38 +07:00
jsjtxietian 970a237c20 Fix undefined `alpha_scissor` in standard shader 2024-08-15 11:44:11 +07:00
clayjohn b99d0d778a Use transformed roughness instead of raw roughness to calculate roughness fade in SSR 2024-08-12 12:04:16 +07:00
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