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.
This commit is contained in:
reduz 2021-01-22 20:50:24 -03:00
parent 6ddfc8e718
commit 6fe342478b
21 changed files with 490 additions and 263 deletions

View file

@ -32,6 +32,7 @@
#define RENDERING_SERVER_DEFAULT_H
#include "core/math/octree.h"
#include "core/templates/ordered_hash_map.h"
#include "renderer_canvas_cull.h"
#include "renderer_scene_cull.h"
#include "renderer_viewport.h"
@ -74,6 +75,12 @@ class RenderingServerDefault : public RenderingServer {
float frame_setup_time = 0;
//for printing
bool print_gpu_profile = false;
OrderedHashMap<String, float> print_gpu_profile_task_time;
uint64_t print_frame_profile_ticks_from = 0;
uint32_t print_frame_profile_frame_count = 0;
public:
//if editor is redrawing when it shouldn't, enable this and put a breakpoint in _changes_changed()
//#define DEBUG_CHANGES
@ -616,6 +623,7 @@ public:
BIND11(environment_set_sdfgi, RID, bool, EnvironmentSDFGICascades, float, EnvironmentSDFGIYScale, bool, bool, bool, float, float, float)
BIND1(environment_set_sdfgi_ray_count, EnvironmentSDFGIRayCount)
BIND1(environment_set_sdfgi_frames_to_converge, EnvironmentSDFGIFramesToConverge)
BIND1(environment_set_sdfgi_frames_to_update_light, EnvironmentSDFGIFramesToUpdateLight)
BIND3R(Ref<Image>, environment_bake_panorama, RID, bool, const Size2i &)
@ -688,6 +696,8 @@ public:
BIND3R(TypedArray<Image>, bake_render_uv2, RID, const Vector<RID> &, const Size2i &)
BIND1(gi_set_use_half_resolution, bool)
#undef BINDBASE
//from now on, calls forwarded to this singleton
#define BINDBASE RSG::canvas
@ -865,6 +875,8 @@ public:
virtual void sdfgi_set_debug_probe_select(const Vector3 &p_position, const Vector3 &p_dir);
virtual void set_print_gpu_profile(bool p_enable);
RenderingServerDefault();
~RenderingServerDefault();