Commit Graph

1335 Commits

Author SHA1 Message Date
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
Rémi Verschelde 8de2cc04a7
Merge pull request #63793 from RandomShaper/fix_unbound_resource
Fix uniform set creation error due to null RID
2022-08-02 07:10:20 +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
Rémi Verschelde 67c5741c03
Merge pull request #63767 from kubecz3k/fix/headless-collision 2022-08-01 22:04:09 +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
Jakub Grzesik 3c55637459 fix for headless collision shape generation
this commit implements just enough of dummy mesh_storage so collision shapes are still generated in the headless mode
implementation was inspired by rasterizer_dummy.h from Godot3
2022-08-01 12:38:07 +02: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 de53e91b85
Merge pull request #55276 from Calinou/volumetric-fog-tweak-default-gi-inject
Tweak default fog settings for better appearance
2022-08-01 07:55:53 +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
Hugo Locurcio e35e79b802
Tweak default fog settings for better appearance
- Increase the default non-volumetric fog density to 0.01 to make
  adjustments more visible.
- Use a less saturated non-volumetric fog color by default
  (a mix of the sky and horizon colors of the new default
  ProceduralSkyMaterial).
- Set Volumetric Fog Gi Inject to 1.0 by default. Injecting GI results
  in more realistic appearance of volumetric fog, at a very low
  performance cost.
2022-08-01 02:04:20 +02: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
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 +02:00
Hugo Locurcio e24029edc3
Allow changing mipmap LOD bias when FSR 1.0 scaling is not used
Mipmap LOD bias can be useful to improve the appearance of distant
textures without increasing anisotropic filtering (or in situations
where anisotropic filtering is not effective).

`fsr_mipmap_bias` was renamed to `texture_mipmap_bias` accordingly.
The property hint now allows for greater precision as well.
2022-07-28 17:51:13 +02:00
Rémi Verschelde 82811367cb
Merge pull request #63571 from RandomShaper/conservative_validate_vrs 2022-07-28 15:34:47 +02:00
Pedro J. Estébanez 5f71b55380 Improve handling of the format of the VRS image
- Validate format conservatively. (This is to have VRS images created regardless whether VRS attachments are supported, which avoids errors in places where the code assumes such images were created on low-spec GPUs.)
- Create a non-layered default VRS image, which is what Vulkan (and D3D12, by the way) expect.
2022-07-28 12:24:03 +02:00
Rémi Verschelde 199ea349f5
Merge pull request #57698 from bluenote10/feature/rename_translated_to_translated_local 2022-07-28 10:03:07 +02:00
Bastiaan Olij 1dd671014b Add startup flag to override XR mode settings 2022-07-28 11:50:34 +10:00
Rémi Verschelde bb94e16bd8
Merge pull request #63406 from Zylann/init_viewport_fields 2022-07-27 12:29:05 +02:00
Rémi Verschelde a7335b00e6
Merge pull request #62362 from clayjohn/VULKAN-halo 2022-07-27 11:17:34 +02:00
Rémi Verschelde cade90a807
Merge pull request #58296 from Calinou/decal-distance-fade-tweak-defaults 2022-07-27 09:44:47 +02:00
Rémi Verschelde d5ec1a9650
Merge pull request #63477 from Chaosus/shader_fix_fog 2022-07-27 09:35:30 +02:00
clayjohn 7e7c6995e3 Use full size mipmaps for reflections when in high-quality mode 2022-07-26 23:53:05 -07:00
Yuri Rubinsky 05bc55b2ad
Merge pull request #63522 from Chaosus/shader_fix_projection 2022-07-27 09:38:14 +03:00
Yuri Rubinsky 2dc59a3eea Fix incorrect conversion of default value for mat4 uniform in shaders 2022-07-27 09:06:18 +03:00
Yuri Rubinsky bbf76faf86 Fix `FOG` built-in in spatial/fragment shader 2022-07-27 08:31:06 +03:00
Bastiaan Olij 0bd042c601 Change RendererSceneRender::GeometryInstance so more code is shared among renderers 2022-07-27 12:32:07 +10:00
Hugo Locurcio a151a74a98
Tweak Decal distance fade defaults and add property hints
The new default values are more usable in real world scenarios
when smooth fading of distant decals is desired for performance reasons.

The Decal distance fade property hints were adjusted based on the
GeometryInstance3D visibility range fade property hints. `or_greater`
was also added to allow specifying larger values if needed.
2022-07-27 03:15:46 +02:00
Rémi Verschelde 2d2b85d400
Merge pull request #62972 from Chaosus/shader_groups
Implement shader uniform groups/subgroups
2022-07-26 15:16:33 +02:00
Rémi Verschelde f94b4dbe22
Merge pull request #63236 from halgriffiths/fix-texture-rect-transpose
send FLAGS_TRANSPOSE_RECT to Vulkan
2022-07-26 13:22:32 +02:00
Yuri Rubinsky 886c2d9681 Implement shader uniform groups/subgroups 2022-07-26 11:26:09 +03:00
Bastiaan Olij bad5c659a4 Move Sky(RD) into environment
Move Fog logic from render scene render to fog
2022-07-26 10:19:40 +10:00
Juan Linietsky c7255388e1 Remove ThreadWorkPool, replace by WorkerThreadPool
The former needs to be allocated once per usage. The later is shared for all threads, which is more efficient.
It can also be better debugged.
2022-07-25 15:39:50 +02:00
Rémi Verschelde 49b0aa93e3
Merge pull request #63424 from Chaosus/shader_preprocessor_inc_fix 2022-07-25 14:56:06 +02:00
Yuri Rubinsky be3fb7a216 Fix errors when using built-ins in shaderinc 2022-07-25 12:33:04 +03:00
Rémi Verschelde 90019676b0 Code quality: Fix header guards consistency
Adds `header_guards.sh` bash script, used in CI to validate future
changes. Can be run locally to fix invalid header guards.
2022-07-25 11:17:40 +02:00
Rémi Verschelde 3084a48ace
Merge pull request #63219 from reduz/implement-vector4-projection 2022-07-25 11:13:27 +02:00
Marc Gilleron 5690f47135 Initialize default values for viewports in rendering server.
Example with TAA: by default it is `false` in project settings and in
the Viewport node. When the scene tree is created, Viewport.set_use_taa()
is called with the value from ProjectSettings. But because the default
values are already the same, RenderingServer isn't called.
The Viewport struct in the RenderingServer does not initialize this field,
so TAA gets randomly enabled when the game starts with default settings.
2022-07-24 21:39:06 +01:00
reduz 455c06ecd4 Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection.

* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.

These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.

**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
2022-07-23 14:00:01 +02:00
Yuri Rubinsky 6d992abb54 Fix some errors after shader preprocessor PR 2022-07-23 09:38:59 +03:00
Rémi Verschelde fe929d4787
Merge pull request #62513 from reduz/shader_preprocessor_remake 2022-07-23 00:02:33 +02:00
Rémi Verschelde 4f7bfacfcd
Merge pull request #62478 from BastiaanOlij/split_effects_20220628 2022-07-22 23:44:52 +02:00
reduz f649678402 Clean up Shader Preprocessor
* Moved preprocessor to Shader and ShaderInclude
* Clean up RenderingServer side
* Preprocessor is separate from parser now, but it emits tokens with include location hints.
* Improved ShaderEditor validation code
* Added include file code completion
* Added notification for all files affected by a broken include.
2022-07-22 22:53:03 +02:00
Yuri Roubinsky 7b94603baa Adding shader preprocessor support
Co-authored-by: TheOrangeDay <6472143+TheOrangeDay@users.noreply.github.com>
2022-07-22 22:51:57 +02:00
halgriffiths d37ebc2bdc send FLAGS_TRANSPOSE_RECT to Vulkan 2022-07-22 13:49:04 +01: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 -04:00
bruvzg 8823eae328
Rename OSX to macOS and iPhoneOS to iOS. 2022-07-21 09:37:52 +03:00
Bastiaan Olij eefcb5ed67 Move screen space effects into a separate class 2022-07-19 13:27:39 +10:00
Rémi Verschelde abe8b88702
Merge pull request #62834 from RandomShaper/fix_vk_sky_error
Bind correct default resource type in GI
2022-07-18 23:39:21 +02:00
Rémi Verschelde d29e17d9d2
Merge pull request #63057 from sakrel/vulkan-fix-2d-shadows 2022-07-18 21:53:12 +02:00
Rémi Verschelde 9276c65522
Merge pull request #62265 from d-robbins/specular_shininess_used 2022-07-18 21:35:46 +02:00
Rémi Verschelde 5bea531228
Merge pull request #62848 from RandomShaper/shader_writability_improvement 2022-07-18 15:11:42 +02:00
Pedro J. Estébanez 4ac2008782 Make SDFGI direct light shader follow the same-writability rule 2022-07-18 14:46:29 +02:00
David R c2b0a873c2 added usage_defines for SPECULAR_SHININESS
added usage defines for opengl3 renderer
2022-07-18 00:45:42 +02: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 +10:00
Fabian Keller 2bf9e6090c rename translate(d) to translate(d)_local in Transform 2D/3D 2022-07-16 11:47:54 +02:00
sakrel 16a8967757 Fix DirectionalLight2D and PointLight2D shadows not rendering correctly 2022-07-15 23:55:15 +02:00
Rémi Verschelde 7e49c8c30e
Merge pull request #62947 from BastiaanOlij/fix_mesh_instance_free 2022-07-14 00:05:25 +02:00
Hugo Locurcio 21ea1c3835
Rename soft shadow quality project settings for easier searching
`rendering/quality/shadows` is now `rendering/quality/positional_shadow`
to explicitly denote that the settings only affect positional light shadows,
not directional light shadows.

Shadow atlas settings now contain the word "atlas" for easier searching.

Soft shadow quality settings were renamed to contain the word "filter".
This makes the settings appear when searching for "filter" in the
project settings dialog, like in Godot 3.x.
2022-07-13 19:56:02 +02:00
Bastiaan Olij 6930ad2777 Fix typo, call mesh_instance_free not mesh_free 2022-07-12 22:30:08 +10: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 +02:00
Pedro J. Estébanez ba39230ef3 Bind correct default resource type in GI 2022-07-08 19:07:28 +02:00
Xentripetal f514b82fd3 Account for relative z-indexes when y-sorting 2022-07-08 09:18:00 -05:00
Rémi Verschelde 99df193bea
Merge pull request #62277 from RandomShaper/depth_buffer_no_sampling
Rationalize certain cases of texture usage flags
2022-07-08 11:34:09 +02:00
Yuri Rubinsky 3dc1a1dbfb Prevent possible crash when mesh is freed 2022-07-06 19:52:54 +03:00
lawnjelly 1f69666209 Remove Octree
Octree is no longer used in 4.x.
2022-07-06 14:10:05 +01:00
Rémi Verschelde 55fca1cb94
Merge pull request #62344 from BastiaanOlij/extract_dependencies 2022-07-06 13:24:46 +02:00
Hugo Locurcio c9037a8d2c
Remove unused anisotropy setter/getter methods in VoxelGI
These methods weren't exposed to the scripting API.

Anisotropy was used in earlier iterations of VoxelGI, but it was
removed as it was too expensive.
2022-07-06 02:40:49 +02:00
Hugo Locurcio cf1ce8494d
Improve antialiased line drawing sharpness and respect of original width
Antialiased lines with a width of 2 pixels or more now use a smaller
feather width of 1.25 instead of 2.0. This makes them look sharper
and better preserves their original shape while still having good
antialiasing quality.

This also improves the appearance of thin antialiased lines by
slightly increasing their feather size (from 1.0 to 1.25). It
makes them appear a tad thicker, but the antialiasing quality is
much improved by doing this.
2022-07-02 18:45:42 +02:00
Rémi Verschelde 6bbfd160b0 SCons: Properly track codegen script dependency for generated GLSL headers 2022-07-02 16:01:48 +02:00
Hugo Locurcio f9e6b292e2
Remove debugging print following GI reorganization 2022-07-01 20:08:10 +02:00
clayjohn 93c82ab4b9 Evaluate specular reflections using specular dominant direction instead of assuming mirror reflections 2022-06-29 23:36:18 -07:00
Rémi Verschelde 2d28bb8364
Merge pull request #62482 from JFonS/fix_crash_canvas_mode 2022-06-28 15:31:51 +02:00
Rémi Verschelde d53f1fb388
Merge pull request #60935 from Calinou/geometryinstance3d-gi-mode-default-static
Use the Static global illumination mode in GeometryInstance3D by default
2022-06-28 14:40:53 +02:00
JFonS 8102db90bc Fix crash in Environment "Canvas" background mode. 2022-06-28 13:25:18 +02:00
Rémi Verschelde 16d9918b51
Merge pull request #62467 from RandomShaper/descriptor_rw_matters
Consider uniform writability part of the interface of the set
2022-06-28 08:25:38 +02:00
Je06jm c2550e1cc0 Fixed FSR. Before, it was commiting the
raw render to the screen. Now, it commits
the fsr upscaled image
2022-06-27 18:01:12 -06:00
Pedro J. Estébanez fc6ac4a155 Consider uniform writability part of the interface of the set 2022-06-27 21:56:18 +02:00
Bastiaan Olij ecfcfd97fa Split dependency logic
Split FOG
Split visibility notifier
Final cleanup of storage classes
2022-06-28 00:10:29 +10:00
Pedro J. Estébanez 678a9ca221 Rationalize certain cases of texture usage flags
- Check for exhaustive usage flags for depth buffer
- Remove uneeded storage flag from normal-roughness buffer
2022-06-27 11:28:38 +02:00
Bastiaan Olij 4e8e10a186 Fix typo in roughness shaders 2022-06-26 12:43:21 +10:00
Bastiaan Olij 6224b00365 Moved cube_to_dp and cubemap logic into CopyEffects 2022-06-24 18:04:28 +10:00
Hugo Locurcio 610363add0
Use the Static global illumination mode in GeometryInstance3D by default
This makes VoxelGI and SDFGI work out of the box with primitive meshes,
loaded OBJ meshes and CSG nodes.
2022-06-23 22:34:23 +02:00
Rémi Verschelde 051fb86fb0
Merge pull request #61221 from BastiaanOlij/split_gi_effects 2022-06-23 12:28:10 +02:00
Rémi Verschelde d8ef904ffc
Merge pull request #35758 from zmanuel/eliminate-draw-pending
Remove redundant thread sync counter draw_pending
2022-06-22 18:20:41 +02:00
Rémi Verschelde e21db7723a
Merge pull request #62286 from JFonS/taa_global_time 2022-06-22 16:59:08 +02:00
Rémi Verschelde 95cafc7bcf
Merge pull request #62305 from JFonS/taa_molten_mobile_workaround 2022-06-22 16:58:31 +02: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 +02:00
JFonS 9b4e07f866 Workaround MoltenVK shader conversion error 2022-06-22 11:58:50 +02:00
Bastiaan Olij 997810e417 Split GI effects and fix stereoscopic rendering of GI effects 2022-06-22 12:50:17 +10:00
Rémi Verschelde 40c360b870
Merge pull request #62122 from reduz/implement-movie-writer
Implement a Movie Maker mode
2022-06-21 14:24:14 +02:00
reduz 5786516d4d Implement Running Godot as Movie Writer
* Allows running the game in "movie writer" mode.
* It ensures entirely stable framerate, so your run can be saved stable and with proper sound (which is impossible if your CPU/GPU can't sustain doing this in real-time).
* If disabling vsync, it can save movies faster than the game is run, but if you want to control the interaction it can get difficult.
* Implements a simple, default MJPEG writer.

This new features has two main use cases, which have high demand:
* Saving game videos in high quality and ensuring the frame rate is *completely* stable, always.
* Using Godot as a tool to make movies and animations (which is ideal if you want interaction, or creating them procedurally. No other software is as good for this).

**Note**: This feature **IS NOT** for capturing real-time footage. Use something like OBS, SimpleScreenRecorder or FRAPS to achieve that, as they do a much better job at intercepting the compositor than Godot can probably do using Vulkan or OpenGL natively. If your game runs near real-time when capturing, you can still use this feature but it will play no sound (sound will be saved directly).

Usage:

$ godot --write-movie movie.avi [scene_file.tscn]

Missing:

* Options for configuring video writing via GLOBAL_DEF
* UI Menu for launching with this mode from the editor.
* Add to list of command line options.
* Add a feature tag to override configurations when movie writing (fantastic for saving videos with highest quality settings).
2022-06-21 11:28:47 +02:00
reduz 141c375581 Clean up Hash Functions
Clean up and do fixes to hash functions and newly introduced murmur3 hashes in #61934
* Clean up usage of murmur3
* Fixed usages of binary murmur3 on floats (this is invalid)
* Changed DJB2 to use xor (which seems to be better)
2022-06-20 12:54:19 +02: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 +02:00
Bastiaan Olij b4821fe2e0 Introduce eye_offset for correcting stereoscopic reflections
Use view instead of vertex for reflections.
2022-06-17 19:39:34 +10: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 +02:00
clayjohn a94110d0c6 Remove GLES2 shader constraints from GLES3 2022-06-14 12:01:52 -07:00
Hugo Locurcio 0225c6d31a
Tweak Light3D property hints for greater flexibility
- Specular can now be set above 1.0.
- Blur can be set to 0 to disable shadow blurring entirely, which is useful
  on lights that have a non-zero size.
  - When shadow blurring is disabled, lights that have a non-zero size will
    not use PCSS-like soft shadows, speeding up shadow rendering
    considerably.
- Some property hints now allow more precise values.
2022-06-13 14:31:46 +02:00
Yuri Rubinsky c9ae83b5ab Prevent defining float constant without number after exponent in shaders 2022-06-10 11:35:56 +03:00
Yuri Rubinsky 5dd7a1030d Fix incorrect sky rotation based on camera axis 2022-06-09 22:40:40 +03:00
Yuri Rubinsky d8842f1a4b Fix `TIME` compilation for custom functions in spatial shader 2022-06-09 20:12:25 +03:00
jfons 36382ab7eb Workaround MoltenVK error found in TAA implementation 2022-06-09 16:40:00 +02:00
clayjohn a0338553b5 Assign VIEWPORT_SIZE after validating screen_size to avoid crash when using ReflectionProbe 2022-06-08 15:01:12 -07:00
Rémi Verschelde 48dcafeed9
Merge pull request #61794 from clayjohn/VULKAN-viewport-size
Use RenderBuffer size instead of half extents for VIEWPORT_SIZE
2022-06-08 07:16:25 +02:00
clayjohn b6649828cd Use RenderBuffer size instead of half extents for VIEWPORT_SIZE in Vulkan spatial shaders 2022-06-07 15:01:20 -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 +02:00
Rémi Verschelde 361a401fbb
Merge pull request #61554 from Chaosus/shader_fix_hints 2022-06-03 17:26:18 +02:00
Bastiaan Olij 69b66ec425 Ensure has_os_features is safely called as it can't be called from within the construct of RenderingServerDefault on which it relies 2022-06-01 20:47:32 +10:00
Rémi Verschelde d8b0a8cd29
Merge pull request #61572 from clayjohn/ssao-license 2022-05-31 18:56:16 +02:00
clayjohn 06f356d41e Add and improve license attribution for SSAO and SSIL shader code 2022-05-31 09:42:50 -07:00
Yuri Rubinsky cf240a7ae0 Refactor shader hints 2022-05-31 11:51:47 +03:00
clayjohn 2ba53547c9 Fix error with !rb spam when using background color mode with reflection probes 2022-05-28 18:11:28 -07:00
clayjohn 7b71545652 Remove mesh and particles RD dependencies from canvas rendering server 2022-05-26 10:43:37 -07:00
Rémi Verschelde 20a1b85589
Merge pull request #61425 from clayjohn/GLES3-2D 2022-05-26 01:16:52 +02:00
clayjohn fb860265e0 Implement 2D Meshes and MultiMeshes in GLES3 backend 2022-05-25 15:46:24 -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 +02:00
GanidhuAbey 3c95a70081 Fix particle system from going inactive early
Prevents particles from freezing and dissapearing by resetting
it's inactive time when particles are emitted.
2022-05-24 17:31:21 -06:00
Rémi Verschelde 12ddaa36a6
Merge pull request #60641 from clayjohn/Sky-ign
Use IGN instead of white noise for sky dithering
2022-05-24 23:34:41 +02:00
clayjohn 3e20c1347d Add clipping, backbuffer, and CanvasGroups to 2D GLES3 renderer
As well as significant consequent cleanup in the RenderTarget, Texture, and Canvas renderer code
2022-05-24 11:00:34 -07:00
clayjohn 4f82b1bd20 Use IGN instead of white noise for sky dithering 2022-05-24 10:57:07 -07:00
Rémi Verschelde 1314e6cbcc
Merge pull request #60803 from Chaosus/shader_hint_rename
Rename `hint_albedo`, `hint_white/black` in shaders
2022-05-24 08:15:33 +02:00
Rémi Verschelde 126470caa1
Merge pull request #61226 from Chaosus/shader_fix_keyword_completion 2022-05-23 19:05:29 +02:00
Hugo Locurcio 209d7eb7ea
Fix typo in occlusion culling warning method name 2022-05-23 09:34:28 +02:00
trollodel fe3371a9a9 Add timestamps to some rendering effects 2022-05-21 17:47:28 +02: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 +02:00
Somnath Sarkar 99911bfa79 Fix GPUParticles3D disappearance at attractor origins 2022-05-20 19:56:32 -04:00
reduz 45af29da80 Add a new HashSet template
* Intended to replace RBSet in most cases.
* Optimized for iteration speed
2022-05-20 22:40:38 +02:00
Yuri Rubinsky 29ff04acf2 Fix incorrect keyword completion after period in shader editor 2022-05-20 18:40:57 +03:00
Windy Darian a3e016e07e Fix normal and tangent blending in blend shapes 2022-05-20 07:59:45 -04:00
Aaron Record 900c676b02 Use range iterators for RBSet in most cases 2022-05-19 12:09:16 +02:00
Haoyu Qiu fc3b845c07 Add dedicated macros for property name extraction
* Replace case-by-case extraction with PNAME & GNAME
* Fix group handling when group hint begins with property name
* Exclude properties that are PROPERTY_USAGE_NO_EDITOR
* Extract missing ADD_ARRAY*, ADD_SUBGROUP* macros
2022-05-19 14:08:47 +08:00
Yuri Rubinsky 5322b171de Fix tonemapper shader to correctly apply alpha channel 2022-05-18 06:43:07 +03:00
clayjohn 600d8105d8 Fix custom irradiance bug in Vulkan mobile renderer 2022-05-16 11:57:41 -07:00
reduz 746dddc067 Replace most uses of Map by HashMap
* Map is unnecessary and inefficient in almost every case.
* Replaced by the new HashMap.
* Renamed Map to RBMap and Set to RBSet for cases that still make sense
  (order matters) but use is discouraged.

There were very few cases where replacing by HashMap was undesired because
keeping the key order was intended.
I tried to keep those (as RBMap) as much as possible, but might have missed
some. Review appreciated!
2022-05-16 10:37:48 +02:00
Somnath Sarkar 52aeaf5d16 Fix computation of screen_uv 2022-05-16 00:00:01 -04:00
Rémi Verschelde 349aa9c884
Merge pull request #60894 from derammo/derammo_opengl3_windows 2022-05-13 15:07:13 +02:00
Bastiaan Olij fe8c8eeba8 Copy_to_fb is available in both raster and clustered renderers, remove unwanted checks 2022-05-13 13:19:42 +10:00
Rémi Verschelde 9cf9054c3e
Merge pull request #60976 from Calinou/fsr-rename-property-hint 2022-05-12 23:12:03 +02:00
Rémi Verschelde ff30a09993
Merge pull request #60643 from clayjohn/GLES3-3D 2022-05-12 21:08:02 +02:00
clayjohn 652adcd5bf Basic 3D rendering 2022-05-12 10:37:27 -07:00
Hugo Locurcio 0cdd7d88ad
Rename remaining references of FSR to FSR 1.0
With FSR 2.0 around the corner, we should avoid any ambiguity by
explicitly stating the version number.
2022-05-12 18:22:43 +02:00
reduz 8b7c7f5a75 Add a new HashMap implementation
Adds a new, cleaned up, HashMap implementation.

* Uses Robin Hood Hashing (https://en.wikipedia.org/wiki/Hash_table#Robin_Hood_hashing).
* Keeps elements in a double linked list for simpler, ordered, iteration.
* Allows keeping iterators for later use in removal (Unlike Map<>, it does not do much
  for performance vs keeping the key, but helps replace old code).
* Uses a more modern C++ iterator API, deprecates the old one.
* Supports custom allocator (in case there is a wish to use a paged one).

This class aims to unify all the associative template usage and replace it by this one:
* Map<> (whereas key order does not matter, which is 99% of cases)
* HashMap<>
* OrderedHashMap<>
* OAHashMap<>
2022-05-12 11:21:29 +02:00
clayjohn 2bf8831dd6 SceneShader compiling 2022-05-11 21:00:21 -07:00
clayjohn 3bb8e6a9fe SkyShaders working 2022-05-11 21:00:21 -07:00
derammo 96c21bc749 opengl3 driver now works on windows including multi window
fixed and simplified gl_manager_windows
swap buffers now called for all windows
fixed missing pixel format setting in additional windows
    this makes them work in OpenGL contexts
changed verbose error printing to write once
    this error message happens very frequently while opengl3 is not finished
removed dead code no longer needed after changes
fixed comments that were misinformation
window messages during window creation now handled
    these were previously discarded
    messages now tunnel the required context
changed failure to create opengl3 window on windows to be more fatal
marked a problem with pen code
conditional compilation of vulkan and opengl3 on windows fixed
windows debug builds now show messages on debug console also
rendering driver selection box now shows only compiled drivers
marked some problematic code
thanks to akien-mga for patiently rewriting my style mistakes
2022-05-11 16:12:40 -04:00
Bastiaan Olij 9939cfc4c4 Split out bokeh_dof and copy effects 2022-05-11 11:08:56 +10:00
Rémi Verschelde d8935b27a9 Fix warnings found by Emscripten 3.1.10
Fix `-Wunused-but-set-variable`, `-Wunqualified-std-cast-call`, and
`-Wliteral-range` warnings.
2022-05-10 13:03:13 +02:00
Yuri Roubinsky a8bbe570ca Rename `hint_albedo`, `hint_white/black` in shaders 2022-05-09 22:50:18 +03:00
Yuri Roubinsky 8ed84a9f01 Fix instance uniform shader crash in custom functions 2022-05-09 17:10:42 +03:00
Rémi Verschelde 8fb02635d4
Merge pull request #60772 from MightiestGoat/multimesh-uniform-set
Fix the uniform set creation of multimesh with a invalidated buffer
2022-05-05 16:55:48 +02:00