Commit graph

556 commits

Author SHA1 Message Date
Yuri Roubinsky
5100eed012 Added a shader warning about unused local variable 2021-06-29 15:39:37 +03:00
Bastiaan Olij
a9604b425f Move render_sky logic from effects into our sky object, and some minor cleanup 2021-06-26 18:46:47 +10:00
Rémi Verschelde
e4430771db
Merge pull request #49885 from reduz/implement-render-pass-support
Implement Framebuffer Subpass support
2021-06-25 15:00:01 +02:00
reduz
bde6f5eed1 Implement Framebuffer Subpass support
* Required for better optimizing mobile platforms
* Will be used by the Vulkan mobile renderer.
2021-06-24 15:59:15 -03:00
Rémi Verschelde
a01ea509f5
Merge pull request #49826 from groud/fix_mesh_transform
Keep the drawing transform when drawing meshing in CanvasItem
2021-06-24 19:38:56 +02:00
Gilles Roudière
ccbf31685d Fixes Mesh2D drawn without modulation 2021-06-23 17:38:31 +02:00
Gilles Roudière
e8476c994d Keep the drawing transform when drawing meshing in CanvasItem 2021-06-22 11:41:28 +02:00
Lightning_A
e28fd07b2b Rename instance()->instantiate() when it's a verb 2021-06-19 20:49:18 -06:00
Rémi Verschelde
76fd91c084
Merge pull request #49737 from JFonS/fix_vis_range
Fix crash in visibility range system.
2021-06-20 00:32:42 +02:00
Bastiaan Olij
0a6a71973e
Merge pull request #49615 from BastiaanOlij/inverse_xr_camera_offset
Inverse XR camera offset for stereoscopic rendering
2021-06-19 20:19:53 +10:00
jfons
2c0819992c Fix crash in visibility range system. 2021-06-19 11:43:41 +02:00
Bastiaan Olij
b1bbbb4439 Inverse XR camera offset for stereoscopic rendering 2021-06-19 19:33:40 +10:00
jfons
a0b19d2561 Fix "Ignore Occlusion Culling" flag. 2021-06-18 21:42:03 +02:00
Rémi Verschelde
92f20fd70e
Merge pull request #49659 from LightningAA/string-valid-integer-to-int 2021-06-18 16:14:14 +02:00
reduz
94d31ac327 Implement animation slice drawing in CanvasItem
* Added a function to ignore subsequent commands if they don't fall within the slice.
* This will be used by the new TileMap to properly provide animated tiles.
2021-06-17 12:42:27 -03:00
reduz
6e98c4cd50 Refactor VisibilityNotifier3D
* This is the 3D counterpart to #49632
* Implemented a bit different as 3D works using instancing

After merged, both 2D and 3D classes will most likely be renamed in a separate PR to DisplayNotifier2D/3D.
2021-06-16 18:50:39 -03:00
Lightning_A
b6af2a29eb Rename is_valid_integer() to is_valid_int()
Method from `String`
2021-06-16 10:32:22 -06:00
reduz
38d164c74b Refactor VisibilityNotifier
* Works from RenderinServer
* Accurately tells when on or off-scren, its no longer approximate.
* VisibilityEnabler also simplified to use the process mode instead.
2021-06-16 10:48:57 -03:00
Rémi Verschelde
c2ba45fcc8
Merge pull request #49630 from kodiwills/fix-custom-irradiance-typo
Fix typo in `CUSTOM_IRRADIANCE` calculations
2021-06-15 22:37:54 +02:00
Kodi
69e1f25299 Fix typo in CUSTOM_IRRADIANCE calculations 2021-06-15 15:17:00 -04:00
Rémi Verschelde
ec323f0ef4
Merge pull request #49584 from timothyqiu/shader-data-null-check
Add missing null check for ShaderData
2021-06-14 19:18:20 +02:00
Rémi Verschelde
3f613236e0
Merge pull request #49576 from clayjohn/VULKAN-SSAO-uniform-sets
Store SSAO uniform sets per viewport
2021-06-14 19:05:19 +02:00
Rémi Verschelde
0610c559ec
Merge pull request #49585 from timothyqiu/oh-unsigned
Fix invalid read when using MultiMesh
2021-06-14 18:35:36 +02:00
Rémi Verschelde
6c1445bfea
Merge pull request #48847 from JFonS/vis_deps
Implement visibility range and dependencies
2021-06-14 17:22:59 +02:00
jfons
3a53ae5d9f Implement visibility range and dependencies.
This commit adds the following properties to GeometryInstance3D: `visibility_range_begin`,
`visibility_range_begin_margin`, `visibility_range_end`, `visibility_range_end_margin`.

Together they define a range in which the GeometryInstance3D will be visible from the camera,
taking hysteresis into account for state changes. A begin or end value of 0 will be ignored,
so the visibility range can be open-ended in both directions.

This commit also adds the `visibility_parent` property to 'Node3D'.
Which defines the visibility parents of the node and its subtree (until
another parent is defined).

Visual instances with a visibility parent will only be visible when the parent, and all of its
ancestors recursively, are hidden because they are closer to the camera than their respective
`visibility_range_begin` thresholds.

Combining visibility ranges and visibility parents users can set-up a quick HLOD system
that shows high detail meshes when close (i.e buildings, trees) and merged low detail meshes
for far away groups (i.e. cities, woods).
2021-06-14 12:17:11 +02:00
Haoyu Qiu
1b122345c2 Fix invalid read when using MultiMesh 2021-06-14 13:19:40 +08:00
Haoyu Qiu
fa907ce829 Add missing null check for ShaderData 2021-06-14 13:00:35 +08:00
Bastiaan Olij
3eae812331 Fixed error spam when XR mode is not enabled and a missed setting rename 2021-06-14 11:05:16 +10:00
clayjohn
fc93e10092 Store SSAO uniform sets per viewport 2021-06-13 10:42:10 -07:00
Bastiaan Olij
15c1a76361 Add stereoscopic rendering through multiview 2021-06-13 22:52:20 +10:00
reduz
ce783689f8 Make shader compiler again after roughness limiter fix
Fix shader compilation error after merging #49549
2021-06-12 21:40:51 -03:00
Juan Linietsky
bb94344937
Merge pull request #49549 from clayjohn/VULKAN-roughness-limiter
Fix roughness limiter derivative
2021-06-12 21:29:34 -03:00
clayjohn
9a5e00be6f Fix roughness limiter derivative 2021-06-12 17:02:05 -07:00
reduz
7513b73902 Fix VoxelGI (works again).
It was broken due to #46046, this makes it work again.
2021-06-12 20:37:56 -03:00
Rémi Verschelde
2787ee634a
Merge pull request #49520 from pfertyk/issue-46278-empty-texture-crashes-godot
Validate texture in RendererStorageRD::free
2021-06-12 22:27:14 +02:00
Paweł Fertyk
31cd42373b Validate texture in RendererStorageRD::free 2021-06-11 20:12:23 +02:00
Pedro J. Estébanez
04688b92ff Rename Reference to RefCounted 2021-06-11 18:48:42 +02:00
Rémi Verschelde
9e328bb5b7
Core: Move DirAccess and FileAccess to core/io
File handling APIs are typically considered part of I/O, and we did have most
`FileAccess` implementations in `core/io` already.
2021-06-11 14:52:39 +02:00
Yuri Roubinsky
9539e4e39e
Merge pull request #49456 from Chaosus/fix_shader_length
Fix `length()` array function usage in shader
2021-06-10 11:07:59 +03:00
Yuri Roubinsky
7dd65a066e Fix length() array function usage in shader 2021-06-10 10:04:28 +03:00
reduz
c66b2651a6 Refactor CommandQueueMT
* RingBuffer had no reason to be in this context
* A single buffer is used that can grow as much as the game needs.

This should make thread loading entirely reliable.
2021-06-09 13:10:49 -03:00
Yuri Roubinsky
5d5400a3b1 Fix shader compilation with render_mode: specular_phong 2021-06-09 08:38:03 +03:00
Yuri Roubinsky
4daca0b580 Removes deleted OrenNayar mode from shaders and materials 2021-06-08 15:50:40 +03:00
Yuri Roubinsky
eec82d9f75 Prevent shader crash when returning array when return type is scalar 2021-06-06 14:59:52 +03:00
reduz
32625145c8 Rename GI Classes
* GIProbe is now VoxelGI
* BakedLightmap is now LightmapGI

As godot adds more ways to provide GI (as an example, SDFGI in 4.0), the different techniques (which have different pros/cons) need to be properly named to avoid confusion.
2021-06-05 09:28:56 -03:00
Rémi Verschelde
6f7d45d210
Merge pull request #45364 from madmiraal/rename-quat
Rename Quat to Quaternion
2021-06-05 13:32:08 +02:00
andriyDev
9f4bf5ec80 Deleted YSort, moved its functionality directly into Node2D.
YSort now has a compatibility alias to Node2D.
Updated TileMap to use the existing Node2D y_sort_enabled property instead
of its own property.
Updated Node2D doc to include the new y_sort_enabled member.
Updated TileMap doc to remove its mention of cell_y_sort.
Deleted YSort doc.
2021-06-05 00:55:25 -07:00
Marcel Admiraal
8acd13a456 Rename Quat to Quaternion 2021-06-04 18:14:32 +01:00
Aaron Franke
08a85352fb
Rename Variant TRANSFORM to TRANSFORM3D
Also _transform to _transform3d
2021-06-03 07:30:01 -04:00
Aaron Franke
de3f6699a5
Rename Transform to Transform3D in core 2021-06-03 07:30:01 -04:00
Fabio Alessandrelli
8cdef21d6c Move remaining dummy drivers to servers. 2021-06-01 16:50:32 +02:00
Rémi Verschelde
52ab531a56
Merge pull request #49161 from lawnjelly/fix_canvas_rect_bound4
[4.x] Fix canvas rect bound calculation
2021-05-31 11:34:46 +02:00
reduz
0d2e02945b Implement shader caching
* Shader compilation is now cached. Subsequent loads take less than a millisecond.
* Improved game, editor and project manager startup time.
* Editor uses .godot/shader_cache to store shaders.
* Game uses user://shader_cache
* Project manager uses $config_dir/shader_cache
* Options to tweak shader caching in project settings.
* Editor path configuration moved from EditorSettings to new class, EditorPaths, so it can be available early on (before shaders are compiled).
* Reworked ShaderCompilerRD to ensure deterministic shader code creation (else shader may change and cache will be invalidated).
* Added shader compression with SMOLV: https://github.com/aras-p/smol-v
2021-05-31 10:13:09 +02:00
lawnjelly
07ca9cd263 [4] Fix canvas rect bound calculation
It turns out the calculation of the bounding rect for canvas items has a nasty bug. When a transform is applied (especially in a custom draw), in the renderer this extra matrix is applied to all later commands in the canvas item. However in the calculation of the bound, the transform is only applied to the first command following the transform.

This PR fixes this inconsistency.
2021-05-28 09:04:24 +01:00
Yuri Roubinsky
897fc09bac Makes few shader built-ins constant to prevent changing them 2021-05-26 15:58:35 +03:00
Rémi Verschelde
f1abfbbeb1
Merge pull request #48837 from Soupstraw/shader-pi
Added constants PI, TAU and E to the shader language
2021-05-25 18:07:15 +02:00
Rémi Verschelde
f050719da8
Merge pull request #48933 from Chaosus/shader_array_params
Allow shader arrays to be passed as parameters and return value in functions
2021-05-25 11:47:08 +02:00
Joosep Jääger
16567321ba Added constants PI, TAU and E to the shader language 2021-05-25 12:15:08 +03:00
reduz
789713b008 Support for 2D particles to collide against SDF
-Added SDF collision support for 2D particles
-Changed the SDF generation to be fully signed
2021-05-23 16:43:36 -03:00
Yuri Roubinsky
5874b7a29c Allow shader arrays to be passed as parameters and return value 2021-05-22 20:15:03 +03:00
Yuri Roubinsky
084648bd18 Basic warning support implementation for the Godot Shading Language. 2021-05-22 19:24:31 +03:00
Winston Hartnett
96fa2ee2a0 Fix instance uniform typo 2021-05-20 21:11:40 -05:00
Rémi Verschelde
4219a4cb6f
Fix typos with codespell
Using codespell 2.0.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
GIRD
leapyear
lod
merchantibility
nd
numer
ois
ony
que
seeked
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2021-05-20 12:38:56 +02:00
Yuri Roubinsky
6135744786 Implements length() shader function for arrays in structs 2021-05-19 21:50:11 +03:00
Yuri Roubinsky
96b2e54c70 Fix typo in shader_language.cpp 2021-05-18 19:01:02 +03:00
Bastiaan Olij
02980be834 Implementing blit shader with versions 2021-05-12 22:52:28 +10:00
Rémi Verschelde
0c693f8781
Merge pull request #48472 from BastiaanOlij/render_state
Make better use of our render_state struct
2021-05-12 13:44:03 +02:00
reduz
479391ef54 Fixes missng 2D engine bits
-Mesh2D now works
-MultiMesh2D now works
-Polygon2D now works
-Added hooks for processing 2D particles
-Skeleton2D now works

2D particles still not working, but stuff needed for it is now implemented.
2021-05-11 11:21:36 -03:00
Bastiaan Olij
308b26762b Split RenderDataRD struct from RenderState struct to simplify passing our render data around the renderer. 2021-05-10 21:52:15 +10:00
Rémi Verschelde
8962d36bb1
Merge pull request #33577 from Calinou/highlight-control-flow-keywords
Highlight control flow keywords with a different color
2021-05-07 00:52:50 +02:00
Bastiaan Olij
90ef5d73c4 Cleanup vulkan capabilities check and add multiview check 2021-05-06 12:06:07 +10:00
Hugo Locurcio
e905e8f145
Highlight control flow keywords with a different color
This makes them easier to distinguish from other keywords.
2021-05-05 22:38:12 +02:00
Rémi Verschelde
7449d6c752
Merge pull request #48435 from BastiaanOlij/no_repeat_mobile_renderer
Remove repeat from forward mobile renderer
2021-05-05 16:19:03 +02:00
Bastiaan Olij
cc45ed448b Remove repeat from forward mobile renderer 2021-05-04 11:37:58 +10:00
jfons
6995b0429c Assorted fixes to UV unwrapping and GPU lightmapper
Various fixes to UV2 unwrapping and the GPU lightmapper. Listed here for
context in case of git blame/bisect:

* Fix UV2 unwrapping on import, also cleaned up the unwrap cache code.
* Fix saving of RGBA images in EXR format.
* Fixes to the GPU lightmapper:
	- Added padding between atlas elements, avoids bleeding.
	- Remove old SDF generation code.
	- Fix baked attenuation for Omni/Spot lights.
	- Fix baking of material properties onto UV2 (wireframe was
	  wrongly used before).
	- Disable statically baked lights for objects that have a
	  lightmap texture to avoid applying the same light twice.
	- Fix lightmap pairing in RendererSceneCull.
	- Fix UV2 array generated from `RenderingServer::mesh_surface_get_arrays()`.
	- Port autoexposure fix for OIDN from 3.x.
	- Save debug textures as EXR when using floating point format.
2021-05-03 18:10:34 +02:00
Bastiaan Olij
58ff0dac1a Create mobile renderer 2021-05-03 21:54:11 +10:00
reduz
90056460ad Implement Particle Trails
-Enable the trails and set the length in seconds
-Provide a mesh with a skeleton and a skin
-Or, alternatively use one of the built-in TubeTrailMesh/RibbonTrailMesh
-Works deterministically
-Fixed particle collisions (were broken)
-Not working in 2D yet (that will happen next)
2021-04-30 17:38:02 -03:00
Rémi Verschelde
305b2a15bf
Merge pull request #48239 from akien-mga/goodbye-copymem
Core: Drop custom `copymem`/`zeromem` defines
2021-04-28 11:04:05 +02:00
Rémi Verschelde
95cfce661b
Merge pull request #48050 from JFonS/occlusion_culling 2021-04-27 19:07:12 +02:00
Rémi Verschelde
8247667a3e
Core: Drop custom copymem/zeromem defines
We've been using standard C library functions `memcpy`/`memset` for these since
2016 with 67f65f6639.

There was still the possibility for third-party platform ports to override the
definitions with a custom header, but this doesn't seem useful anymore.
2021-04-27 16:26:27 +02:00
Yuri Roubinsky
3c82f01134 Fix shader handle constant expressions in function call 2021-04-27 15:23:01 +03:00
Dennis Brakhane
31d41d83c3 Remove duplicate comments
A few single line comments were duplicated, probably due to bad merges.

This commit removes the obviously duplicate ones.
2021-04-25 20:03:52 +02:00
jfons
4d9d99bb82 Implement occlusion culling
Added an occlusion culling system with support for static occluder meshes.
It can be enabled via `Project Settings > Rendering > Occlusion Culling > Use Occlusion Culling`.

Occluders are defined via the new `Occluder3D` resource and instanced using the new
`OccluderInstance3D` node. The occluders can also be automatically baked from a
scene using the built-in editor plugin.
2021-04-23 21:45:23 +02:00
Bastiaan Olij
ebf10fe736 Fix reflection probe 2021-04-21 23:42:29 +10:00
reduz
906882ee66 Split particle shader entry points
* Particle shaders now have start() and process()
* Particle collision happens between them.
* The RESTART property is kept, so porting an old shader is still possible.

This fixes the problem of particle collisions not functioning on the first particle frame.
2021-04-17 12:22:55 -03:00
Rémi Verschelde
c7a4e2196e
Merge pull request #47878 from clayjohn/rename-get_surface_material
Rename get_surface_material to get_surface_override_material
2021-04-15 07:57:15 +02:00
clayjohn
92731d292c Rename get_surface_material to get_surface_override_material 2021-04-14 20:24:03 -07:00
reduz
d3b49c416a Refactor GLSL shader compilation
-Used a more consistent set of keywords for the shader
-Remove all harcoded entry points
-Re-wrote the GLSL shader parser, new system is more flexible. Allows any entry point organization.
-Entry point for sky shaders is now sky().
-Entry point for particle shaders is now process().
2021-04-14 11:37:52 -03:00
Bastiaan Olij
71c5d73b5e Remove low_end option from renderer, being replaced by separate implementation 2021-04-09 22:04:56 +10:00
Bastiaan Olij
dad40fa2df Move clustered renderer functionality 2021-04-05 23:11:38 +10:00
Rémi Verschelde
d83761ba80
Style: Apply clang-tidy's readability-braces-around-statements 2021-04-05 14:09:59 +02:00
Rémi Verschelde
9bbe51dc27
Style: Apply clang-tidy's modernize-use-nullptr 2021-04-05 14:05:07 +02:00
Rémi Verschelde
65a2888057
Style: Apply clang-tidy's modernize-use-default-member-init 2021-04-05 13:37:27 +02:00
Bastiaan Olij
e93c9fc4ed As GLSLang seems to be all or nothing, added our own defines 2021-03-31 21:47:25 +11:00
Bastiaan Olij
a6c989bc1b Obtain supported Vulkan API 2021-03-26 12:06:57 +11:00
Bastiaan Olij
7f63c9e7c9 Changed SCsub for shaders to find shaders automatically and create dependencies with include files 2021-03-18 12:59:47 +11:00
Ignacio Abal
ccdd7ab890 Added validation when assigning heightfield_resolution (Fix #46281) 2021-03-17 12:03:52 -03:00
sboronczyk
3e7c5d2ca5 fix issue vulkan crash on open shader materials 2021-03-13 22:54:33 +01:00
Bastiaan Olij
f7cbeb0d1b Removed time duplicate from ForwardClustered. Just use the variable from its superclass 2021-03-11 18:08:10 +11:00
Bastiaan Olij
73b5eb2673 Combine init_gi and init_sdfgi into a single init 2021-03-11 18:07:33 +11:00
Bastiaan Olij
52ab369d5f Renamed one more Forward render struct and fixed typo 2021-03-11 14:18:05 +11:00
Bastiaan Olij
dfc41eb6f6 Moving RendererStorageRD *storage to protected, no sense duplicating it in forward_clustered 2021-03-11 13:24:23 +11:00
Bastiaan Olij
a895844c82 Renaming RendererSceneRenderForward to RendererSceneRenderForwardClustered so we can introduce RendererSceneRenderForwardMobile 2021-03-10 22:34:50 +11:00
Rémi Verschelde
3856bc5afe
Merge pull request #46642 from BastiaanOlij/sdfgi_rename_and_cleanup
Renamed SDGIShader to SDFGIShader and moved a bunch of things to private
2021-03-08 08:22:48 +01:00
Ev1lbl0w
1f0b60c47d
Fix negative VRAM values 2021-03-05 21:48:20 +00:00
Alex Hirsch
426ef4b1ee Fix canvas renderer line width
fix #46644
2021-03-04 21:37:06 +01:00
Bastiaan Olij
760be46a81 Renamed SDGIShader to SDFGIShader and moved a bunch of things to private 2021-03-04 11:53:09 +11:00
Rémi Verschelde
8c45b1d61c
Merge pull request #46594 from asheraryam/fix-clip-content-master
Fix rounding error in Clip Content [4.0]
2021-03-02 17:07:00 +01:00
asheraryam
c3d8538bb4 Fix rounding error in Clip Content
Rounds the position and size of the final clip rect to avoid flickering issues.

Fixes https://github.com/godotengine/godot/issues/46493
2021-03-02 18:36:28 +03:00
Rémi Verschelde
da8eef486b
Merge pull request #46046 from BastiaanOlij/cleanup_gi
Moving GI and Sky code from RendererSceneRenderRD into separate classes
2021-03-01 19:34:53 +01:00
Rémi Verschelde
e9cb64a8b5
Merge pull request #46522 from Ev1lbl0w/bugfix-shader_noret
Added missing returns on error scenarios
2021-03-01 09:36:15 +01:00
Yuri Roubinsky
19e0a1ec9d Fix parsing hexadecimal (lowercase e,f) in shaders 2021-03-01 09:08:44 +03:00
Ev1lbl0w
3d9ef1e4de
Added missing returns on error scenarios 2021-02-28 19:48:35 +00:00
Bastiaan Olij
1f96ba5141 Moving GI code into RendererServerGIRD
Moving Skyshader code into RendererServerSkyRD
2021-02-25 15:15:48 +11:00
Yuri Roubinsky
571f4396ea Prevents shader crash if two struct with the same name are declared 2021-02-21 13:47:09 +03:00
Yuri Roubinsky
f91e7e3ba4 Prevents shader crash if passing invalid struct to the return statement 2021-02-21 07:55:40 +03:00
Rémi Verschelde
0d1d719178 doc: Sync classref with current source
And fix various bogus bindings following previous PRs.
2021-02-19 14:39:14 +01:00
Clay John
32dec4accd
Merge pull request #45326 from clayjohn/VULKAN-ign-shadows
Use Interleaved gradient noise for shadow samples
2021-02-18 13:17:41 -08:00
Rémi Verschelde
310496a89f
Merge pull request #45617 from RandomShaper/modernize_atomics
Modernize atomics (and fix `volatile`)
2021-02-18 19:40:31 +01:00
Pedro J. Estébanez
8e128726f0 Modernize atomics
- Based on C++11's `atomic`
- Reworked `SafeRefCount` (based on the rewrite by @hpvb)
- Replaced free atomic functions by the new `SafeNumeric<T>`
- Replaced wrong cases of `volatile bool` by the new `SafeFlag`
- Platform-specific implementations no longer needed

Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
2021-02-18 17:12:46 +01:00
reduz
64140eaf42 Reorganize Project Settings
-Advanced Settings toggle also hides advanced properties when disabled
-Simplified Advanced Bar (errors were just plain redundant)
-Reorganized rendering quality settings.
-Reorganized miscelaneous settings for clean up.
2021-02-18 11:23:34 -03:00
Kayomn
fa8a47e1bf Fix math error in blend shape application tolerance 2021-02-17 10:30:29 +01:00
Rémi Verschelde
e9a25b8552
Merge pull request #45859 from Kayomn/master
Accomodate blend shape ranges of -1 to +1 for Vulkan
2021-02-12 09:26:14 +01:00
Yuri Roubinsky
dd0874e717 Allow passing varying from fragment to light shader function 2021-02-11 15:59:21 +03:00
reduz
8b19ffd810 Make Servers truly Thread Safe
-Rendering server now uses a split RID allocate/initialize internally, this allows generating RIDs immediately but initialization to happen later on the proper thread (as rendering APIs generally requiere to call on the right thread).
-RenderingServerWrapMT is no more, multithreading is done in RenderingServerDefault.
-Some functions like texture or mesh creation, when renderer supports it, can register and return immediately (so no waiting for server API to flush, and saving staging and command buffer memory).
-3D physics server changed to be made multithread friendly.
-Added PhysicsServer3DWrapMT to use 3D physics server from multiple threads.
-Disablet Bullet (too much effort to make multithread friendly, this needs to be fixed eventually).
2021-02-10 13:21:46 -03:00
Kayomn
ca945421a0 Accomodate blend shape ranges of -1 to +1 2021-02-09 23:09:54 +00:00
reduz
3e2281a347 Improve SDFGI indirect light feedback loop
-Use occlusion for feedback, further reduces light leaking.
-More control on feedback, now its a slider.
2021-02-07 21:30:12 -03:00
jfons
99e1ce0690 Invert spotlight angle attenuation
Inverted the spotlight angle attenuation so a higher value results in
a dimmer light, this makes it more consistent with the distance
attenuation.

Also changed the way spotlighs are computed in SDFGI
and GIPorbes and GPU lightmapper, now it matches the falloff used in the scene rendering
code.
2021-02-07 20:10:33 +01:00
Rémi Verschelde
7a60c45671
Merge pull request #45786 from reduz/fix-sdfgi-radeon
Fixed an SDFGI reflections bug in Radeon
2021-02-07 12:24:07 +01:00
reduz
c4daf1c4ba Fixed a SDFGI reflections bug in Radeon
-Code was using too many conditionals.
-Rewrote it to use less and it now works fine.
2021-02-07 07:33:41 -03:00
jfons
9c6b081ab1 Fix volumetric fog for SpotLights
The code for spot lights was referencing the omni light list. Most
likely a copy-paste mistake :)
2021-02-07 03:38:09 +01:00
reduz
d0cc899398 Fix SDFGI bug after previous optimization.
Was causing arctifacts, should be good now.
2021-02-06 18:49:10 -03:00
reduz
8faf23b52b Simplify Volumetric Fog
-Always use temporal reproject, it just loos way better than any other filter.
-By always using termporal reproject, the shadowmap reduction can be done away with, massively improving performance.
-Disadvantage of temporal reproject is update latency so..
-Made sure a gaussian filter runs in XY after fog, this allows to keep stability and lower latency.
2021-02-06 15:08:21 -03:00
Lyuma
780e761dbc Fix mismatched define in scene_forward.glsl for POSITION override 2021-02-05 13:09:33 -08:00
reduz
7997544af5 Added temporal reprojection to Volumetric Fog
-It's an option, just enable it
-Just works, don't have to do anything else.
2021-02-05 10:52:54 -03:00
reduz
33278b0721 Fixes to get Godot running again on Intel IGP
-Fixed strange bug with shadowed instance_param (this should not have worked anywhere, odd..)
-Cleaned up barrier usage further.
2021-02-05 00:02:06 -03:00
reduz
f20999f6fe Rewrote how barriers work for faster rendering
-Added more finegrained control in RenderingDevice API
-Optimized barriers (use less ones for thee same)
-General optimizations
-Shadows render all together unbarriered
-GI can render together with shadows.
-SDFGI can render together with depth-preoass.
-General fixes
-Added GPU detection
2021-02-04 09:42:28 -03:00
Rafał Mikrut
0c3febca06 Don't use trashy max_decals value to prevent crashes 2021-02-01 21:43:08 +01:00
Rémi Verschelde
d2e1216504
Merge pull request #37547 from aaronfranke/tau
Use Math_TAU and deg2rad/etc in more places and optimize code
2021-02-01 20:55:25 +01:00
Rémi Verschelde
5525cd85c6
Merge pull request #45315 from RandomShaper/modernize_thread
Modernize Thread
2021-01-31 15:24:56 +01:00
Pedro J. Estébanez
99fe462452 Modernize Thread
- Based on C++11's `thread` and `thread_local`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed (except for the few cases of non-portable functions)
- Simpler for `NO_THREADS`
- Thread ids are now the same across platforms (main is 1; others follow)
2021-01-29 12:02:13 +01:00
Aaron Franke
a3e3bf8227
Make hex_to_int and bin_to_int handle the prefix automatically
Also add BinToInt to C#
2021-01-28 07:43:53 -05:00
Rémi Verschelde
fb01d057af
doc: Sync classref with current source 2021-01-28 11:26:37 +01:00
Gordon MacPherson
86c7faa169 Fix zero scaling and material mappings being mapped to wrong fields
- fixes scale values of 0.0013 (det == 0.00004) not rendering, they should render even at small values, but not at zero like the editor grid plugin supplies zero exactly.
- fixes node_3d_editor_plugin visibility bug when scale is zero
- fix culling with small scaling values - which are still valid to be rendered like 0.00004

note: grid is still not fixed, it has det == 0 issues but this fixes one of them.
2021-01-26 19:48:18 +00:00
reduz
280f334f81 Reorganize RenderingDevice barriers
-Removed sync to draw, now everything syncs to draw by default.
-Fixed many validation layer errors.
-Added support for VkImageViewUsageCreateInfo to fix validation layer warnings.
-Texture, buffer, raster and compute functions now all allow spcifying which barriers will be used.
2021-01-26 10:24:12 -03:00
clayjohn
7323cbab4b Add named resources and debug labels in RenderDoc 2021-01-25 20:04:13 -08:00
reduz
51d8e32c93 Implement shadow meshes
-When importing, a vertex-only version of the mesh is created.
-This version is used when rendering shadows, and improves performance by reducing bandwidth
-It's automatic, but can optionally be used by users, in case they want to make special versions of geometry for shadow casting.
2021-01-25 15:03:15 -03:00
reduz
a9beb7aa8c Shadow map rendering optimization
-All shadow rendering is done with raster now (no compute)
-All shadow rendering is done by rendering directly to the shadow atlas
-Improved how buffer clearing is done to optimize the above.
-Ability to set shadows as 16 bits.
2021-01-24 20:17:28 -03:00
reduz
6fe342478b Several GI related optimizations and fixes
-SDFGI direct light is done over many frames
-SDFGI Changed settings for rays/frame
-SDFGI Misc optimizations
-SDFGI Bug fix on probe scroll

-GIProbe was not working, got it to work again
-GIProbe dynamic objects were not working, fixed

-Added a half size GI option.
2021-01-24 19:29:07 -03:00
clayjohn
561de937b1 Use Interleaved gradient noise for shadow samples 2021-01-21 07:47:01 -08:00
Rémi Verschelde
a9b151c664
Merge pull request #44668 from clayjohn/VULKAN-downsample
Use cubemap downsampler for reflection mipmaps
2021-01-20 20:41:47 +01:00
reduz
099dee35f4 Added GPU based cluster builder
Clustering is now GPU based, uses an implementation based on the Activision algorithm.
2021-01-19 23:31:06 +01:00
reduz
7008e3c6ea Shader optimizations to reduce VGPR usage and increase occupancy 2021-01-19 23:31:02 +01:00
Rémi Verschelde
0b409d89d0
Merge pull request #45136 from akien-mga/clang-format-11
CI: Update to clang-format 11 and apply ternary operator changes
2021-01-13 16:10:44 +01:00
Rémi Verschelde
af878716f2
CI: Update to clang-format 11 and apply ternary operator changes 2021-01-12 19:32:53 +01:00
Yuri Roubinsky
ef941a6500 Renamed emit_particle to emit_subparticle shader function 2021-01-12 09:41:08 +03:00
Yuri Roubinsky
fcc5d67b03 Fix shader uniform instances compilation 2021-01-11 17:46:33 +03:00
Rémi Verschelde
a33dc4274c
Merge pull request #45066 from Chaosus/shader_fix_uniform_crash
Prevent editor crash due to modify the order of non-instance shader uniforms by instance uniforms
2021-01-11 14:58:55 +01:00
Yuri Roubinsky
289cc89a39 Prevent crash due to assigning incorrect order of instance uniform 2021-01-10 10:52:30 +03:00
Yuri Roubinsky
fdfddbdc3c Fix LIGHT compilation for canvas shader 2021-01-09 23:22:59 +03:00
Aaron Franke
1d5042c9e2
Use Math_TAU and deg2rad/rad2deg in more places and optimize code 2021-01-09 03:47:14 -05:00
reduz
cdb216f4e4 Added ability to visualize native shaders 2021-01-06 09:40:09 -03:00
reduz
446618cf94 Change the light attenuation formulas.
-Much better looking, physically based.
-Almost negligible extra cost.
2021-01-05 14:44:05 -03:00
reduz
77bc3e9ac3 Threaded optimizations to cull and render
-Reorganize thread work pool for rendering
-Fixes to make secondary command buffers to work (disabled because they need more testing)
2021-01-05 08:50:18 -03:00
reduz
5d2a1d7892 Rewrite render code to be more cache and thread friendly. 2021-01-05 08:50:18 -03:00
reduz
9a2f18f8e7 Reorganize renderer code.
So it can hopefully be made more cache efficient afterwards.
2021-01-05 08:50:18 -03:00
Rémi Verschelde
00f5ea2ed2
Merge pull request #44842 from clayjohn/VULKAN-SSAO-2
SSAO renames and move push constant binding
2021-01-04 23:03:54 +01:00
Hendrik Brucker
ec6fc059b7 fix inconsistent normal map shader variable naming 2021-01-04 14:08:01 +01:00
Rémi Verschelde
a408622c06
Merge pull request #44530 from clayjohn/VULKAN-framebuffer-error
Use basic uniform set for depth prepass
2021-01-04 09:34:27 +01:00
clayjohn
0015260c4b SSAO cleanup and fixes 2021-01-03 21:32:22 -08:00
Muller-Castro
31dd07ba30 Typo correction
simple typo correction
2021-01-02 02:27:12 -03:00
Rémi Verschelde
b5334d14f7
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆
2021-01-01 20:19:21 +01:00
Marcel Admiraal
b4a190e0bc Consistently use normal_map 2020-12-29 08:04:19 +00:00
Rémi Verschelde
6cebb8c117
Merge pull request #44586 from madmiraal/rename-stepify
Rename Math::stepify to snapped
2020-12-28 21:46:43 +01:00
Rémi Verschelde
058f3fe069
Merge pull request #44149 from madmiraal/rename-tangent-orthogonal
Rename Vector2.tangent() to Vector2.orthogonal()
2020-12-28 16:00:12 +01:00
Marcel Admiraal
b743a2ef3c Rename Math::stepify to snapped 2020-12-28 13:01:30 +00:00
Marcel Admiraal
5b937d493f Rename empty() to is_empty() 2020-12-28 10:39:56 +00:00
Rémi Verschelde
1f7d6ba736
Merge pull request #44715 from clayjohn/VULKAN-SSAO-cleanup
Cleanup leftover functions from adding SSAO
2020-12-27 10:53:23 +01:00
Yuri Roubinsky
ef4e625918
Merge pull request #44705 from Chaosus/shader_fix_array_postinit
Fix using post-init shader array constructors
2020-12-27 08:26:31 +03:00
clayjohn
34cfe1cc40 Cleanup leftover functions from adding SSAO 2020-12-26 16:33:07 -08:00
reduz
548524152e Rewrite culling to be more cache/thread friendly.
-Uses a single array with all data
-Massive performance improvement
-Does not support threads yet, but code is now thread friendly
2020-12-26 19:11:33 -03:00
Yuri Roubinsky
bc0e8e7a21 Fix using post-init shader array constructors 2020-12-27 01:07:24 +03:00
Yuri Roubinsky
fb16b1e39b
Merge pull request #44436 from Chaosus/shader_const_switch
Added support for constants in shader `case` and array size declaration
2020-12-27 00:55:45 +03:00
clayjohn
28d0f8a455 Use cubemap downsampler for reflection mipmaps 2020-12-24 16:39:17 -08:00
Juan Linietsky
545c894614
Merge pull request #44656 from reduz/cull-fixes-and-optimizations
Cull fixes and optimizations
2020-12-24 14:01:19 -03:00
Rémi Verschelde
ecda989c85
Merge pull request #44649 from lyuma/bone_aabb_blendshapes
Fix blendshapes and calculation of bone_aabbs
2020-12-24 17:20:07 +01:00
reduz
1bebb2ba05 Cull fixes and optimizations 2020-12-24 12:18:28 -03:00
lawnjelly
6d687de9b8 Fix BVH to world_aabb, and call update
The calls to the BVH need to use the world space AABB, rather than local space for it to work. Also, update was not being called which is required to update the AABB as objects move.
2020-12-24 11:19:50 +00:00
Rémi Verschelde
6063af6788
Merge pull request #44641 from reduz/get-frame-setup-time
Add API to get frame setup time on CPU
2020-12-24 10:07:54 +01:00
Lyuma
d976003b16 Fix blendshapes and calculation of bone_aabbs
Blendshapes without a skeleton already worked.
However, due to a faulty ERR_FAIL_COND, it was impossible to create a mesh with both bones and blendshapes.
This also fixes an assumption that all surfaces reference the same number of bones as surface 0.
2020-12-24 00:01:07 -08:00
clayjohn
3a8c99a10b Use basic uniform set for depth prepass 2020-12-23 20:23:51 -08:00
reduz
7219f37cb5 Add API to get frame setup time on CPU
Needed for benchmarks
2020-12-24 00:13:52 -03:00
reduz
83058597cf Replace Octree by DynamicBVH in cull code
-Much greater pairing/unpairing performance
-For now, using it for culling too, but this will change in a couple of days.
-Added a paged allocator, to efficiently alloc/free some types of objects.
2020-12-23 19:31:30 -03:00
Marcel Admiraal
4b8b803931 Rename Control margin to offset 2020-12-23 06:25:56 +00:00
Rémi Verschelde
6e43c68e40
Merge pull request #44182 from clayjohn/ASSAO
Replace SAO with ASSAO as Godot's new SSAO
2020-12-22 11:27:25 +01:00
clayjohn
44f8922305 Port ASSAO to Godot to replace SAO 2020-12-21 23:08:59 -08:00
Marcel Admiraal
efea408d23 Ensure default value in _render_shadow is the same as parent
Use double instead of int for the p_lod_distance_multiplier default value in
RendererSceneRenderForward::_render_shadow to match parent default value in
RendererSceneRenderRD::_render_shadow
2020-12-21 09:36:20 +00:00
Rémi Verschelde
e9d12f9e4e
Merge pull request #44521 from madmiraal/rename-rect2-clip
Rename Rect2 and Rect2i clip() to intersection()
2020-12-19 21:32:14 +01:00
Rémi Verschelde
2797c2a74c
Merge pull request #33207 from Calinou/increase-camera-default-zfar
Increase the default Camera Zfar to 4000
2020-12-19 15:32:32 +01:00
Hugo Locurcio
7ae487d2bb
Increase the default Camera Zfar to 4000
This makes it possible to view far away objects without
having to tweak any settings. This results in a more usable
editor when working on large-scale levels.

This change should have no impact on performance, but note that
Z-fighting will be visible at a distance. This can be made less
visible by increasing the Znear value (however, doing so will cause
nearby surfaces to disappear).

This change was also applied to the editor, but it will only
apply to newly created scenes.

This also changes the default camera settings in the glTF importer
to match the Camera node's defaults.
2020-12-19 14:52:44 +01:00