Commit graph

810 commits

Author SHA1 Message Date
clayjohn
aac8d5c406 Properly initialize motion vectors offset when motion vectors are disabled.
This fixes an uninitialized memory bug that caused particles to fail in non-LTO builds
2022-09-22 20:36:01 -07:00
Rémi Verschelde
d1a155e3cd Fix various -Wmaybe-uninitialized warnings from GCC 12.2.1
Not sure why I didn't get those before, it may be due to upstream
changes (12.2.1 is a moving target, it's basically 12.3-dev), or simply
rebuilding Godot from scratch with different options.
2022-09-22 11:29:48 +02: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
Rémi Verschelde
7da532275b Merge pull request #65541 from clayjohn/renderer-setting
Split rendering driver project setting into renderer_name and rendering_driver
2022-09-20 09:43:59 +02:00
Rémi Verschelde
effddbcf12 Merge pull request #66065 from kidinashell/issue-59488
SpotLight3D's and OmniLight3D's Projector doesn't work
2022-09-19 22:02:17 +02:00
clayjohn
4a1c7de57c Split rendering driver project setting into renderer_name and rendering_driver. To differentiate between a driver (e.g. Vulkan or D3D12) and a renderer (e.g. clustered or mobile renderer). 2022-09-19 10:26:10 -07:00
Tobias Widner
422bacbfd1 Fix Vulkan: SpotLight3D's and OmniLight3D's Projector doesn't work 2022-09-19 17:18:45 +02:00
Rémi Verschelde
49891e4c2f Merge pull request #65915 from clayjohn/VULKAN-mobile-fog
Restore fog in vulkan mobile renderer.
2022-09-19 09:23:24 +02:00
clayjohn
2ecc8b9a73 Restore fog in vulkan mobile renderer.
The condition accidentally disabled fog whenever it was enabled
2022-09-16 09:18:11 -07:00
Rémi Verschelde
bda63e1b5a Merge pull request #65833 from JFonS/taa_fix_particles_errors
Fix error spam in the renderer when using GPUParticles3D
2022-09-16 11:59:00 +02:00
JFonS
b668268772 Fix error spam in the renderer when using GPUParticles3D
The flag INSTANCE_DATA_FLAG_MULTIMESH is used for both multimesh and particles instances, this commit adds a new INSTANCE_DATA_FLAG_PARTICLES flag to discriminate between them.

This flag will also be used in the future to properly support TAA in particles.
2022-09-16 09:44:22 +02:00
Rémi Verschelde
848668ed45 Merge pull request #65794 from Geometror/fix-canvas-backbuffer
Fix/restore BackBufferCopy
2022-09-16 09:20:04 +02:00
Bastiaan Olij
02ea1de7d0 Extract shared scene data into a separate class 2022-09-15 12:09:57 +10:00
Hendrik Brucker
e235bca995 Fix/restore BackBufferCopy 2022-09-15 02:36:39 +02:00
Rémi Verschelde
ecaa7b634e
Merge pull request #65322 from ceLoFaN/fix-dof-artifact-at-high-blur 2022-09-15 00:03:40 +02:00
Rémi Verschelde
957aa79ce0
Merge pull request #65789 from clayjohn/sky-update-bug
Clear last frame directional light buffer when number of lights changes.
2022-09-14 19:06:19 +02: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
72d899702b Clear last frame directional light buffer when number of lights changes.
This ensures that the buffers don't go out of sync.
2022-09-14 08:30:35 -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
Bastiaan Olij
873366cb2d Fix uniform buffer being created every frame is SSAO and SSIL half_size is different 2022-09-13 17:49:32 +10: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 +02: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 +02:00
Rémi Verschelde
f211869530
Merge pull request #65594 from clayjohn/SSR-dialectric 2022-09-12 14:23:04 +02:00
Bastiaan Olij
b519d7619c Fixed MSAA initialisation in clustered forward renderer 2022-09-12 11:07:51 +10: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 +03:00
Aaron Franke
817ae95667
Replace AABB has_no_volume with has_volume
Also replace has_no_surface with has_surface
2022-09-04 23:03:36 -05:00
Rémi Verschelde
3a62c294c7 Merge pull request #65170 from KoBeWi/your_argument_is_TypedArray 2022-09-02 13:57:02 +02:00
Rémi Verschelde
c82bbc38a5 Merge pull request #64952 from Chaosus/vs_rename_uniform_to_param 2022-09-02 13:49:53 +02:00
Rémi Verschelde
d63c6fc463 Merge pull request #60185 from Calinou/environment-fog-and-sky-affect 2022-09-01 23:52:34 +02: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 +02:00
kobewi
7adc8376ed Change Array arguments to TypedArray 2022-09-01 13:13:19 +02:00
Bastiaan Olij
2cd84be64d Extracting render buffers and changing it to a more generic solution 2022-09-01 20:01:45 +10:00
Yuri Rubinsky
8191b3c110 Rename uniform to parameter across the engine 2022-09-01 11:42:57 +03: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 +02:00
Bastiaan Olij
708222bb9a Fix vector type for signed tangent in mobile shader 2022-08-31 16:35:54 +10: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 +02:00
Rémi Verschelde
02d510bd07
Merge pull request #63003 from Geometror/msaa-2d 2022-08-30 14:54:20 +02:00
Aaron Franke
10a56981dc
Rename String plus_file to path_join 2022-08-29 19:38:13 -05:00
sakrel
728fb6ea95
Fix updating OccluderPolygon shapes 2022-08-29 03:51:53 +02:00
Rémi Verschelde
4808d01b2b
Merge pull request #64223 from Calinou/taa-fxaa-use-negative-mipmap-lod-bias
Automatically use negative mipmap LOD bias when TAA and/or FXAA are enabled
2022-08-26 23:11:25 +02:00
Rémi Verschelde
f9f2446972
Merge pull request #64367 from Mickeon/rename-var-to-str
Rename `str2var` to `str_to_var` and similar
2022-08-26 23:04:06 +02:00
Micky
59e11934d8 Rename str2var to str_to_var and similar
Affects the Math class, a good chunk of the audio code, and a lot of other miscellaneous classes, too.

- `var2str` -> `var_to_str`
- `str2var` -> `str_to_var`
- `bytes2var` -> `bytes_to_var`
- `bytes2var_with_objects` -> `bytes_to_var_with_objects`
- `var2bytes` -> `var_to_bytes`
- `var2bytes_with_objects` -> `var_to_bytes_with_objects`
- `linear2db` -> `linear_to_db`
- `db2linear` -> `db_to_linear`
- `deg2rad` -> `deg_to_rad`
- `rad2deg` -> `rad_to_deg`

- `dict2inst` -> `dict_to_inst`
- `inst2dict` -> `inst_to_dict`
2022-08-26 14:58:22 +02:00
Rémi Verschelde
7013c68619
Merge pull request #64422 from bruvzg/make_fonts_unbearably_ugly_2.0 2022-08-26 11:59:07 +02:00
Micky
723bf85145 Rename ParticlesMaterial to ParticleProcessMaterial
Also affects their file names, related classes and documentation.
2022-08-26 02:53:08 +02:00
Hugo Locurcio
45bc1a3790
Automatically use negative mipmap LOD bias when TAA and/or FXAA are enabled
This improves texture sharpness when TAA and/or FXAA are enabled,
without requiring manual user intervention.
2022-08-25 19:38:18 +02:00
bruvzg
bcc3643989
Add font LCD sub-pixel anti-aliasing support. 2022-08-23 08:47:21 +03:00
Rémi Verschelde
7b4927bb5f
Merge pull request #60309 from The-O-King/oct 2022-08-22 19:29:21 +02: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
Hugo Locurcio
0c5f254956
Merge pull request #64110 from Geometror/fix-light-shadow-off 2022-08-20 17:06:03 +02:00
Max Hilbrunner
5e0d2b5097
Merge pull request #62046 from clayjohn/vertexless-draw
Allow creating meshes without vertex positions
2022-08-20 05:32:28 +02:00
Hendrik Brucker
18585c69b3 Fix OmniLight/SpotLight shadow opacity calculation 2022-08-20 01:05:44 +02:00
clayjohn
bbbcdd725a Remove requirement to have vertex positions when creating a mesh. Meshes can now be constructed from an index buffer alone 2022-08-19 14:50:12 -06:00
Max Hilbrunner
019d6584ee
Merge pull request #64167 from clayjohn/screen-texture-hint
Add shader uniform hints for screen textures
2022-08-19 21:51:39 +02:00
Max Hilbrunner
117c530e1d
Merge pull request #64342 from clayjohn/DOF-scale
Properly scale depth in bokeh_dof effect
2022-08-19 21:16:32 +02:00
Aaron Franke
f91934872d
Use a const ref for the bone AABB in rendering code 2022-08-18 12:20:11 -05:00
Aaron Franke
e0d80b37e9
Don't try to merge unused bone AABBs in the rendering server 2022-08-14 23:30:48 -05: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
Hendrik Brucker
e96b1a2c0c Implement MSAA for 2D [Vulkan only] 2022-08-13 01:09:48 +02: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 -06:00
Hugo Locurcio
ff9118d103
Merge pull request #64225 from Calinou/3d-scaling-bilinear-use-negative-mipmap-bias 2022-08-11 21:41:37 +02:00
clayjohn
7c848ee591 Detect if VRS supported before creating default VRS texture 2022-08-10 13:27:19 -06:00
Hugo Locurcio
b06890c2b7
Use negative mipmap LOD bias for sub-native bilinear 3D scale
This provides a benefit similar to FSR 1.0 (greater texture sharpness
at the cost of some graininess at sub-native resolution scales), but
without the added performance cost of FSR 1.0.
2022-08-10 17:16:02 +02:00
clayjohn
028ef2edc8 Add shader uniform hints for screen textures so users can specify custom filter and repeat modes.
At this time, it works best in the Vulkan Renderers as they support using multiple samplers with the same texture.

In GLES3 this feature really only allows you to use the screen texture without mipmaps if you want to save the cost of generating them.
2022-08-09 12:29:49 -04:00
Bastiaan Olij
f50f0844e9 Fix resource leaks in VoxelGI 2022-08-09 15:18:03 +10:00
bruvzg
e7464e7a30
Fix macOS and iOS defines in the rendering code. 2022-08-08 17:51:31 +03:00
Rémi Verschelde
8734ef1f7a
Merge pull request #62547 from clayjohn/ref_vec_pbr 2022-08-08 10:18:32 +02: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 +02:00
Juan Linietsky
f999f52f0a Add a Framebuffer cache
Adds a FramebufferCache singletion that operates the same way as UniformSetCache.

Allows creating framebuffers on the fly (and keep them cached if re-requested) such as:

```C++
RID fb = FramebufferCache::get_singleton()->get_cache(texture1,texture2);
```
2022-08-05 13:37:29 +02:00
Hugo Locurcio
db22b7ded0
Rename shader parameter uniform setter/getter methods for consistency
`shader_uniform` is now consistenly used across both per-shader
and per-instance shader uniform methods. This makes methods easier
to find in the class reference when looking for them.
2022-08-04 23:17:06 +02:00
Rémi Verschelde
8a9700c8a7 Force disable S3TC support on Android/iOS since we don't handle it
Fixes #63909 for now.
This could be improved in the future if we want to properly support S3TC on mobile.
2022-08-04 18:27:56 +02:00
Rémi Verschelde
2c0c76c415
Merge pull request #61851 from Calinou/particles-default-global-coordinates 2022-08-03 11:38:23 +02:00
Rémi Verschelde
b27f06550c
Merge pull request #51531 from Calinou/decal-projector-add-nearest-mipmap-aniso 2022-08-03 11:37:28 +02:00
Hugo Locurcio
d041ca6c02
Add Nearest Mipmap Anisotropic filter option to decals and projectors
This is consistent with the BaseMaterial3D filtering options.
It can be used for high-quality pixel art textures that remain sharp
when viewed at oblique angles, but prevents them from becoming grainy
thanks to mipmaps.
2022-08-03 03:49:15 +02: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 +02:00
Hugo Locurcio
84076513b1
Use global coordinates for particles by default
Particles won't move or rotate anymore with the node (or its parents)
by default. This new default behavior is generally more suited
to most use cases. Local coordinates can still be enabled on a per-node basis.

This affects both 2D and 3D particles, and both CPU and GPU-based particles.
2022-08-02 23:25:02 +02:00
Patrick Exner
fe5901310e Add spatial built-ins (camera-pos, object-pos, camera-eye etc.) 2022-08-02 17:30:41 +02:00
Rémi Verschelde
8cce479c01
Merge pull request #51672 from Calinou/shader-add-hint-transparent-texture
Add `hint_transparent` to use a transparent black placeholder texture
2022-08-02 07:15:59 +02: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 +02: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 +02:00
Hugo Locurcio
813f6a5d57
Add hint_transparent to use a transparent black placeholder texture
This can be used in shaders to avoid the need to supply a transparent
placeholder texture manually.
2022-08-01 23:38:06 +02:00
Pedro J. Estébanez
2df767d31e Fix uniform set creation error due to null RID 2022-08-01 21:59:13 +02:00
Yuri Rubinsky
9ec6de1767
Merge pull request #63766 from Chaosus/fix_shader_instance_uniform 2022-08-01 15:04:54 +03:00
Yuri Rubinsky
81c44718ca Fix passing values to the instance uniforms in the shader 2022-08-01 13:45:29 +03:00
Rémi Verschelde
121d6fdace
Merge pull request #63754 from BastiaanOlij/storage_struct_private
Changed storage structs to private
2022-08-01 09:37:36 +02: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 +02:00
Bastiaan Olij
81c6f73109 Changed storage structs to private 2022-08-01 11:59:14 +10: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
a0795b4347
Tweak VoxelGI defaults for better quality
Overall brightness is similar to the previous settings, but lighting
now fades off more naturally and reflections feature indirect lighting.
Performance is identical.

- Enable Use Two Bounces by default.
- Decrease Propagation to 0.5 to compensate for the second bounce.
2022-07-31 18:05:24 +02: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 +02:00
LinuxUserGD
6e6569aa78 fix 'Comparison result is always the same' warnings 2022-07-29 19:45:22 +02:00
Rémi Verschelde
7199314eb3
Merge pull request #63595 from reduz/remove-signal-connect-binds
Remove Signal connect binds
2022-07-29 18:10:39 +02:00
Andreas Raddau
dfc6035ce1 Fix vector field particle attractor texture sampling 2022-07-29 16:52:54 +02:00
Juan Linietsky
d4433ae6d3 Remove Signal connect binds
Remove the optional argument p_binds from `Object::connect` since it was deprecated by Callable.bind().
Changed all uses of it to Callable.bind()
2022-07-29 16:26:13 +02:00
Pedro J. Estébanez
278950f731 Keep SdfgiDebug shader's push constant size <= 128 2022-07-29 13:25:11 +02:00
Rémi Verschelde
2bf8c4a6d0
Merge pull request #63527 from BastiaanOlij/rework_environment
Restructure environment in render implementation
2022-07-29 08:05:40 +02:00
Bastiaan Olij
f579125eeb Restructure environment in render implementation 2022-07-29 12:24:32 +10:00
Rémi Verschelde
8e0f328a80
Merge pull request #59840 from Calinou/renderingserver-global-uniform-rename 2022-07-28 20:34:17 +02:00