Commit graph

249 commits

Author SHA1 Message Date
jfons 55e7832d7b Improvements to SpotLight3D and OmniLight3D's shadows
OmniLight3D:
* Fixed lack of precision in cube map mode by scaling the projection's
  znear.
* Fixed aliasing issues by making the paraboloids use two square regions instead of two half
  squares.
* Fixed shadowmap atlas bleeding by adding padding.
* Fixed sihadow blur's inconsistent radius and unclamped sampling.

SpotLight3D:
* Fixed lack of precision by scaling the projection's znear.
* Fixed normal biasing.

Both:
* Tweaked biasing to make sure it works out of the box in most situations.
2021-08-19 13:46:51 +02:00
reduz 700f9d916d More fixes to mobile renderer
* Specify all precision qualifiers
* Makes renderer work on Adreno Vulkan
2021-08-18 12:20:19 -03:00
reduz 6027cd0a1d Fixes to mobile renderer
* Make sure shaders are named, to aid in debug in case of failure
* SceneRenderRD was being wrongly initialized (virtual functions being called when derivative class not initialized).
* Fixed some bugs resulting on the above being corrected.
2021-08-17 13:52:06 -03:00
Yuri Roubinsky 06add309d7 Fix incorrect uniform buffer size for particles 2021-08-17 13:33:28 +03:00
Juan Linietsky d5a30431b9
Merge pull request #51635 from reduz/further-mobile-optimizations
More optimizations on the mobile renderer.
2021-08-16 14:50:52 -03:00
Yuri Roubinsky 9de779344c Makes a clear error message if shader compilation failed 2021-08-16 11:25:20 +03:00
Bastiaan Olij c7847b3f6d Moved disabling bokeh shader variants to before the version_create call 2021-08-16 12:18:27 +10:00
Bastiaan Olij 4002650cb9 Fix read from screen and depth texture 2021-08-15 13:14:19 +10:00
Rémi Verschelde 4e1d91f4d3
Merge pull request #50998 from BastiaanOlij/single_bokeh_dof_raster
Rewrote raster DOF shader to using BOKEH
2021-08-14 14:44:23 +02:00
reduz cfac8972e1 More optimizations on the mobile renderer.
* Specialization constants used to disable anything not needed to draw
* Added softshadow and projector support on mobile.

This new approach ensures mobile shaders are smaller and more efficient, but relies on more pipeline versions compiled on demand.
As a result, random stalls can ocur like in Godot 3.x. These will be solved by using background compilation and fallbacks eventually (but needs to be tested first).
2021-08-13 14:30:59 -03:00
Rémi Verschelde e499758a77
Merge pull request #51025 from reduz/fix-directional-shadow-bias
Fix directional shadow bias
2021-08-13 16:45:49 +02:00
Yuri Roubinsky eadf9d92f9
Merge pull request #51609 from Chaosus/shader_fix_varying_error
Fix shader crash when using local var with the same name as varying
2021-08-13 10:37:53 +03:00
Yuri Roubinsky fa96c98bdf Fix shader crash when using local var with the same name as varying 2021-08-13 09:20:16 +03:00
Bastiaan Olij 07fd559478 Implemented raster versions of bokeh shaders to replace broken gaussian implementation 2021-08-13 10:20:14 +10:00
Rémi Verschelde 56ac302dc4
Merge pull request #51580 from aaronfranke/particles-real-double
Use real_t and double where appropriate in Particles
2021-08-12 20:51:21 +02:00
Aaron Franke 03e2544d50
Use real_t and double where appropriate in Particles 2021-08-12 11:35:31 -05:00
Hugo Locurcio fd29432aab
Use nearest mipmaps for both minification and magnification
This is generally the expected behavior when using a nearest + mipmaps
mode, as it's often used for pixel art games.
2021-08-12 18:24:10 +02:00
Yuri Roubinsky 63c7d5c330 Removes an internal error report if shader fails compile 2021-08-12 10:18:18 +03:00
Rémi Verschelde e2ca1d413e
Merge pull request #51533 from Calinou/fix-nearest-mipmap-filter
Fix the Use Nearest Mipmap Filter project setting not working
2021-08-12 08:16:46 +02:00
floppyhammer 37230dbb1f Fix CPUParticles2D disappearance after amount change 2021-08-12 10:53:37 +08:00
Hugo Locurcio 635f6cdf2e
Fix the Use Nearest Mipmap Filter project setting not working
The project setting wasn't being used anywhere.

This also tweaks the property hints to denote that these properties
are only effective after a restart.
2021-08-12 01:58:42 +02:00
Rémi Verschelde 62047e4e48
Merge pull request #51486 from reduz/fixes-to-mobile-renderer
Fixes and optimizations to mobile renderer
2021-08-11 15:19:11 +02:00
clayjohn a7c3e0dcd6 Use f0 instead of albedo in blinn and phong 2021-08-10 21:54:24 -07:00
reduz ca117910da Fixes and optimizations to mobile renderer
* Only apply final actions to attachments used in the last pass.
* Fixes to draw list final action (was using continue instead of read/drop).
* Profiling regions inside draw lists now properly throw errors.
* Ability to enable gpu profile printing from project settings. (used to debug).
2021-08-10 23:17:28 -03:00
Rémi Verschelde afb40920fe
Merge pull request #51411 from clayjohn/VULKAN-blinn-phong
[4.0] Make Blinn and Phong specular modes take albedo into account
2021-08-10 21:11:48 +02:00
Rémi Verschelde 16d73fefdb
Merge pull request #50682 from aaronfranke/basis-looking-at
Move code for looking_at to Basis
2021-08-10 11:28:12 +02:00
Rémi Verschelde 51b4df72a7
Merge pull request #51436 from Calinou/tonemap-clamp-negative-colors
Clamp negative colors regardless of the tonemapper to avoid artifacts
2021-08-10 09:56:11 +02:00
Rémi Verschelde 56f17d925f
Merge pull request #51417 from clayjohn/Vulkan-horizon-so
Add horizon specular occlusion
2021-08-10 09:56:02 +02:00
clayjohn fa962ff27d Make Blinn and Phong specular modes PBR 2021-08-09 20:09:00 -07:00
Aaron Franke 84f720966c
Use doubles for time in many other places 2021-08-09 14:05:42 -05:00
Hugo Locurcio 57451f132f
Clamp negative colors regardless of the tonemapper to avoid artifacts
Color artifacts could be visible when using negative lights with the
Filmic and ACES tonemapping operators, as these did not clamp negative
colors.
2021-08-09 17:01:07 +02:00
Rémi Verschelde 0a38d5c8f7
Merge pull request #43158 from nathanfranke/fix-gradient-and-draw-tile
Fix Gradient and Color Picker checkerboard, Fix tile parameter for CanvasItem.draw_texture_rect
2021-08-09 16:47:58 +02:00
Rémi Verschelde 85399a9170
Merge pull request #51155 from Chaosus/shader_fix_specular_mode
Fix a default shader specular render mode to `SCHLICK_GGX`
2021-08-09 08:13:47 +02:00
clayjohn 7bdea93497 Add horizon specular occlusion 2021-08-08 19:43:48 -07:00
Nathan Franke 051234e84e
Fix Gradient, Color Picker BG, Fix CanvasItem::draw_texture_rect p_tile 2021-08-07 16:40:50 -05:00
Rémi Verschelde da339f8ffc
Merge pull request #51309 from Chaosus/fix_uniform_error_spam
Fix incorrect checking of uniform set to prevent error spam
2021-08-06 17:15:03 +02:00
Bastiaan Olij b920bf05a4 Use subpasses to do 3D rendering and resolve in mobile renderer 2021-08-06 23:43:26 +10:00
Yuri Roubinsky 47a6bb2f28 Fix a default shader specular render mode to (SCHLICK_GGX/BLINN) 2021-08-06 16:01:58 +03:00
Yuri Roubinsky ac4406cfbe Fix incorrect checking of uniform set to prevent error spam 2021-08-06 12:20:12 +03:00
Rémi Verschelde dbd1a90bd4
Merge pull request #50942 from BastiaanOlij/cubemap_raster
Porting cubemap compute shaders to raster for the mobile renderer
2021-08-01 21:52:24 +02:00
Aaron Franke 9f3ae0adcd
Move code for looking_at to Basis 2021-08-01 12:49:02 -05:00
Bastiaan Olij c76426527b Porting cubemap compute shaders to raster for the mobile renderer 2021-08-01 21:22:38 +10:00
Rafał Mikrut e8877806ec Fix 'Attempted to remove invalid ID' errors 2021-07-31 15:30:31 +02:00
reduz 55d357b1eb Fix directional shadow bias
* Simplified code a lot, bias based on normalized cascade size.
* Lets scale cascades, max distance, etc. without creating acne.
* Fixed normal biasing in directional shadows.

I removed normal biasing in both omni and spot shadows, since the technique can't be easily implemented there.
Will need to be replaced by something else.
2021-07-29 13:51:32 -03:00
Hugo Locurcio e6a544c169
Merge pull request #50891 from Vitika9/50852
Removed redundant assignment of `blur_pipeline`
2021-07-26 21:43:38 +02:00
Rémi Verschelde 8f6c16e4a4
Merge pull request #50847 from reduz/implement-binary-shader-compilation
Implement Binary Shader Compilation
2021-07-26 17:09:48 +02:00
vitika9 1c63866996 Fixed coding style 2021-07-26 20:12:16 +05:30
Nicholas Huelin 7f908cf40f
Fix expression in cluster_builder_rd.h
This expression should now work as intended.
2021-07-26 08:19:53 -04:00
reduz cf3f404d31 Implement Binary Shader Compilation
* Added an extra stage before compiling shader, which is generating a binary blob.
* On Vulkan, this allows caching the SPIRV reflection information, which is expensive to parse.
* On other (future) RenderingDevices, it allows caching converted binary data, such as DXIL or MSL.

This PR makes the shader cache include the reflection information, hence editor startup times are significantly improved.
I tested this well and it appears to work, and I added a lot of consistency checks, but because it includes writing and reading binary information, rare bugs may pop up, so be aware.
There was not much of a choice for storing the reflection information, given shaders can be a lot, take a lot of space and take time to parse.
2021-07-26 08:40:39 -03:00
Rémi Verschelde 7341dd5afa
Merge pull request #50856 from SirQuartz/patch-32
Fix always true expression `radius > 0.98 || radius < 1.02` in `cluster_builder_rd.h`
2021-07-26 08:47:33 +02:00