Commit graph

279 commits

Author SHA1 Message Date
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 -03: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 -03:00
Dario
5155870d64 Improve handling of motion vectors for multimesh instances.
Fixes #67287. There was a subtle error where due to how enabling motion vectors for multi-meshes was handled, only the first instance would have a valid transforms buffer and the rest would point to an invalid buffer. This change moves over the responsibility of enabling motion vectors only when changes happen to the individual 3D transforms or the entire buffer itself. It also fixes an unnecessary download of the existing buffer that'd get overwritten by the current cache if it exists. Another fix is handling the case where the buffer was not set, and enabling motion vectors would not cause the buffer to be recreated correctly.
2023-08-09 08:17:07 -03: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 +02:00
Rémi Verschelde
ff70ce158c
Merge pull request #80315 from darksylinc/matias-ssil-validation-fix
Fix validation error when enabling SSIL alone
2023-08-07 14:55:10 +02: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 +02: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 +02:00
Matias N. Goldberg
666e91b9ff Fix validation error when enabling SSIL alone 2023-08-05 20:57:26 -03:00
Yuri Sizov
1c40263665 Merge pull request #79606 from clayjohn/ShaderRD-compilation-groups
Shader rd compilation groups
2023-08-01 17:25:16 +02:00
Bastiaan Olij
4874b96033 Expose RenderingSceneBuffers through ClassDB 2023-07-26 23:48:30 +10: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 +02:00
clayjohn
e970f5249c Add Shader compile groups to RD Shader system
This allows us to specify a subset of variants to compile at load time and conditionally other variants later.

This works seamlessly with shader caching.

Needed to ensure that users only pay the cost for variants they use
2023-07-21 16:42:30 +02:00
Jonas Schönbrodt
26c4644b38 Fix bad LOD selection when Camera in Mesh AABB
Fixed an issue where a bad LOD would be selected although the Camera being inside the Meshes AABB.
2023-07-19 18:07:37 +02: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 +02: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 +02:00
Rémi Verschelde
ea3aaeac05
Merge pull request #78624 from puchik/canvas-background-specular-ghosting
Clear specular buffer if sky mode is canvas and screen space effects are used
2023-07-08 18:16:05 +02:00
K. S. Ernest (iFire) Lee
39dfa8436e Varying mismatch causing shaders to fail. 2023-06-23 21:36:38 -07:00
Arman Elgudzhyan
af9d1743f3 Clear specular buffer if bg mode is canvas and ss effects are used
Explicitly clear the separate specular buffer when the background mode is canvas and screen space effects (and thus a separate specular buffer) are used.
2023-06-23 12:16:52 -07:00
bitsawer
ef00de99b4 Fix error spam when a mesh with bone weights has an invalid skeleton 2023-06-22 15:58:52 +03:00
ChibiDenDen
35715e510f replace sampler arrays with constant sampler elements 2023-06-22 01:11:57 +03:00
Bastiaan Olij
952b4b3f38 Apply reprojection in multiview for our cluster lookup 2023-06-21 11:17:01 +10:00
Bastiaan Olij
66272ea26e Fix volumetric fog in stereo by projection vertex in combined space 2023-06-20 14:36:14 +10:00
clayjohn
36a005fafc
Add RENDERING_INFO parameters to GL Compatibility renderer
This also fixes RENDERING_INFO_TOTAL_PRIMITIVES_IN_FRAME for the RD renderers as it was incorrectly reporting vertex/index count at times

This also adds memory tracking to textures and buffers to catch memory leaks.

This also cleans up some memory leaks that the new system caught.
2023-06-16 09:10:00 +02:00
Bastiaan Olij
d9eb9665da Draw frustum splices ontop of direction shadow atlas for debug purposes 2023-06-11 11:48:11 +10: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 +02: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 -04:00
Arman Elgudzhyan
7bcc849143 Use depth pass mode with normals if required even if Environment is null
If using normal buffer debugging or if the normal texture was used, we should use PASS_MODE_DEPTH_NORMAL_ROUGHNESS regardless of whether there is a valid Environment or not. Otherwise, shaders reading the normal texture will not work without a valid Environment (and possibly other problems).
2023-06-03 07:56:47 -07:00
Allen Pestaluky
4e19f34856 Changed Subtract blend mode of Forward+ and Mobile renderers to match behaviour of the Godot 3 and Compatibility renderers
The OpenGL implementation has used GL_FUNC_REVERSE_SUBTRACT for a long time, but the new RenderingDevice abstraction used by the Vulkan renderers had been mistakenly set to BLEND_OP_SUBTRACT instead of BLEND_OP_REVERSE_SUBTRACT.

Fixes #77448
2023-05-26 10:50:35 -04:00
Markus Grafen
8a3e829930 (Re-)Implemented Light3D's property "shadow_reverse_cull_face"
The parameter shadow_reverse_cull_face is now passed to the shadow pass so that the mesh back-faces are used for shadow map calculation.
2023-05-19 19:22:10 +02: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 +02:00
Max Hilbrunner
39d85308fd
Merge pull request #76109 from paddy-exe/fix-node-position-view 2023-05-05 14:35:41 +02:00
Johan Aires Rastén
8452e6cdb3 Add SPECULAR_AMOUNT spatial light shader built-in
Light3D has a light_specular property which is used to set the
intensity of specular contributed by this light source, but it was
previously only used by the default material light shader, and not
possible to use in a custom light() shader.
2023-05-04 09:15:12 +02:00
Patrick
e35bbd76a3 Fix Rotation Issue with NODE_POSITION_VIEW Visual Shader Node 2023-05-03 19:59:43 +02: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
Johan Aires Rastén
14a8124ffe Add LIGHT_IS_DIRECTIONAL built-in for spatial shaders 2023-04-20 14:33:30 +02:00
Rémi Verschelde
0ec2be1213
Merge pull request #76003 from clayjohn/double-particle-offset
Don't store instance transform origin in RD 3D renderer unless requested
2023-04-13 09:56:41 +02:00
clayjohn
29edd277e4 Don't store instance transform in RD 3D renderer unless requested
Previously, when using doubles builds of the engine, instance transform was stored no matter what which caused world space particles to accumulate the instance transform twice
2023-04-12 14:41:17 -07:00
clayjohn
9be0a73294 Add EXPOSURE built in to spatial shaders
This allows users to restore light values to pre-pre-exposure amounts
2023-04-12 10:35:13 -07:00
Yuri Sizov
ded38c5d75
Merge pull request #73839 from clayjohn/OUTPUT_IS_SRGB
Clean up OUTPUT_IS_SRGB redefinitions
2023-03-16 13:03:37 +01:00
clayjohn
1adc4e5875 Add a few more rendering timestamps 2023-03-02 18:15:21 -08:00
clayjohn
316cf04059 Clean up OUTPUT_IS_SRGB redefinitions 2023-02-23 12:56:42 -08:00
Bastiaan Olij
467d735eb1 Fix issue with default textures requiring arrays when using multiview 2023-02-22 16:50:58 +11:00
Yuri Rubinsky
94831c7209 Forbid passing multiview sampler to the custom function in shaders 2023-02-21 11:23:17 +03:00
Rémi Verschelde
e78b77481e
Merge pull request #73240 from myaaaaaaaaa/worker-h
Move some `worker_thread_pool.h` includes out of header files
2023-02-13 21:05:57 +01:00
myaaaaaaaaa
6f88392d02 Move some worker_thread_pool.h includes out of header files 2023-02-13 14:02:01 -05:00
Bastiaan Olij
694c8ec273 Add render buffer support to screen space effects 2023-02-10 10:27:59 +11:00
Rémi Verschelde
7990b76ad8
Merge pull request #63829 from clayjohn/VULKAN-disable-multiview
Disable multiview shader versions when xr is disabled
2023-02-01 07:58:32 +01: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 +01: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 +01:00
Bastiaan Olij
8c77aea9ab Expose EYE_OFFSET to gdshader code 2023-02-01 12:39:13 +11:00