Commit graph

1906 commits

Author SHA1 Message Date
PouleyKetchoupp 333f184734 Cylinder support in Godot Physics 3D
Cylinder collision detection uses a mix of SAT and GJKEPA.
GJKEPA is used to find the best separation axis in cases where finding
it analytically is too complex.

Changes in SAT solver:
Added support for generating separation axes for cylinder shape.
Added support for generating contact points with circle feature.

Changes in GJKEPA solver:
Updated from latest Bullet version which includes EPA fixes in some
scenarios.
Setting a lower EPA_ACCURACY to fix accuracy problems with cylinder vs.
cylinder in some cases.
2021-02-10 10:00:53 -07: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
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
Rémi Verschelde 3a3af0279b
Merge pull request #45658 from RandomShaper/fix_frozen_peak
Make audio bus channels' peak volume consistent
2021-02-03 10:05:34 +01:00
Lyuma d800329d16 Add AudioEffectCapture
AudioEffectCapture allows access to the microphone and other audio on an audio bus in real-time.

Co-Authored-By: K. S. Ernest (iFire) Lee <ernest.lee@chibifire.com>
2021-02-02 09:22:16 -08:00
Pedro J. Estébanez a2b3a73e2d Make audio bus channels' peak volume consistent
Channels that are inactive -or when playback has not started yet- will report -200 dB as their peak value (which is also the lowest value possible during playback).
2021-02-02 11:30:32 +01: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 cb9fc117d1
Use real_t in physics code 2021-01-28 18:15:42 -05: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
Winston Yallow 9684bc40df
Correctly expose transform as 3D transform 2021-01-27 14:57:01 +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
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
Sean LaPlante 17ac012728
Fixes #45025 - Protects _last_mix_time and _last_frame_time with the AudioDriver lock() and unlock() methods 2021-01-16 13:10:05 -05:00
Rémi Verschelde 011d201046
Merge pull request #43923 from madmiraal/fix-43588
Fix cast_motion sometimes failing
2021-01-14 20:44:19 +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
Marcel Admiraal 7653b8cc1e Fix multiple issues with one-way collisions
For RigidBodies, uses the collision normal determined by relative motion
to determine whether or not a one-way collision has occurred.

For KinematicBodies, performs additional checks to ensure a one-way
collision has occurred, and averages the recovery step over all collision
shapes.

Co-authored-by:    Sergej Gureev <sergej.gureev@relex.fi>
2021-01-07 09:22:39 +00: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