Commit Graph

1296 Commits

Author SHA1 Message Date
Rémi Verschelde 0f3f8509ec
Merge pull request #65738 from BastiaanOlij/fix_ssao_ssil_memory_leak 2022-09-13 10:25:11 +02: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
clayjohn 96b7cb66df Fix multiwindow support in GLES3 for X11, Windows, and MacOS.
Instead of updating all viewports, then blitting all viewports
to the backbuffer, then swapping all buffers, we run through
all viewports and render, blit, and swap backbuffer before
going to the next viewport.
2022-09-12 17:30:50 -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 +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
Yuri Rubinsky e4a8646c19 Prevent duplicated hints in shader uniform completion 2022-09-11 15:21:43 +03:00
Johan Aires Rastén ddfa214d89 Allow emit_subparticle from start function
emit_subparticle was previously only allowed from the process function
in a particle shader, which seemed like an unnecessary limitation.
2022-09-11 14:02:36 +02:00
clayjohn 65f0113bc6 Properly scale SSR reflection based on metallic value for dielectric materials 2022-09-09 16:52:02 -07:00
ZuBsPaCe 3d08678e13 Sibling SubViewports must be rendered from top to bottom
Sibling SubViewports must be rendered in the same order as in the Scene Tree, from top to bottom. _sort_active_viewports() reversed their order.
Fixes #65545
2022-09-09 17:50:14 +02:00
Yuri Rubinsky d1be14a9cb
Merge pull request #65473 from Chaosus/shader_fix_completion 2022-09-07 21:23:39 +03:00
Haoyu Qiu eea02e50a7 Fix crash when executing `VisualShaderNodeParticleMeshEmitter.set_mesh` with headless Godot 2022-09-07 21:31:16 +08:00
Yuri Rubinsky 47145800a6 Remove `shader_type` from completion (when it does not need any more) 2022-09-07 16:19:36 +03:00
Rémi Verschelde 5062aafc2d Merge pull request #64417 from aaronfranke/has-space
Replace AABB/Rect2/Rect2i has_no_* methods with has_* methods
2022-09-06 17:00:44 +02: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
Haoyu Qiu 52f290ae4d Fix crash when executing `CSGMesh3D.set_mesh` with headless Godot 2022-09-05 09:15:22 +08: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
Rémi Verschelde d58a1d65a9
Merge pull request #63413 from Calinou/volumetric-fog-add-per-light-energy-2
Add a per-light volumetric fog energy property
2022-08-31 08:47:03 +02:00
Bastiaan Olij 708222bb9a Fix vector type for signed tangent in mobile shader 2022-08-31 16:35:54 +10:00
Haoyu Qiu ad6d6a7893 Remove unnecessary `print_line` in RendererDummy 2022-08-31 09:44:02 +08: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 c1b178be38
Merge pull request #65068 from BastiaanOlij/fix_dummy_mesh_allocation 2022-08-30 19:49:36 +02:00
Rémi Verschelde 02d510bd07
Merge pull request #63003 from Geometror/msaa-2d 2022-08-30 14:54:20 +02:00
Bastiaan Olij 9efff344b8 Dummy mesh support was added to the dummy renderer but incomplete. This completes it 2022-08-30 16:28:39 +10: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
Rémi Verschelde 5d78ab4388
Merge pull request #64749 from tefusion/fix_skeleton_editor_mesh_free_errors
Fix typo in RendererSceneCull which caused mesh_free errors
2022-08-25 18:54:25 +02:00
Yuri Rubinsky d4a10e7e04 Allow using integer varyings with `flat` interpolation modifier 2022-08-25 13:21:02 +03:00
Rémi Verschelde 91e5f48ea7
Merge pull request #64009 from KoBeWi/arrayy_lmao
Replace Array return types with TypedArray (part 2)
2022-08-24 08:18:56 +02:00
kobewi 1abdffe7a0 Replace Array return types with TypedArray 2 2022-08-23 23:21:32 +02:00
Rémi Verschelde 8317ff74d6
Merge pull request #63091 from MinusKube/editor-window-render-bug 2022-08-23 12:59:34 +02:00
bruvzg bcc3643989
Add font LCD sub-pixel anti-aliasing support. 2022-08-23 08:47:21 +03:00
tefusion a2c422a6da Fix typo in RendererSceneCull
Frees skeleton 3d gizmo now correctly
2022-08-22 22:09:56 +02: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
Yuri Rubinsky 499fd0a4e7 Add `defined` keyword support to shader preprocessor 2022-08-20 11:26:59 +03: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
Yuri Rubinsky 8779f51a5e
Merge pull request #63960 from bitsawer/fix-macro-expansion 2022-08-19 23:37:47 +03: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
Yuri Rubinsky 35cfaafda8
Merge pull request #64459 from Chaosus/shader_elif 2022-08-19 07:01:22 +03:00
Aaron Franke f91934872d
Use a const ref for the bone AABB in rendering code 2022-08-18 12:20:11 -05:00
Clay John 982ff7d925
Merge pull request #64416 from aaronfranke/aabb
Don't try to merge unused bone AABBs in the rendering server
2022-08-17 23:56:05 -06:00
Yuri Rubinsky 13ab70ed2a Add `elif` directive to shader preprocessor 2022-08-15 22:06:49 +03:00
Aaron Franke e0d80b37e9
Don't try to merge unused bone AABBs in the rendering server 2022-08-14 23:30:48 -05:00
Yuri Rubinsky 22df2c527b Implement coloring for disabled branches in the shader editor 2022-08-14 13:57:26 +03: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
Yuri Rubinsky f2a6168414
Merge pull request #64310 from Chaosus/shader_texture_funcs 2022-08-12 21:28:22 +03:00
Yuri Rubinsky e21aad968d Add `textureQueryLod/Levels` functions to the shader language 2022-08-12 20:44:57 +03:00
Yuri Rubinsky 7822fbc9e2 Add `textureProjGrad` function to the shader language 2022-08-12 12:01:37 +03: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
MinusKube be09a87ff9 Fix viewport sorting being wrong on parent/child relation 2022-08-10 01:23:23 +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
Rémi Verschelde f754dd20be
Merge pull request #62454 from Geometror/reflect-refract-vec2-vec4
Allow for vec2/vec4 to be used in reflect and refract
2022-08-07 19:16:05 +02:00
Hendrik Brucker b8d5f4bdd5 Allow vec2 and vec4 for reflect and refract 2022-08-07 18:03:16 +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
bitsawer 691e067ef5 Fix shader preprocessor macro expansion 2022-08-05 17:41:24 +03: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
Rémi Verschelde 15fdf7bc86
Merge pull request #58611 from Calinou/ssr-fix-blend-margin
Fade screen-space reflection towards inner margin
2022-08-03 07:54:59 +02:00
Yuri Rubinsky 988041b74c
Merge pull request #63847 from Zylann/shader_switch_uint 2022-08-03 08:05:19 +03: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
Marc Gilleron 779a5cd34a Allow shading language to use `switch` statement with uints 2022-08-02 23:08:41 +01: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
Rémi Verschelde f450f242b9
Merge pull request #62639 from Calinou/line-antialiasing-decrease-feather-width 2022-08-02 21:00:01 +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