mirror of
https://github.com/godotengine/godot.git
synced 2024-11-27 09:16:35 +08:00
Merge pull request #56305 from Calinou/rename-lod-threshold
This commit is contained in:
commit
851fb16350
@ -1739,7 +1739,7 @@
|
||||
<member name="rendering/mesh_lod/lod_change/threshold_pixels" type="float" setter="" getter="" default="1.0">
|
||||
The automatic LOD bias to use for meshes rendered within the [ReflectionProbe]. Higher values will use less detailed versions of meshes that have LOD variations generated. If set to [code]0.0[/code], automatic LOD is disabled. Increase [member rendering/mesh_lod/lod_change/threshold_pixels] to improve performance at the cost of geometry detail.
|
||||
[b]Note:[/b] [member rendering/mesh_lod/lod_change/threshold_pixels] does not affect [GeometryInstance3D] visibility ranges (also known as "manual" LOD or hierarchical LOD).
|
||||
[b]Note:[/b] This property is only read when the project starts. To adjust the automatic LOD threshold at runtime, set [member Viewport.lod_threshold] on the root [Viewport].
|
||||
[b]Note:[/b] This property is only read when the project starts. To adjust the automatic LOD threshold at runtime, set [member Viewport.mesh_lod_threshold] on the root [Viewport].
|
||||
</member>
|
||||
<member name="rendering/occlusion_culling/bvh_build_quality" type="int" setter="" getter="" default="2">
|
||||
</member>
|
||||
|
@ -41,13 +41,13 @@
|
||||
<member name="interior" type="bool" setter="set_as_interior" getter="is_set_as_interior" default="false">
|
||||
If [code]true[/code], reflections will ignore sky contribution.
|
||||
</member>
|
||||
<member name="lod_threshold" type="float" setter="set_lod_threshold" getter="get_lod_threshold" default="1.0">
|
||||
The automatic LOD bias to use for meshes rendered within the [ReflectionProbe] (this is analog to [member Viewport.lod_threshold]). Higher values will use less detailed versions of meshes that have LOD variations generated. If set to [code]0.0[/code], automatic LOD is disabled. Increase [member lod_threshold] to improve performance at the cost of geometry detail, especially when using the [constant UPDATE_ALWAYS] [member update_mode].
|
||||
[b]Note:[/b] [member lod_threshold] does not affect [GeometryInstance3D] visibility ranges (also known as "manual" LOD or hierarchical LOD).
|
||||
</member>
|
||||
<member name="max_distance" type="float" setter="set_max_distance" getter="get_max_distance" default="0.0">
|
||||
The maximum distance away from the [ReflectionProbe] an object can be before it is culled. Decrease this to improve performance, especially when using the [constant UPDATE_ALWAYS] [member update_mode].
|
||||
</member>
|
||||
<member name="mesh_lod_threshold" type="float" setter="set_mesh_lod_threshold" getter="get_mesh_lod_threshold" default="1.0">
|
||||
The automatic LOD bias to use for meshes rendered within the [ReflectionProbe] (this is analog to [member Viewport.mesh_lod_threshold]). Higher values will use less detailed versions of meshes that have LOD variations generated. If set to [code]0.0[/code], automatic LOD is disabled. Increase [member mesh_lod_threshold] to improve performance at the cost of geometry detail, especially when using the [constant UPDATE_ALWAYS] [member update_mode].
|
||||
[b]Note:[/b] [member mesh_lod_threshold] does not affect [GeometryInstance3D] visibility ranges (also known as "manual" LOD or hierarchical LOD).
|
||||
</member>
|
||||
<member name="origin_offset" type="Vector3" setter="set_origin_offset" getter="get_origin_offset" default="Vector3(0, 0, 0)">
|
||||
Sets the origin offset to be used when this [ReflectionProbe] is in [member box_projection] mode. This can be set to a non-zero value to ensure a reflection fits a rectangle-shaped room, while reducing the amount of objects that "get in the way" of the reflection.
|
||||
</member>
|
||||
|
@ -2535,13 +2535,6 @@
|
||||
Sets the intensity of the reflection probe. Intensity modulates the strength of the reflection. Equivalent to [member ReflectionProbe.intensity].
|
||||
</description>
|
||||
</method>
|
||||
<method name="reflection_probe_set_lod_threshold">
|
||||
<return type="void" />
|
||||
<argument index="0" name="probe" type="RID" />
|
||||
<argument index="1" name="pixels" type="float" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="reflection_probe_set_max_distance">
|
||||
<return type="void" />
|
||||
<argument index="0" name="probe" type="RID" />
|
||||
@ -2550,6 +2543,13 @@
|
||||
Sets the max distance away from the probe an object can be before it is culled. Equivalent to [member ReflectionProbe.max_distance].
|
||||
</description>
|
||||
</method>
|
||||
<method name="reflection_probe_set_mesh_lod_threshold">
|
||||
<return type="void" />
|
||||
<argument index="0" name="probe" type="RID" />
|
||||
<argument index="1" name="pixels" type="float" />
|
||||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<method name="reflection_probe_set_origin_offset">
|
||||
<return type="void" />
|
||||
<argument index="0" name="probe" type="RID" />
|
||||
|
@ -215,10 +215,10 @@
|
||||
</member>
|
||||
<member name="handle_input_locally" type="bool" setter="set_handle_input_locally" getter="is_handling_input_locally" default="true">
|
||||
</member>
|
||||
<member name="lod_threshold" type="float" setter="set_lod_threshold" getter="get_lod_threshold" default="1.0">
|
||||
The automatic LOD bias to use for meshes rendered within the [Viewport] (this is analogous to [member ReflectionProbe.lod_threshold]). Higher values will use less detailed versions of meshes that have LOD variations generated. If set to [code]0.0[/code], automatic LOD is disabled. Increase [member lod_threshold] to improve performance at the cost of geometry detail.
|
||||
<member name="mesh_lod_threshold" type="float" setter="set_mesh_lod_threshold" getter="get_mesh_lod_threshold" default="1.0">
|
||||
The automatic LOD bias to use for meshes rendered within the [Viewport] (this is analogous to [member ReflectionProbe.mesh_lod_threshold]). Higher values will use less detailed versions of meshes that have LOD variations generated. If set to [code]0.0[/code], automatic LOD is disabled. Increase [member mesh_lod_threshold] to improve performance at the cost of geometry detail.
|
||||
To control this property on the root viewport, set the [member ProjectSettings.rendering/mesh_lod/lod_change/threshold_pixels] project setting.
|
||||
[b]Note:[/b] [member lod_threshold] does not affect [GeometryInstance3D] visibility ranges (also known as "manual" LOD or hierarchical LOD).
|
||||
[b]Note:[/b] [member mesh_lod_threshold] does not affect [GeometryInstance3D] visibility ranges (also known as "manual" LOD or hierarchical LOD).
|
||||
</member>
|
||||
<member name="msaa" type="int" setter="set_msaa" getter="get_msaa" enum="Viewport.MSAA" default="0">
|
||||
The multisample anti-aliasing mode. A higher number results in smoother edges at the cost of significantly worse performance. A value of 2 or 4 is best unless targeting very high-end systems. See also bilinear scaling 3d [member scaling_3d_mode] for supersampling, which provides higher quality but is much more expensive.
|
||||
|
@ -404,7 +404,7 @@ void RasterizerSceneGLES3::voxel_gi_update(RID p_probe, bool p_update_light_inst
|
||||
void RasterizerSceneGLES3::voxel_gi_set_quality(RS::VoxelGIQuality) {
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES3::render_scene(RID p_render_buffers, const CameraData *p_camera_data, const PagedArray<GeometryInstance *> &p_instances, const PagedArray<RID> &p_lights, const PagedArray<RID> &p_reflection_probes, const PagedArray<RID> &p_voxel_gi_instances, const PagedArray<RID> &p_decals, const PagedArray<RID> &p_lightmaps, const PagedArray<RID> &p_fog_volumes, RID p_environment, RID p_camera_effects, RID p_shadow_atlas, RID p_occluder_debug_tex, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_lod_threshold, const RenderShadowData *p_render_shadows, int p_render_shadow_count, const RenderSDFGIData *p_render_sdfgi_regions, int p_render_sdfgi_region_count, const RenderSDFGIUpdateData *p_sdfgi_update_data, RendererScene::RenderInfo *r_render_info) {
|
||||
void RasterizerSceneGLES3::render_scene(RID p_render_buffers, const CameraData *p_camera_data, const PagedArray<GeometryInstance *> &p_instances, const PagedArray<RID> &p_lights, const PagedArray<RID> &p_reflection_probes, const PagedArray<RID> &p_voxel_gi_instances, const PagedArray<RID> &p_decals, const PagedArray<RID> &p_lightmaps, const PagedArray<RID> &p_fog_volumes, RID p_environment, RID p_camera_effects, RID p_shadow_atlas, RID p_occluder_debug_tex, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_mesh_lod_threshold, const RenderShadowData *p_render_shadows, int p_render_shadow_count, const RenderSDFGIData *p_render_sdfgi_regions, int p_render_sdfgi_region_count, const RenderSDFGIUpdateData *p_sdfgi_update_data, RendererScene::RenderInfo *r_render_info) {
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES3::render_material(const Transform3D &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, const PagedArray<GeometryInstance *> &p_instances, RID p_framebuffer, const Rect2i &p_region) {
|
||||
|
@ -196,7 +196,7 @@ public:
|
||||
|
||||
void voxel_gi_set_quality(RS::VoxelGIQuality) override;
|
||||
|
||||
void render_scene(RID p_render_buffers, const CameraData *p_camera_data, const PagedArray<GeometryInstance *> &p_instances, const PagedArray<RID> &p_lights, const PagedArray<RID> &p_reflection_probes, const PagedArray<RID> &p_voxel_gi_instances, const PagedArray<RID> &p_decals, const PagedArray<RID> &p_lightmaps, const PagedArray<RID> &p_fog_volumes, RID p_environment, RID p_camera_effects, RID p_shadow_atlas, RID p_occluder_debug_tex, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_lod_threshold, const RenderShadowData *p_render_shadows, int p_render_shadow_count, const RenderSDFGIData *p_render_sdfgi_regions, int p_render_sdfgi_region_count, const RenderSDFGIUpdateData *p_sdfgi_update_data = nullptr, RendererScene::RenderInfo *r_render_info = nullptr) override;
|
||||
void render_scene(RID p_render_buffers, const CameraData *p_camera_data, const PagedArray<GeometryInstance *> &p_instances, const PagedArray<RID> &p_lights, const PagedArray<RID> &p_reflection_probes, const PagedArray<RID> &p_voxel_gi_instances, const PagedArray<RID> &p_decals, const PagedArray<RID> &p_lightmaps, const PagedArray<RID> &p_fog_volumes, RID p_environment, RID p_camera_effects, RID p_shadow_atlas, RID p_occluder_debug_tex, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_mesh_lod_threshold, const RenderShadowData *p_render_shadows, int p_render_shadow_count, const RenderSDFGIData *p_render_sdfgi_regions, int p_render_sdfgi_region_count, const RenderSDFGIUpdateData *p_sdfgi_update_data = nullptr, RendererScene::RenderInfo *r_render_info = nullptr) override;
|
||||
void render_material(const Transform3D &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, const PagedArray<GeometryInstance *> &p_instances, RID p_framebuffer, const Rect2i &p_region) override;
|
||||
void render_particle_collider_heightfield(RID p_collider, const Transform3D &p_transform, const PagedArray<GeometryInstance *> &p_instances) override;
|
||||
|
||||
|
@ -2283,10 +2283,10 @@ void RasterizerStorageGLES3::mesh_instance_check_for_update(RID p_mesh_instance)
|
||||
void RasterizerStorageGLES3::update_mesh_instances() {
|
||||
}
|
||||
|
||||
void RasterizerStorageGLES3::reflection_probe_set_lod_threshold(RID p_probe, float p_ratio) {
|
||||
void RasterizerStorageGLES3::reflection_probe_set_mesh_lod_threshold(RID p_probe, float p_ratio) {
|
||||
}
|
||||
|
||||
float RasterizerStorageGLES3::reflection_probe_get_lod_threshold(RID p_probe) const {
|
||||
float RasterizerStorageGLES3::reflection_probe_get_mesh_lod_threshold(RID p_probe) const {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
@ -809,8 +809,8 @@ public:
|
||||
void mesh_instance_set_blend_shape_weight(RID p_mesh_instance, int p_shape, float p_weight) override;
|
||||
void mesh_instance_check_for_update(RID p_mesh_instance) override;
|
||||
void update_mesh_instances() override;
|
||||
void reflection_probe_set_lod_threshold(RID p_probe, float p_ratio) override;
|
||||
float reflection_probe_get_lod_threshold(RID p_probe) const override;
|
||||
void reflection_probe_set_mesh_lod_threshold(RID p_probe, float p_ratio) override;
|
||||
float reflection_probe_get_mesh_lod_threshold(RID p_probe) const override;
|
||||
|
||||
void mesh_add_surface(RID p_mesh, const RS::SurfaceData &p_surface) override;
|
||||
|
||||
|
@ -522,8 +522,8 @@ void EditorNode::_update_from_settings() {
|
||||
Viewport::SDFScale sdf_scale = Viewport::SDFScale(int(GLOBAL_GET("rendering/2d/sdf/scale")));
|
||||
scene_root->set_sdf_scale(sdf_scale);
|
||||
|
||||
float lod_threshold = GLOBAL_GET("rendering/mesh_lod/lod_change/threshold_pixels");
|
||||
scene_root->set_lod_threshold(lod_threshold);
|
||||
float mesh_lod_threshold = GLOBAL_GET("rendering/mesh_lod/lod_change/threshold_pixels");
|
||||
scene_root->set_mesh_lod_threshold(mesh_lod_threshold);
|
||||
|
||||
RS::get_singleton()->decals_set_filter(RS::DecalFilter(int(GLOBAL_GET("rendering/textures/decals/filter"))));
|
||||
RS::get_singleton()->light_projectors_set_filter(RS::LightProjectorFilter(int(GLOBAL_GET("rendering/textures/light_projectors/filter"))));
|
||||
|
@ -2688,8 +2688,8 @@ void Node3DEditorViewport::_project_settings_changed() {
|
||||
const bool use_occlusion_culling = GLOBAL_GET("rendering/occlusion_culling/use_occlusion_culling");
|
||||
viewport->set_use_occlusion_culling(use_occlusion_culling);
|
||||
|
||||
const float lod_threshold = GLOBAL_GET("rendering/mesh_lod/lod_change/threshold_pixels");
|
||||
viewport->set_lod_threshold(lod_threshold);
|
||||
const float mesh_lod_threshold = GLOBAL_GET("rendering/mesh_lod/lod_change/threshold_pixels");
|
||||
viewport->set_mesh_lod_threshold(mesh_lod_threshold);
|
||||
}
|
||||
|
||||
void Node3DEditorViewport::_notification(int p_what) {
|
||||
|
@ -76,13 +76,13 @@ float ReflectionProbe::get_max_distance() const {
|
||||
return max_distance;
|
||||
}
|
||||
|
||||
void ReflectionProbe::set_lod_threshold(float p_pixels) {
|
||||
lod_threshold = p_pixels;
|
||||
RS::get_singleton()->reflection_probe_set_lod_threshold(probe, p_pixels);
|
||||
void ReflectionProbe::set_mesh_lod_threshold(float p_pixels) {
|
||||
mesh_lod_threshold = p_pixels;
|
||||
RS::get_singleton()->reflection_probe_set_mesh_lod_threshold(probe, p_pixels);
|
||||
}
|
||||
|
||||
float ReflectionProbe::get_lod_threshold() const {
|
||||
return lod_threshold;
|
||||
float ReflectionProbe::get_mesh_lod_threshold() const {
|
||||
return mesh_lod_threshold;
|
||||
}
|
||||
|
||||
void ReflectionProbe::set_extents(const Vector3 &p_extents) {
|
||||
@ -207,8 +207,8 @@ void ReflectionProbe::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_max_distance", "max_distance"), &ReflectionProbe::set_max_distance);
|
||||
ClassDB::bind_method(D_METHOD("get_max_distance"), &ReflectionProbe::get_max_distance);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_lod_threshold", "ratio"), &ReflectionProbe::set_lod_threshold);
|
||||
ClassDB::bind_method(D_METHOD("get_lod_threshold"), &ReflectionProbe::get_lod_threshold);
|
||||
ClassDB::bind_method(D_METHOD("set_mesh_lod_threshold", "ratio"), &ReflectionProbe::set_mesh_lod_threshold);
|
||||
ClassDB::bind_method(D_METHOD("get_mesh_lod_threshold"), &ReflectionProbe::get_mesh_lod_threshold);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_extents", "extents"), &ReflectionProbe::set_extents);
|
||||
ClassDB::bind_method(D_METHOD("get_extents"), &ReflectionProbe::get_extents);
|
||||
@ -240,7 +240,7 @@ void ReflectionProbe::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "interior"), "set_as_interior", "is_set_as_interior");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "enable_shadows"), "set_enable_shadows", "are_shadows_enabled");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "cull_mask", PROPERTY_HINT_LAYERS_3D_RENDER), "set_cull_mask", "get_cull_mask");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "lod_threshold", PROPERTY_HINT_RANGE, "0,1024,0.1"), "set_lod_threshold", "get_lod_threshold");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "mesh_lod_threshold", PROPERTY_HINT_RANGE, "0,1024,0.1"), "set_mesh_lod_threshold", "get_mesh_lod_threshold");
|
||||
|
||||
ADD_GROUP("Ambient", "ambient_");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "ambient_mode", PROPERTY_HINT_ENUM, "Disabled,Environment,Constant Color"), "set_ambient_mode", "get_ambient_mode");
|
||||
|
@ -60,7 +60,7 @@ private:
|
||||
AmbientMode ambient_mode = AMBIENT_ENVIRONMENT;
|
||||
Color ambient_color = Color(0, 0, 0);
|
||||
float ambient_color_energy = 1.0;
|
||||
float lod_threshold = 1.0;
|
||||
float mesh_lod_threshold = 1.0;
|
||||
|
||||
uint32_t cull_mask = (1 << 20) - 1;
|
||||
UpdateMode update_mode = UPDATE_ONCE;
|
||||
@ -88,8 +88,8 @@ public:
|
||||
void set_max_distance(float p_distance);
|
||||
float get_max_distance() const;
|
||||
|
||||
void set_lod_threshold(float p_pixels);
|
||||
float get_lod_threshold() const;
|
||||
void set_mesh_lod_threshold(float p_pixels);
|
||||
float get_mesh_lod_threshold() const;
|
||||
|
||||
void set_extents(const Vector3 &p_extents);
|
||||
Vector3 get_extents() const;
|
||||
|
@ -1355,9 +1355,9 @@ SceneTree::SceneTree() {
|
||||
const bool use_occlusion_culling = GLOBAL_DEF("rendering/occlusion_culling/use_occlusion_culling", false);
|
||||
root->set_use_occlusion_culling(use_occlusion_culling);
|
||||
|
||||
float lod_threshold = GLOBAL_DEF("rendering/mesh_lod/lod_change/threshold_pixels", 1.0);
|
||||
float mesh_lod_threshold = GLOBAL_DEF("rendering/mesh_lod/lod_change/threshold_pixels", 1.0);
|
||||
ProjectSettings::get_singleton()->set_custom_property_info("rendering/mesh_lod/lod_change/threshold_pixels", PropertyInfo(Variant::FLOAT, "rendering/mesh_lod/lod_change/threshold_pixels", PROPERTY_HINT_RANGE, "0,1024,0.1"));
|
||||
root->set_lod_threshold(lod_threshold);
|
||||
root->set_mesh_lod_threshold(mesh_lod_threshold);
|
||||
|
||||
bool snap_2d_transforms = GLOBAL_DEF("rendering/2d/snap/snap_2d_transforms_to_pixel", false);
|
||||
root->set_snap_2d_transforms_to_pixel(snap_2d_transforms);
|
||||
|
@ -2833,13 +2833,13 @@ bool Viewport::is_using_debanding() const {
|
||||
return use_debanding;
|
||||
}
|
||||
|
||||
void Viewport::set_lod_threshold(float p_pixels) {
|
||||
lod_threshold = p_pixels;
|
||||
RS::get_singleton()->viewport_set_lod_threshold(viewport, lod_threshold);
|
||||
void Viewport::set_mesh_lod_threshold(float p_pixels) {
|
||||
mesh_lod_threshold = p_pixels;
|
||||
RS::get_singleton()->viewport_set_mesh_lod_threshold(viewport, mesh_lod_threshold);
|
||||
}
|
||||
|
||||
float Viewport::get_lod_threshold() const {
|
||||
return lod_threshold;
|
||||
float Viewport::get_mesh_lod_threshold() const {
|
||||
return mesh_lod_threshold;
|
||||
}
|
||||
|
||||
void Viewport::set_use_occlusion_culling(bool p_use_occlusion_culling) {
|
||||
@ -3634,8 +3634,8 @@ void Viewport::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_sdf_scale", "scale"), &Viewport::set_sdf_scale);
|
||||
ClassDB::bind_method(D_METHOD("get_sdf_scale"), &Viewport::get_sdf_scale);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_lod_threshold", "pixels"), &Viewport::set_lod_threshold);
|
||||
ClassDB::bind_method(D_METHOD("get_lod_threshold"), &Viewport::get_lod_threshold);
|
||||
ClassDB::bind_method(D_METHOD("set_mesh_lod_threshold", "pixels"), &Viewport::set_mesh_lod_threshold);
|
||||
ClassDB::bind_method(D_METHOD("get_mesh_lod_threshold"), &Viewport::get_mesh_lod_threshold);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_process_picking"), &Viewport::_process_picking);
|
||||
|
||||
@ -3685,7 +3685,7 @@ void Viewport::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "screen_space_aa", PROPERTY_HINT_ENUM, "Disabled (Fastest),FXAA (Fast)"), "set_screen_space_aa", "get_screen_space_aa");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_debanding"), "set_use_debanding", "is_using_debanding");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_occlusion_culling"), "set_use_occlusion_culling", "is_using_occlusion_culling");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "lod_threshold", PROPERTY_HINT_RANGE, "0,1024,0.1"), "set_lod_threshold", "get_lod_threshold");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "mesh_lod_threshold", PROPERTY_HINT_RANGE, "0,1024,0.1"), "set_mesh_lod_threshold", "get_mesh_lod_threshold");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "debug_draw", PROPERTY_HINT_ENUM, "Disabled,Unshaded,Overdraw,Wireframe"), "set_debug_draw", "get_debug_draw");
|
||||
#ifndef _3D_DISABLED
|
||||
ADD_GROUP("Scaling 3D", "");
|
||||
@ -3825,7 +3825,7 @@ Viewport::Viewport() {
|
||||
set_shadow_atlas_quadrant_subdiv(2, SHADOW_ATLAS_QUADRANT_SUBDIV_16);
|
||||
set_shadow_atlas_quadrant_subdiv(3, SHADOW_ATLAS_QUADRANT_SUBDIV_64);
|
||||
|
||||
set_lod_threshold(lod_threshold);
|
||||
set_mesh_lod_threshold(mesh_lod_threshold);
|
||||
|
||||
String id = itos(get_instance_id());
|
||||
input_group = "_vp_input" + id;
|
||||
|
@ -297,7 +297,7 @@ private:
|
||||
float fsr_sharpness = 0.2f;
|
||||
float fsr_mipmap_bias = 0.0f;
|
||||
bool use_debanding = false;
|
||||
float lod_threshold = 1.0;
|
||||
float mesh_lod_threshold = 1.0;
|
||||
bool use_occlusion_culling = false;
|
||||
|
||||
Ref<ViewportTexture> default_texture;
|
||||
@ -531,8 +531,8 @@ public:
|
||||
void set_use_debanding(bool p_use_debanding);
|
||||
bool is_using_debanding() const;
|
||||
|
||||
void set_lod_threshold(float p_pixels);
|
||||
float get_lod_threshold() const;
|
||||
void set_mesh_lod_threshold(float p_pixels);
|
||||
float get_mesh_lod_threshold() const;
|
||||
|
||||
void set_use_occlusion_culling(bool p_us_occlusion_culling);
|
||||
bool is_using_occlusion_culling() const;
|
||||
|
@ -188,7 +188,7 @@ public:
|
||||
|
||||
void voxel_gi_set_quality(RS::VoxelGIQuality) override {}
|
||||
|
||||
void render_scene(RID p_render_buffers, const CameraData *p_camera_data, const PagedArray<GeometryInstance *> &p_instances, const PagedArray<RID> &p_lights, const PagedArray<RID> &p_reflection_probes, const PagedArray<RID> &p_voxel_gi_instances, const PagedArray<RID> &p_decals, const PagedArray<RID> &p_lightmaps, const PagedArray<RID> &p_fog_volumes, RID p_environment, RID p_camera_effects, RID p_shadow_atlas, RID p_occluder_debug_tex, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_lod_threshold, const RenderShadowData *p_render_shadows, int p_render_shadow_count, const RenderSDFGIData *p_render_sdfgi_regions, int p_render_sdfgi_region_count, const RenderSDFGIUpdateData *p_sdfgi_update_data = nullptr, RendererScene::RenderInfo *r_info = nullptr) override {}
|
||||
void render_scene(RID p_render_buffers, const CameraData *p_camera_data, const PagedArray<GeometryInstance *> &p_instances, const PagedArray<RID> &p_lights, const PagedArray<RID> &p_reflection_probes, const PagedArray<RID> &p_voxel_gi_instances, const PagedArray<RID> &p_decals, const PagedArray<RID> &p_lightmaps, const PagedArray<RID> &p_fog_volumes, RID p_environment, RID p_camera_effects, RID p_shadow_atlas, RID p_occluder_debug_tex, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_mesh_lod_threshold, const RenderShadowData *p_render_shadows, int p_render_shadow_count, const RenderSDFGIData *p_render_sdfgi_regions, int p_render_sdfgi_region_count, const RenderSDFGIUpdateData *p_sdfgi_update_data = nullptr, RendererScene::RenderInfo *r_info = nullptr) override {}
|
||||
void render_material(const Transform3D &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, const PagedArray<GeometryInstance *> &p_instances, RID p_framebuffer, const Rect2i &p_region) override {}
|
||||
void render_particle_collider_heightfield(RID p_collider, const Transform3D &p_transform, const PagedArray<GeometryInstance *> &p_instances) override {}
|
||||
|
||||
@ -329,8 +329,8 @@ public:
|
||||
void mesh_instance_set_blend_shape_weight(RID p_mesh_instance, int p_shape, float p_weight) override {}
|
||||
void mesh_instance_check_for_update(RID p_mesh_instance) override {}
|
||||
void update_mesh_instances() override {}
|
||||
void reflection_probe_set_lod_threshold(RID p_probe, float p_ratio) override {}
|
||||
float reflection_probe_get_lod_threshold(RID p_probe) const override { return 0.0; }
|
||||
void reflection_probe_set_mesh_lod_threshold(RID p_probe, float p_ratio) override {}
|
||||
float reflection_probe_get_mesh_lod_threshold(RID p_probe) const override { return 0.0; }
|
||||
|
||||
void mesh_add_surface(RID p_mesh, const RS::SurfaceData &p_surface) override {}
|
||||
|
||||
|
@ -1062,7 +1062,7 @@ void RenderForwardClustered::_fill_render_list(RenderListType p_render_list, con
|
||||
|
||||
// LOD
|
||||
|
||||
if (p_render_data->screen_lod_threshold > 0.0 && storage->mesh_surface_has_lod(surf->surface)) {
|
||||
if (p_render_data->screen_mesh_lod_threshold > 0.0 && storage->mesh_surface_has_lod(surf->surface)) {
|
||||
//lod
|
||||
Vector3 lod_support_min = inst->transformed_aabb.get_support(-p_render_data->lod_camera_plane.normal);
|
||||
Vector3 lod_support_max = inst->transformed_aabb.get_support(p_render_data->lod_camera_plane.normal);
|
||||
@ -1082,7 +1082,7 @@ void RenderForwardClustered::_fill_render_list(RenderListType p_render_list, con
|
||||
}
|
||||
|
||||
uint32_t indices;
|
||||
surf->sort.lod_index = storage->mesh_surface_get_lod(surf->surface, inst->lod_model_scale * inst->lod_bias, distance * p_render_data->lod_distance_multiplier, p_render_data->screen_lod_threshold, &indices);
|
||||
surf->sort.lod_index = storage->mesh_surface_get_lod(surf->surface, inst->lod_model_scale * inst->lod_bias, distance * p_render_data->lod_distance_multiplier, p_render_data->screen_mesh_lod_threshold, &indices);
|
||||
if (p_render_data->render_info) {
|
||||
indices = _indices_to_primitives(surf->primitive, indices);
|
||||
if (p_render_list == RENDER_LIST_OPAQUE) { //opaque
|
||||
@ -1429,7 +1429,7 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
|
||||
RID rp_uniform_set = _setup_render_pass_uniform_set(RENDER_LIST_OPAQUE, nullptr, RID());
|
||||
|
||||
bool finish_depth = using_ssao || using_sdfgi || using_voxelgi;
|
||||
RenderListParameters render_list_params(render_list[RENDER_LIST_OPAQUE].elements.ptr(), render_list[RENDER_LIST_OPAQUE].element_info.ptr(), render_list[RENDER_LIST_OPAQUE].elements.size(), reverse_cull, depth_pass_mode, render_buffer == nullptr, p_render_data->directional_light_soft_shadows, rp_uniform_set, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME, Vector2(), p_render_data->lod_camera_plane, p_render_data->lod_distance_multiplier, p_render_data->screen_lod_threshold);
|
||||
RenderListParameters render_list_params(render_list[RENDER_LIST_OPAQUE].elements.ptr(), render_list[RENDER_LIST_OPAQUE].element_info.ptr(), render_list[RENDER_LIST_OPAQUE].elements.size(), reverse_cull, depth_pass_mode, render_buffer == nullptr, p_render_data->directional_light_soft_shadows, rp_uniform_set, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME, Vector2(), p_render_data->lod_camera_plane, p_render_data->lod_distance_multiplier, p_render_data->screen_mesh_lod_threshold);
|
||||
_render_list_with_threads(&render_list_params, depth_framebuffer, needs_pre_resolve ? RD::INITIAL_ACTION_CONTINUE : RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_READ, needs_pre_resolve ? RD::INITIAL_ACTION_CONTINUE : RD::INITIAL_ACTION_CLEAR, finish_depth ? RD::FINAL_ACTION_READ : RD::FINAL_ACTION_CONTINUE, needs_pre_resolve ? Vector<Color>() : depth_pass_clear);
|
||||
|
||||
RD::get_singleton()->draw_command_end_label();
|
||||
@ -1487,7 +1487,7 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
|
||||
}
|
||||
|
||||
RID framebuffer = using_separate_specular ? opaque_specular_framebuffer : opaque_framebuffer;
|
||||
RenderListParameters render_list_params(render_list[RENDER_LIST_OPAQUE].elements.ptr(), render_list[RENDER_LIST_OPAQUE].element_info.ptr(), render_list[RENDER_LIST_OPAQUE].elements.size(), reverse_cull, using_separate_specular ? PASS_MODE_COLOR_SPECULAR : PASS_MODE_COLOR, render_buffer == nullptr, p_render_data->directional_light_soft_shadows, rp_uniform_set, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME, Vector2(), p_render_data->lod_camera_plane, p_render_data->lod_distance_multiplier, p_render_data->screen_lod_threshold);
|
||||
RenderListParameters render_list_params(render_list[RENDER_LIST_OPAQUE].elements.ptr(), render_list[RENDER_LIST_OPAQUE].element_info.ptr(), render_list[RENDER_LIST_OPAQUE].elements.size(), reverse_cull, using_separate_specular ? PASS_MODE_COLOR_SPECULAR : PASS_MODE_COLOR, render_buffer == nullptr, p_render_data->directional_light_soft_shadows, rp_uniform_set, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME, Vector2(), p_render_data->lod_camera_plane, p_render_data->lod_distance_multiplier, p_render_data->screen_mesh_lod_threshold);
|
||||
_render_list_with_threads(&render_list_params, framebuffer, keep_color ? RD::INITIAL_ACTION_KEEP : RD::INITIAL_ACTION_CLEAR, will_continue_color ? RD::FINAL_ACTION_CONTINUE : RD::FINAL_ACTION_READ, depth_pre_pass ? (continue_depth ? RD::INITIAL_ACTION_CONTINUE : RD::INITIAL_ACTION_KEEP) : RD::INITIAL_ACTION_CLEAR, will_continue_depth ? RD::FINAL_ACTION_CONTINUE : RD::FINAL_ACTION_READ, c, 1.0, 0);
|
||||
if (will_continue_color && using_separate_specular) {
|
||||
// close the specular framebuffer, as it's no longer used
|
||||
@ -1594,7 +1594,7 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
|
||||
_setup_environment(p_render_data, p_render_data->reflection_probe.is_valid(), screen_size, !p_render_data->reflection_probe.is_valid(), p_default_bg_color, false);
|
||||
|
||||
{
|
||||
RenderListParameters render_list_params(render_list[RENDER_LIST_ALPHA].elements.ptr(), render_list[RENDER_LIST_ALPHA].element_info.ptr(), render_list[RENDER_LIST_ALPHA].elements.size(), false, PASS_MODE_COLOR_TRANSPARENT, render_buffer == nullptr, p_render_data->directional_light_soft_shadows, rp_uniform_set, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME, Vector2(), p_render_data->lod_camera_plane, p_render_data->lod_distance_multiplier, p_render_data->screen_lod_threshold);
|
||||
RenderListParameters render_list_params(render_list[RENDER_LIST_ALPHA].elements.ptr(), render_list[RENDER_LIST_ALPHA].element_info.ptr(), render_list[RENDER_LIST_ALPHA].elements.size(), false, PASS_MODE_COLOR_TRANSPARENT, render_buffer == nullptr, p_render_data->directional_light_soft_shadows, rp_uniform_set, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME, Vector2(), p_render_data->lod_camera_plane, p_render_data->lod_distance_multiplier, p_render_data->screen_mesh_lod_threshold);
|
||||
_render_list_with_threads(&render_list_params, alpha_framebuffer, can_continue_color ? RD::INITIAL_ACTION_CONTINUE : RD::INITIAL_ACTION_KEEP, RD::FINAL_ACTION_READ, can_continue_depth ? RD::INITIAL_ACTION_CONTINUE : RD::INITIAL_ACTION_KEEP, RD::FINAL_ACTION_READ);
|
||||
}
|
||||
|
||||
@ -1635,7 +1635,7 @@ void RenderForwardClustered::_render_shadow_begin() {
|
||||
scene_state.instance_data[RENDER_LIST_SECONDARY].clear();
|
||||
}
|
||||
|
||||
void RenderForwardClustered::_render_shadow_append(RID p_framebuffer, const PagedArray<GeometryInstance *> &p_instances, const CameraMatrix &p_projection, const Transform3D &p_transform, float p_zfar, float p_bias, float p_normal_bias, bool p_use_dp, bool p_use_dp_flip, bool p_use_pancake, const Plane &p_camera_plane, float p_lod_distance_multiplier, float p_screen_lod_threshold, const Rect2i &p_rect, bool p_flip_y, bool p_clear_region, bool p_begin, bool p_end, RendererScene::RenderInfo *p_render_info) {
|
||||
void RenderForwardClustered::_render_shadow_append(RID p_framebuffer, const PagedArray<GeometryInstance *> &p_instances, const CameraMatrix &p_projection, const Transform3D &p_transform, float p_zfar, float p_bias, float p_normal_bias, bool p_use_dp, bool p_use_dp_flip, bool p_use_pancake, const Plane &p_camera_plane, float p_lod_distance_multiplier, float p_screen_mesh_lod_threshold, const Rect2i &p_rect, bool p_flip_y, bool p_clear_region, bool p_begin, bool p_end, RendererScene::RenderInfo *p_render_info) {
|
||||
uint32_t shadow_pass_index = scene_state.shadow_passes.size();
|
||||
|
||||
SceneState::ShadowPass shadow_pass;
|
||||
@ -1658,9 +1658,9 @@ void RenderForwardClustered::_render_shadow_append(RID p_framebuffer, const Page
|
||||
_setup_environment(&render_data, true, Vector2(1, 1), !p_flip_y, Color(), false, p_use_pancake, shadow_pass_index);
|
||||
|
||||
if (get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_DISABLE_LOD) {
|
||||
render_data.screen_lod_threshold = 0.0;
|
||||
render_data.screen_mesh_lod_threshold = 0.0;
|
||||
} else {
|
||||
render_data.screen_lod_threshold = p_screen_lod_threshold;
|
||||
render_data.screen_mesh_lod_threshold = p_screen_mesh_lod_threshold;
|
||||
}
|
||||
|
||||
PassMode pass_mode = p_use_dp ? PASS_MODE_SHADOW_DP : PASS_MODE_SHADOW;
|
||||
@ -1685,7 +1685,7 @@ void RenderForwardClustered::_render_shadow_append(RID p_framebuffer, const Page
|
||||
|
||||
shadow_pass.rp_uniform_set = RID(); //will be filled later when instance buffer is complete
|
||||
shadow_pass.camera_plane = p_camera_plane;
|
||||
shadow_pass.screen_lod_threshold = render_data.screen_lod_threshold;
|
||||
shadow_pass.screen_mesh_lod_threshold = render_data.screen_mesh_lod_threshold;
|
||||
shadow_pass.lod_distance_multiplier = render_data.lod_distance_multiplier;
|
||||
|
||||
shadow_pass.framebuffer = p_framebuffer;
|
||||
@ -1714,7 +1714,7 @@ void RenderForwardClustered::_render_shadow_end(uint32_t p_barrier) {
|
||||
|
||||
for (uint32_t i = 0; i < scene_state.shadow_passes.size(); i++) {
|
||||
SceneState::ShadowPass &shadow_pass = scene_state.shadow_passes[i];
|
||||
RenderListParameters render_list_parameters(render_list[RENDER_LIST_SECONDARY].elements.ptr() + shadow_pass.element_from, render_list[RENDER_LIST_SECONDARY].element_info.ptr() + shadow_pass.element_from, shadow_pass.element_count, shadow_pass.flip_cull, shadow_pass.pass_mode, true, false, shadow_pass.rp_uniform_set, false, Vector2(), shadow_pass.camera_plane, shadow_pass.lod_distance_multiplier, shadow_pass.screen_lod_threshold, shadow_pass.element_from, RD::BARRIER_MASK_NO_BARRIER);
|
||||
RenderListParameters render_list_parameters(render_list[RENDER_LIST_SECONDARY].elements.ptr() + shadow_pass.element_from, render_list[RENDER_LIST_SECONDARY].element_info.ptr() + shadow_pass.element_from, shadow_pass.element_count, shadow_pass.flip_cull, shadow_pass.pass_mode, true, false, shadow_pass.rp_uniform_set, false, Vector2(), shadow_pass.camera_plane, shadow_pass.lod_distance_multiplier, shadow_pass.screen_mesh_lod_threshold, shadow_pass.element_from, RD::BARRIER_MASK_NO_BARRIER);
|
||||
_render_list_with_threads(&render_list_parameters, shadow_pass.framebuffer, RD::INITIAL_ACTION_DROP, RD::FINAL_ACTION_DISCARD, shadow_pass.initial_depth_action, shadow_pass.final_depth_action, Vector<Color>(), 1.0, 0, shadow_pass.rect);
|
||||
}
|
||||
|
||||
|
@ -162,13 +162,13 @@ class RenderForwardClustered : public RendererSceneRenderRD {
|
||||
Vector2 uv_offset;
|
||||
Plane lod_plane;
|
||||
float lod_distance_multiplier = 0.0;
|
||||
float screen_lod_threshold = 0.0;
|
||||
float screen_mesh_lod_threshold = 0.0;
|
||||
RD::FramebufferFormatID framebuffer_format = 0;
|
||||
uint32_t element_offset = 0;
|
||||
uint32_t barrier = RD::BARRIER_MASK_ALL;
|
||||
bool use_directional_soft_shadow = false;
|
||||
|
||||
RenderListParameters(GeometryInstanceSurfaceDataCache **p_elements, RenderElementInfo *p_element_info, int p_element_count, bool p_reverse_cull, PassMode p_pass_mode, bool p_no_gi, bool p_use_directional_soft_shadows, RID p_render_pass_uniform_set, bool p_force_wireframe = false, const Vector2 &p_uv_offset = Vector2(), const Plane &p_lod_plane = Plane(), float p_lod_distance_multiplier = 0.0, float p_screen_lod_threshold = 0.0, uint32_t p_element_offset = 0, uint32_t p_barrier = RD::BARRIER_MASK_ALL) {
|
||||
RenderListParameters(GeometryInstanceSurfaceDataCache **p_elements, RenderElementInfo *p_element_info, int p_element_count, bool p_reverse_cull, PassMode p_pass_mode, bool p_no_gi, bool p_use_directional_soft_shadows, RID p_render_pass_uniform_set, bool p_force_wireframe = false, const Vector2 &p_uv_offset = Vector2(), const Plane &p_lod_plane = Plane(), float p_lod_distance_multiplier = 0.0, float p_screen_mesh_lod_threshold = 0.0, uint32_t p_element_offset = 0, uint32_t p_barrier = RD::BARRIER_MASK_ALL) {
|
||||
elements = p_elements;
|
||||
element_info = p_element_info;
|
||||
element_count = p_element_count;
|
||||
@ -180,7 +180,7 @@ class RenderForwardClustered : public RendererSceneRenderRD {
|
||||
uv_offset = p_uv_offset;
|
||||
lod_plane = p_lod_plane;
|
||||
lod_distance_multiplier = p_lod_distance_multiplier;
|
||||
screen_lod_threshold = p_screen_lod_threshold;
|
||||
screen_mesh_lod_threshold = p_screen_mesh_lod_threshold;
|
||||
element_offset = p_element_offset;
|
||||
barrier = p_barrier;
|
||||
use_directional_soft_shadow = p_use_directional_soft_shadows;
|
||||
@ -342,7 +342,7 @@ class RenderForwardClustered : public RendererSceneRenderRD {
|
||||
RID rp_uniform_set;
|
||||
Plane camera_plane;
|
||||
float lod_distance_multiplier;
|
||||
float screen_lod_threshold;
|
||||
float screen_mesh_lod_threshold;
|
||||
|
||||
RID framebuffer;
|
||||
RD::InitialAction initial_depth_action;
|
||||
@ -594,7 +594,7 @@ protected:
|
||||
virtual void _render_scene(RenderDataRD *p_render_data, const Color &p_default_bg_color) override;
|
||||
|
||||
virtual void _render_shadow_begin() override;
|
||||
virtual void _render_shadow_append(RID p_framebuffer, const PagedArray<GeometryInstance *> &p_instances, const CameraMatrix &p_projection, const Transform3D &p_transform, float p_zfar, float p_bias, float p_normal_bias, bool p_use_dp, bool p_use_dp_flip, bool p_use_pancake, const Plane &p_camera_plane = Plane(), float p_lod_distance_multiplier = 0.0, float p_screen_lod_threshold = 0.0, const Rect2i &p_rect = Rect2i(), bool p_flip_y = false, bool p_clear_region = true, bool p_begin = true, bool p_end = true, RendererScene::RenderInfo *p_render_info = nullptr) override;
|
||||
virtual void _render_shadow_append(RID p_framebuffer, const PagedArray<GeometryInstance *> &p_instances, const CameraMatrix &p_projection, const Transform3D &p_transform, float p_zfar, float p_bias, float p_normal_bias, bool p_use_dp, bool p_use_dp_flip, bool p_use_pancake, const Plane &p_camera_plane = Plane(), float p_lod_distance_multiplier = 0.0, float p_screen_mesh_lod_threshold = 0.0, const Rect2i &p_rect = Rect2i(), bool p_flip_y = false, bool p_clear_region = true, bool p_begin = true, bool p_end = true, RendererScene::RenderInfo *p_render_info = nullptr) override;
|
||||
virtual void _render_shadow_process() override;
|
||||
virtual void _render_shadow_end(uint32_t p_barrier = RD::BARRIER_MASK_ALL) override;
|
||||
|
||||
|
@ -730,7 +730,7 @@ void RenderForwardMobile::_render_scene(RenderDataRD *p_render_data, const Color
|
||||
}
|
||||
|
||||
RD::FramebufferFormatID fb_format = RD::get_singleton()->framebuffer_get_format(framebuffer);
|
||||
RenderListParameters render_list_params(render_list[RENDER_LIST_OPAQUE].elements.ptr(), render_list[RENDER_LIST_OPAQUE].element_info.ptr(), render_list[RENDER_LIST_OPAQUE].elements.size(), reverse_cull, PASS_MODE_COLOR, rp_uniform_set, spec_constant_base_flags, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME, Vector2(), p_render_data->lod_camera_plane, p_render_data->lod_distance_multiplier, p_render_data->screen_lod_threshold, p_render_data->view_count);
|
||||
RenderListParameters render_list_params(render_list[RENDER_LIST_OPAQUE].elements.ptr(), render_list[RENDER_LIST_OPAQUE].element_info.ptr(), render_list[RENDER_LIST_OPAQUE].elements.size(), reverse_cull, PASS_MODE_COLOR, rp_uniform_set, spec_constant_base_flags, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME, Vector2(), p_render_data->lod_camera_plane, p_render_data->lod_distance_multiplier, p_render_data->screen_mesh_lod_threshold, p_render_data->view_count);
|
||||
render_list_params.framebuffer_format = fb_format;
|
||||
if ((uint32_t)render_list_params.element_count > render_list_thread_threshold && false) {
|
||||
// secondary command buffers need more testing at this time
|
||||
@ -794,7 +794,7 @@ void RenderForwardMobile::_render_scene(RenderDataRD *p_render_data, const Color
|
||||
|
||||
if (using_subpass_transparent) {
|
||||
RD::FramebufferFormatID fb_format = RD::get_singleton()->framebuffer_get_format(framebuffer);
|
||||
RenderListParameters render_list_params(render_list[RENDER_LIST_ALPHA].elements.ptr(), render_list[RENDER_LIST_ALPHA].element_info.ptr(), render_list[RENDER_LIST_ALPHA].elements.size(), reverse_cull, PASS_MODE_COLOR_TRANSPARENT, rp_uniform_set, spec_constant_base_flags, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME, Vector2(), p_render_data->lod_camera_plane, p_render_data->lod_distance_multiplier, p_render_data->screen_lod_threshold, p_render_data->view_count);
|
||||
RenderListParameters render_list_params(render_list[RENDER_LIST_ALPHA].elements.ptr(), render_list[RENDER_LIST_ALPHA].element_info.ptr(), render_list[RENDER_LIST_ALPHA].elements.size(), reverse_cull, PASS_MODE_COLOR_TRANSPARENT, rp_uniform_set, spec_constant_base_flags, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME, Vector2(), p_render_data->lod_camera_plane, p_render_data->lod_distance_multiplier, p_render_data->screen_mesh_lod_threshold, p_render_data->view_count);
|
||||
render_list_params.framebuffer_format = fb_format;
|
||||
if ((uint32_t)render_list_params.element_count > render_list_thread_threshold && false) {
|
||||
// secondary command buffers need more testing at this time
|
||||
@ -831,7 +831,7 @@ void RenderForwardMobile::_render_scene(RenderDataRD *p_render_data, const Color
|
||||
// _setup_environment(p_render_data, p_render_data->reflection_probe.is_valid(), screen_size, !p_render_data->reflection_probe.is_valid(), p_default_bg_color, false);
|
||||
|
||||
RD::FramebufferFormatID fb_format = RD::get_singleton()->framebuffer_get_format(framebuffer);
|
||||
RenderListParameters render_list_params(render_list[RENDER_LIST_ALPHA].elements.ptr(), render_list[RENDER_LIST_ALPHA].element_info.ptr(), render_list[RENDER_LIST_ALPHA].elements.size(), reverse_cull, PASS_MODE_COLOR, rp_uniform_set, spec_constant_base_flags, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME, Vector2(), p_render_data->lod_camera_plane, p_render_data->lod_distance_multiplier, p_render_data->screen_lod_threshold, p_render_data->view_count);
|
||||
RenderListParameters render_list_params(render_list[RENDER_LIST_ALPHA].elements.ptr(), render_list[RENDER_LIST_ALPHA].element_info.ptr(), render_list[RENDER_LIST_ALPHA].elements.size(), reverse_cull, PASS_MODE_COLOR, rp_uniform_set, spec_constant_base_flags, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME, Vector2(), p_render_data->lod_camera_plane, p_render_data->lod_distance_multiplier, p_render_data->screen_mesh_lod_threshold, p_render_data->view_count);
|
||||
render_list_params.framebuffer_format = fb_format;
|
||||
if ((uint32_t)render_list_params.element_count > render_list_thread_threshold && false) {
|
||||
// secondary command buffers need more testing at this time
|
||||
@ -877,7 +877,7 @@ void RenderForwardMobile::_render_shadow_begin() {
|
||||
render_list[RENDER_LIST_SECONDARY].clear();
|
||||
}
|
||||
|
||||
void RenderForwardMobile::_render_shadow_append(RID p_framebuffer, const PagedArray<GeometryInstance *> &p_instances, const CameraMatrix &p_projection, const Transform3D &p_transform, float p_zfar, float p_bias, float p_normal_bias, bool p_use_dp, bool p_use_dp_flip, bool p_use_pancake, const Plane &p_camera_plane, float p_lod_distance_multiplier, float p_screen_lod_threshold, const Rect2i &p_rect, bool p_flip_y, bool p_clear_region, bool p_begin, bool p_end, RendererScene::RenderInfo *p_render_info) {
|
||||
void RenderForwardMobile::_render_shadow_append(RID p_framebuffer, const PagedArray<GeometryInstance *> &p_instances, const CameraMatrix &p_projection, const Transform3D &p_transform, float p_zfar, float p_bias, float p_normal_bias, bool p_use_dp, bool p_use_dp_flip, bool p_use_pancake, const Plane &p_camera_plane, float p_lod_distance_multiplier, float p_screen_mesh_lod_threshold, const Rect2i &p_rect, bool p_flip_y, bool p_clear_region, bool p_begin, bool p_end, RendererScene::RenderInfo *p_render_info) {
|
||||
uint32_t shadow_pass_index = scene_state.shadow_passes.size();
|
||||
|
||||
SceneState::ShadowPass shadow_pass;
|
||||
@ -903,9 +903,9 @@ void RenderForwardMobile::_render_shadow_append(RID p_framebuffer, const PagedAr
|
||||
_setup_environment(&render_data, true, Vector2(1, 1), !p_flip_y, Color(), false, p_use_pancake, shadow_pass_index);
|
||||
|
||||
if (get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_DISABLE_LOD) {
|
||||
render_data.screen_lod_threshold = 0.0;
|
||||
render_data.screen_mesh_lod_threshold = 0.0;
|
||||
} else {
|
||||
render_data.screen_lod_threshold = p_screen_lod_threshold;
|
||||
render_data.screen_mesh_lod_threshold = p_screen_mesh_lod_threshold;
|
||||
}
|
||||
|
||||
PassMode pass_mode = p_use_dp ? PASS_MODE_SHADOW_DP : PASS_MODE_SHADOW;
|
||||
@ -930,7 +930,7 @@ void RenderForwardMobile::_render_shadow_append(RID p_framebuffer, const PagedAr
|
||||
|
||||
shadow_pass.rp_uniform_set = RID(); //will be filled later when instance buffer is complete
|
||||
shadow_pass.camera_plane = p_camera_plane;
|
||||
shadow_pass.screen_lod_threshold = render_data.screen_lod_threshold;
|
||||
shadow_pass.screen_mesh_lod_threshold = render_data.screen_mesh_lod_threshold;
|
||||
shadow_pass.lod_distance_multiplier = render_data.lod_distance_multiplier;
|
||||
|
||||
shadow_pass.framebuffer = p_framebuffer;
|
||||
@ -959,7 +959,7 @@ void RenderForwardMobile::_render_shadow_end(uint32_t p_barrier) {
|
||||
|
||||
for (uint32_t i = 0; i < scene_state.shadow_passes.size(); i++) {
|
||||
SceneState::ShadowPass &shadow_pass = scene_state.shadow_passes[i];
|
||||
RenderListParameters render_list_parameters(render_list[RENDER_LIST_SECONDARY].elements.ptr() + shadow_pass.element_from, render_list[RENDER_LIST_SECONDARY].element_info.ptr() + shadow_pass.element_from, shadow_pass.element_count, shadow_pass.flip_cull, shadow_pass.pass_mode, shadow_pass.rp_uniform_set, 0, false, Vector2(), shadow_pass.camera_plane, shadow_pass.lod_distance_multiplier, shadow_pass.screen_lod_threshold, 1, shadow_pass.element_from, RD::BARRIER_MASK_NO_BARRIER);
|
||||
RenderListParameters render_list_parameters(render_list[RENDER_LIST_SECONDARY].elements.ptr() + shadow_pass.element_from, render_list[RENDER_LIST_SECONDARY].element_info.ptr() + shadow_pass.element_from, shadow_pass.element_count, shadow_pass.flip_cull, shadow_pass.pass_mode, shadow_pass.rp_uniform_set, 0, false, Vector2(), shadow_pass.camera_plane, shadow_pass.lod_distance_multiplier, shadow_pass.screen_mesh_lod_threshold, 1, shadow_pass.element_from, RD::BARRIER_MASK_NO_BARRIER);
|
||||
_render_list_with_threads(&render_list_parameters, shadow_pass.framebuffer, RD::INITIAL_ACTION_DROP, RD::FINAL_ACTION_DISCARD, shadow_pass.initial_depth_action, shadow_pass.final_depth_action, Vector<Color>(), 1.0, 0, shadow_pass.rect);
|
||||
}
|
||||
|
||||
@ -1407,7 +1407,7 @@ void RenderForwardMobile::_fill_render_list(RenderListType p_render_list, const
|
||||
|
||||
// LOD
|
||||
|
||||
if (p_render_data->screen_lod_threshold > 0.0 && storage->mesh_surface_has_lod(surf->surface)) {
|
||||
if (p_render_data->screen_mesh_lod_threshold > 0.0 && storage->mesh_surface_has_lod(surf->surface)) {
|
||||
//lod
|
||||
Vector3 lod_support_min = inst->transformed_aabb.get_support(-p_render_data->lod_camera_plane.normal);
|
||||
Vector3 lod_support_max = inst->transformed_aabb.get_support(p_render_data->lod_camera_plane.normal);
|
||||
@ -1427,7 +1427,7 @@ void RenderForwardMobile::_fill_render_list(RenderListType p_render_list, const
|
||||
}
|
||||
|
||||
uint32_t indices;
|
||||
surf->lod_index = storage->mesh_surface_get_lod(surf->surface, inst->lod_model_scale * inst->lod_bias, distance * p_render_data->lod_distance_multiplier, p_render_data->screen_lod_threshold, &indices);
|
||||
surf->lod_index = storage->mesh_surface_get_lod(surf->surface, inst->lod_model_scale * inst->lod_bias, distance * p_render_data->lod_distance_multiplier, p_render_data->screen_mesh_lod_threshold, &indices);
|
||||
if (p_render_data->render_info) {
|
||||
indices = _indices_to_primitives(surf->primitive, indices);
|
||||
if (p_render_list == RENDER_LIST_OPAQUE) { //opaque
|
||||
|
@ -176,13 +176,13 @@ protected:
|
||||
Plane lod_plane;
|
||||
uint32_t spec_constant_base_flags = 0;
|
||||
float lod_distance_multiplier = 0.0;
|
||||
float screen_lod_threshold = 0.0;
|
||||
float screen_mesh_lod_threshold = 0.0;
|
||||
RD::FramebufferFormatID framebuffer_format = 0;
|
||||
uint32_t element_offset = 0;
|
||||
uint32_t barrier = RD::BARRIER_MASK_ALL;
|
||||
uint32_t subpass = 0;
|
||||
|
||||
RenderListParameters(GeometryInstanceSurfaceDataCache **p_elements, RenderElementInfo *p_element_info, int p_element_count, bool p_reverse_cull, PassMode p_pass_mode, RID p_render_pass_uniform_set, uint32_t p_spec_constant_base_flags = 0, bool p_force_wireframe = false, const Vector2 &p_uv_offset = Vector2(), const Plane &p_lod_plane = Plane(), float p_lod_distance_multiplier = 0.0, float p_screen_lod_threshold = 0.0, uint32_t p_view_count = 1, uint32_t p_element_offset = 0, uint32_t p_barrier = RD::BARRIER_MASK_ALL) {
|
||||
RenderListParameters(GeometryInstanceSurfaceDataCache **p_elements, RenderElementInfo *p_element_info, int p_element_count, bool p_reverse_cull, PassMode p_pass_mode, RID p_render_pass_uniform_set, uint32_t p_spec_constant_base_flags = 0, bool p_force_wireframe = false, const Vector2 &p_uv_offset = Vector2(), const Plane &p_lod_plane = Plane(), float p_lod_distance_multiplier = 0.0, float p_screen_mesh_lod_threshold = 0.0, uint32_t p_view_count = 1, uint32_t p_element_offset = 0, uint32_t p_barrier = RD::BARRIER_MASK_ALL) {
|
||||
elements = p_elements;
|
||||
element_info = p_element_info;
|
||||
element_count = p_element_count;
|
||||
@ -195,7 +195,7 @@ protected:
|
||||
uv_offset = p_uv_offset;
|
||||
lod_plane = p_lod_plane;
|
||||
lod_distance_multiplier = p_lod_distance_multiplier;
|
||||
screen_lod_threshold = p_screen_lod_threshold;
|
||||
screen_mesh_lod_threshold = p_screen_mesh_lod_threshold;
|
||||
element_offset = p_element_offset;
|
||||
barrier = p_barrier;
|
||||
spec_constant_base_flags = p_spec_constant_base_flags;
|
||||
@ -210,7 +210,7 @@ protected:
|
||||
virtual void _render_scene(RenderDataRD *p_render_data, const Color &p_default_bg_color) override;
|
||||
|
||||
virtual void _render_shadow_begin() override;
|
||||
virtual void _render_shadow_append(RID p_framebuffer, const PagedArray<GeometryInstance *> &p_instances, const CameraMatrix &p_projection, const Transform3D &p_transform, float p_zfar, float p_bias, float p_normal_bias, bool p_use_dp, bool p_use_dp_flip, bool p_use_pancake, const Plane &p_camera_plane = Plane(), float p_lod_distance_multiplier = 0.0, float p_screen_lod_threshold = 0.0, const Rect2i &p_rect = Rect2i(), bool p_flip_y = false, bool p_clear_region = true, bool p_begin = true, bool p_end = true, RendererScene::RenderInfo *p_render_info = nullptr) override;
|
||||
virtual void _render_shadow_append(RID p_framebuffer, const PagedArray<GeometryInstance *> &p_instances, const CameraMatrix &p_projection, const Transform3D &p_transform, float p_zfar, float p_bias, float p_normal_bias, bool p_use_dp, bool p_use_dp_flip, bool p_use_pancake, const Plane &p_camera_plane = Plane(), float p_lod_distance_multiplier = 0.0, float p_screen_mesh_lod_threshold = 0.0, const Rect2i &p_rect = Rect2i(), bool p_flip_y = false, bool p_clear_region = true, bool p_begin = true, bool p_end = true, RendererScene::RenderInfo *p_render_info = nullptr) override;
|
||||
virtual void _render_shadow_process() override;
|
||||
virtual void _render_shadow_end(uint32_t p_barrier = RD::BARRIER_MASK_ALL) override;
|
||||
|
||||
@ -346,7 +346,7 @@ protected:
|
||||
RID rp_uniform_set;
|
||||
Plane camera_plane;
|
||||
float lod_distance_multiplier;
|
||||
float screen_lod_threshold;
|
||||
float screen_mesh_lod_threshold;
|
||||
|
||||
RID framebuffer;
|
||||
RD::InitialAction initial_depth_action;
|
||||
|
@ -4783,7 +4783,7 @@ void RendererSceneRenderRD::_pre_opaque_render(RenderDataRD *p_render_data, bool
|
||||
|
||||
//cube shadows are rendered in their own way
|
||||
for (uint32_t i = 0; i < render_state.cube_shadows.size(); i++) {
|
||||
_render_shadow_pass(render_state.render_shadows[render_state.cube_shadows[i]].light, p_render_data->shadow_atlas, render_state.render_shadows[render_state.cube_shadows[i]].pass, render_state.render_shadows[render_state.cube_shadows[i]].instances, camera_plane, lod_distance_multiplier, p_render_data->screen_lod_threshold, true, true, true, p_render_data->render_info);
|
||||
_render_shadow_pass(render_state.render_shadows[render_state.cube_shadows[i]].light, p_render_data->shadow_atlas, render_state.render_shadows[render_state.cube_shadows[i]].pass, render_state.render_shadows[render_state.cube_shadows[i]].instances, camera_plane, lod_distance_multiplier, p_render_data->screen_mesh_lod_threshold, true, true, true, p_render_data->render_info);
|
||||
}
|
||||
|
||||
if (render_state.directional_shadows.size()) {
|
||||
@ -4813,11 +4813,11 @@ void RendererSceneRenderRD::_pre_opaque_render(RenderDataRD *p_render_data, bool
|
||||
|
||||
//render directional shadows
|
||||
for (uint32_t i = 0; i < render_state.directional_shadows.size(); i++) {
|
||||
_render_shadow_pass(render_state.render_shadows[render_state.directional_shadows[i]].light, p_render_data->shadow_atlas, render_state.render_shadows[render_state.directional_shadows[i]].pass, render_state.render_shadows[render_state.directional_shadows[i]].instances, camera_plane, lod_distance_multiplier, p_render_data->screen_lod_threshold, false, i == render_state.directional_shadows.size() - 1, false, p_render_data->render_info);
|
||||
_render_shadow_pass(render_state.render_shadows[render_state.directional_shadows[i]].light, p_render_data->shadow_atlas, render_state.render_shadows[render_state.directional_shadows[i]].pass, render_state.render_shadows[render_state.directional_shadows[i]].instances, camera_plane, lod_distance_multiplier, p_render_data->screen_mesh_lod_threshold, false, i == render_state.directional_shadows.size() - 1, false, p_render_data->render_info);
|
||||
}
|
||||
//render positional shadows
|
||||
for (uint32_t i = 0; i < render_state.shadows.size(); i++) {
|
||||
_render_shadow_pass(render_state.render_shadows[render_state.shadows[i]].light, p_render_data->shadow_atlas, render_state.render_shadows[render_state.shadows[i]].pass, render_state.render_shadows[render_state.shadows[i]].instances, camera_plane, lod_distance_multiplier, p_render_data->screen_lod_threshold, i == 0, i == render_state.shadows.size() - 1, true, p_render_data->render_info);
|
||||
_render_shadow_pass(render_state.render_shadows[render_state.shadows[i]].light, p_render_data->shadow_atlas, render_state.render_shadows[render_state.shadows[i]].pass, render_state.render_shadows[render_state.shadows[i]].instances, camera_plane, lod_distance_multiplier, p_render_data->screen_mesh_lod_threshold, i == 0, i == render_state.shadows.size() - 1, true, p_render_data->render_info);
|
||||
}
|
||||
|
||||
_render_shadow_process();
|
||||
@ -4917,7 +4917,7 @@ void RendererSceneRenderRD::_pre_opaque_render(RenderDataRD *p_render_data, bool
|
||||
}
|
||||
}
|
||||
|
||||
void RendererSceneRenderRD::render_scene(RID p_render_buffers, const CameraData *p_camera_data, const PagedArray<GeometryInstance *> &p_instances, const PagedArray<RID> &p_lights, const PagedArray<RID> &p_reflection_probes, const PagedArray<RID> &p_voxel_gi_instances, const PagedArray<RID> &p_decals, const PagedArray<RID> &p_lightmaps, const PagedArray<RID> &p_fog_volumes, RID p_environment, RID p_camera_effects, RID p_shadow_atlas, RID p_occluder_debug_tex, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_lod_threshold, const RenderShadowData *p_render_shadows, int p_render_shadow_count, const RenderSDFGIData *p_render_sdfgi_regions, int p_render_sdfgi_region_count, const RenderSDFGIUpdateData *p_sdfgi_update_data, RendererScene::RenderInfo *r_render_info) {
|
||||
void RendererSceneRenderRD::render_scene(RID p_render_buffers, const CameraData *p_camera_data, const PagedArray<GeometryInstance *> &p_instances, const PagedArray<RID> &p_lights, const PagedArray<RID> &p_reflection_probes, const PagedArray<RID> &p_voxel_gi_instances, const PagedArray<RID> &p_decals, const PagedArray<RID> &p_lightmaps, const PagedArray<RID> &p_fog_volumes, RID p_environment, RID p_camera_effects, RID p_shadow_atlas, RID p_occluder_debug_tex, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_mesh_lod_threshold, const RenderShadowData *p_render_shadows, int p_render_shadow_count, const RenderSDFGIData *p_render_sdfgi_regions, int p_render_sdfgi_region_count, const RenderSDFGIUpdateData *p_sdfgi_update_data, RendererScene::RenderInfo *r_render_info) {
|
||||
// getting this here now so we can direct call a bunch of things more easily
|
||||
RenderBuffers *rb = nullptr;
|
||||
if (p_render_buffers.is_valid()) {
|
||||
@ -4963,9 +4963,9 @@ void RendererSceneRenderRD::render_scene(RID p_render_buffers, const CameraData
|
||||
render_data.lod_camera_plane = Plane(-p_camera_data->main_transform.basis.get_axis(Vector3::AXIS_Z), p_camera_data->main_transform.get_origin());
|
||||
|
||||
if (get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_DISABLE_LOD) {
|
||||
render_data.screen_lod_threshold = 0.0;
|
||||
render_data.screen_mesh_lod_threshold = 0.0;
|
||||
} else {
|
||||
render_data.screen_lod_threshold = p_screen_lod_threshold;
|
||||
render_data.screen_mesh_lod_threshold = p_screen_mesh_lod_threshold;
|
||||
}
|
||||
|
||||
render_state.render_shadows = p_render_shadows;
|
||||
@ -5091,7 +5091,7 @@ void RendererSceneRenderRD::_debug_draw_cluster(RID p_render_buffers) {
|
||||
}
|
||||
}
|
||||
|
||||
void RendererSceneRenderRD::_render_shadow_pass(RID p_light, RID p_shadow_atlas, int p_pass, const PagedArray<GeometryInstance *> &p_instances, const Plane &p_camera_plane, float p_lod_distance_multiplier, float p_screen_lod_threshold, bool p_open_pass, bool p_close_pass, bool p_clear_region, RendererScene::RenderInfo *p_render_info) {
|
||||
void RendererSceneRenderRD::_render_shadow_pass(RID p_light, RID p_shadow_atlas, int p_pass, const PagedArray<GeometryInstance *> &p_instances, const Plane &p_camera_plane, float p_lod_distance_multiplier, float p_screen_mesh_lod_threshold, bool p_open_pass, bool p_close_pass, bool p_clear_region, RendererScene::RenderInfo *p_render_info) {
|
||||
LightInstance *light_instance = light_instance_owner.get_or_null(p_light);
|
||||
ERR_FAIL_COND(!light_instance);
|
||||
|
||||
@ -5241,7 +5241,7 @@ void RendererSceneRenderRD::_render_shadow_pass(RID p_light, RID p_shadow_atlas,
|
||||
|
||||
if (render_cubemap) {
|
||||
//rendering to cubemap
|
||||
_render_shadow_append(render_fb, p_instances, light_projection, light_transform, zfar, 0, 0, false, false, use_pancake, p_camera_plane, p_lod_distance_multiplier, p_screen_lod_threshold, Rect2(), false, true, true, true, p_render_info);
|
||||
_render_shadow_append(render_fb, p_instances, light_projection, light_transform, zfar, 0, 0, false, false, use_pancake, p_camera_plane, p_lod_distance_multiplier, p_screen_mesh_lod_threshold, Rect2(), false, true, true, true, p_render_info);
|
||||
if (finalize_cubemap) {
|
||||
_render_shadow_process();
|
||||
_render_shadow_end();
|
||||
@ -5259,7 +5259,7 @@ void RendererSceneRenderRD::_render_shadow_pass(RID p_light, RID p_shadow_atlas,
|
||||
|
||||
} else {
|
||||
//render shadow
|
||||
_render_shadow_append(render_fb, p_instances, light_projection, light_transform, zfar, 0, 0, using_dual_paraboloid, using_dual_paraboloid_flip, use_pancake, p_camera_plane, p_lod_distance_multiplier, p_screen_lod_threshold, atlas_rect, flip_y, p_clear_region, p_open_pass, p_close_pass, p_render_info);
|
||||
_render_shadow_append(render_fb, p_instances, light_projection, light_transform, zfar, 0, 0, using_dual_paraboloid, using_dual_paraboloid_flip, use_pancake, p_camera_plane, p_lod_distance_multiplier, p_screen_mesh_lod_threshold, atlas_rect, flip_y, p_clear_region, p_open_pass, p_close_pass, p_render_info);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ struct RenderDataRD {
|
||||
|
||||
float lod_distance_multiplier = 0.0;
|
||||
Plane lod_camera_plane = Plane();
|
||||
float screen_lod_threshold = 0.0;
|
||||
float screen_mesh_lod_threshold = 0.0;
|
||||
|
||||
RID cluster_buffer = RID();
|
||||
uint32_t cluster_size = 0;
|
||||
@ -109,7 +109,7 @@ protected:
|
||||
virtual void _render_scene(RenderDataRD *p_render_data, const Color &p_default_color) = 0;
|
||||
|
||||
virtual void _render_shadow_begin() = 0;
|
||||
virtual void _render_shadow_append(RID p_framebuffer, const PagedArray<GeometryInstance *> &p_instances, const CameraMatrix &p_projection, const Transform3D &p_transform, float p_zfar, float p_bias, float p_normal_bias, bool p_use_dp, bool p_use_dp_flip, bool p_use_pancake, const Plane &p_camera_plane = Plane(), float p_lod_distance_multiplier = 0.0, float p_screen_lod_threshold = 0.0, const Rect2i &p_rect = Rect2i(), bool p_flip_y = false, bool p_clear_region = true, bool p_begin = true, bool p_end = true, RendererScene::RenderInfo *p_render_info = nullptr) = 0;
|
||||
virtual void _render_shadow_append(RID p_framebuffer, const PagedArray<GeometryInstance *> &p_instances, const CameraMatrix &p_projection, const Transform3D &p_transform, float p_zfar, float p_bias, float p_normal_bias, bool p_use_dp, bool p_use_dp_flip, bool p_use_pancake, const Plane &p_camera_plane = Plane(), float p_lod_distance_multiplier = 0.0, float p_screen_mesh_lod_threshold = 0.0, const Rect2i &p_rect = Rect2i(), bool p_flip_y = false, bool p_clear_region = true, bool p_begin = true, bool p_end = true, RendererScene::RenderInfo *p_render_info = nullptr) = 0;
|
||||
virtual void _render_shadow_process() = 0;
|
||||
virtual void _render_shadow_end(uint32_t p_barrier = RD::BARRIER_MASK_ALL) = 0;
|
||||
|
||||
@ -973,7 +973,7 @@ private:
|
||||
|
||||
uint32_t max_cluster_elements = 512;
|
||||
|
||||
void _render_shadow_pass(RID p_light, RID p_shadow_atlas, int p_pass, const PagedArray<GeometryInstance *> &p_instances, const Plane &p_camera_plane = Plane(), float p_lod_distance_multiplier = 0, float p_screen_lod_threshold = 0.0, bool p_open_pass = true, bool p_close_pass = true, bool p_clear_region = true, RendererScene::RenderInfo *p_render_info = nullptr);
|
||||
void _render_shadow_pass(RID p_light, RID p_shadow_atlas, int p_pass, const PagedArray<GeometryInstance *> &p_instances, const Plane &p_camera_plane = Plane(), float p_lod_distance_multiplier = 0, float p_screen_mesh_lod_threshold = 0.0, bool p_open_pass = true, bool p_close_pass = true, bool p_clear_region = true, RendererScene::RenderInfo *p_render_info = nullptr);
|
||||
|
||||
public:
|
||||
virtual Transform3D geometry_instance_get_transform(GeometryInstance *p_instance) = 0;
|
||||
@ -1414,7 +1414,7 @@ public:
|
||||
|
||||
virtual void update_uniform_sets(){};
|
||||
|
||||
virtual void render_scene(RID p_render_buffers, const CameraData *p_camera_data, const PagedArray<GeometryInstance *> &p_instances, const PagedArray<RID> &p_lights, const PagedArray<RID> &p_reflection_probes, const PagedArray<RID> &p_voxel_gi_instances, const PagedArray<RID> &p_decals, const PagedArray<RID> &p_lightmaps, const PagedArray<RID> &p_fog_volumes, RID p_environment, RID p_camera_effects, RID p_shadow_atlas, RID p_occluder_debug_tex, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_lod_threshold, const RenderShadowData *p_render_shadows, int p_render_shadow_count, const RenderSDFGIData *p_render_sdfgi_regions, int p_render_sdfgi_region_count, const RenderSDFGIUpdateData *p_sdfgi_update_data = nullptr, RendererScene::RenderInfo *r_render_info = nullptr) override;
|
||||
virtual void render_scene(RID p_render_buffers, const CameraData *p_camera_data, const PagedArray<GeometryInstance *> &p_instances, const PagedArray<RID> &p_lights, const PagedArray<RID> &p_reflection_probes, const PagedArray<RID> &p_voxel_gi_instances, const PagedArray<RID> &p_decals, const PagedArray<RID> &p_lightmaps, const PagedArray<RID> &p_fog_volumes, RID p_environment, RID p_camera_effects, RID p_shadow_atlas, RID p_occluder_debug_tex, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_mesh_lod_threshold, const RenderShadowData *p_render_shadows, int p_render_shadow_count, const RenderSDFGIData *p_render_sdfgi_regions, int p_render_sdfgi_region_count, const RenderSDFGIUpdateData *p_sdfgi_update_data = nullptr, RendererScene::RenderInfo *r_render_info = nullptr) override;
|
||||
|
||||
virtual void render_material(const Transform3D &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, const PagedArray<GeometryInstance *> &p_instances, RID p_framebuffer, const Rect2i &p_region) override;
|
||||
|
||||
|
@ -6880,11 +6880,11 @@ void RendererStorageRD::reflection_probe_set_resolution(RID p_probe, int p_resol
|
||||
reflection_probe->resolution = p_resolution;
|
||||
}
|
||||
|
||||
void RendererStorageRD::reflection_probe_set_lod_threshold(RID p_probe, float p_ratio) {
|
||||
void RendererStorageRD::reflection_probe_set_mesh_lod_threshold(RID p_probe, float p_ratio) {
|
||||
ReflectionProbe *reflection_probe = reflection_probe_owner.get_or_null(p_probe);
|
||||
ERR_FAIL_COND(!reflection_probe);
|
||||
|
||||
reflection_probe->lod_threshold = p_ratio;
|
||||
reflection_probe->mesh_lod_threshold = p_ratio;
|
||||
|
||||
reflection_probe->dependency.changed_notify(DEPENDENCY_CHANGED_REFLECTION_PROBE);
|
||||
}
|
||||
@ -6942,11 +6942,11 @@ float RendererStorageRD::reflection_probe_get_origin_max_distance(RID p_probe) c
|
||||
return reflection_probe->max_distance;
|
||||
}
|
||||
|
||||
float RendererStorageRD::reflection_probe_get_lod_threshold(RID p_probe) const {
|
||||
float RendererStorageRD::reflection_probe_get_mesh_lod_threshold(RID p_probe) const {
|
||||
const ReflectionProbe *reflection_probe = reflection_probe_owner.get_or_null(p_probe);
|
||||
ERR_FAIL_COND_V(!reflection_probe, 0);
|
||||
|
||||
return reflection_probe->lod_threshold;
|
||||
return reflection_probe->mesh_lod_threshold;
|
||||
}
|
||||
|
||||
int RendererStorageRD::reflection_probe_get_resolution(RID p_probe) const {
|
||||
|
@ -1053,7 +1053,7 @@ private:
|
||||
bool box_projection = false;
|
||||
bool enable_shadows = false;
|
||||
uint32_t cull_mask = (1 << 20) - 1;
|
||||
float lod_threshold = 0.01;
|
||||
float mesh_lod_threshold = 0.01;
|
||||
|
||||
Dependency dependency;
|
||||
};
|
||||
@ -1557,7 +1557,7 @@ public:
|
||||
return s->index_count ? s->index_count : s->vertex_count;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ uint32_t mesh_surface_get_lod(void *p_surface, float p_model_scale, float p_distance_threshold, float p_lod_threshold, uint32_t *r_index_count = nullptr) const {
|
||||
_FORCE_INLINE_ uint32_t mesh_surface_get_lod(void *p_surface, float p_model_scale, float p_distance_threshold, float p_mesh_lod_threshold, uint32_t *r_index_count = nullptr) const {
|
||||
Mesh::Surface *s = reinterpret_cast<Mesh::Surface *>(p_surface);
|
||||
|
||||
int32_t current_lod = -1;
|
||||
@ -1566,7 +1566,7 @@ public:
|
||||
}
|
||||
for (uint32_t i = 0; i < s->lod_count; i++) {
|
||||
float screen_size = s->lods[i].edge_length * p_model_scale / p_distance_threshold;
|
||||
if (screen_size > p_lod_threshold) {
|
||||
if (screen_size > p_mesh_lod_threshold) {
|
||||
break;
|
||||
}
|
||||
current_lod = i;
|
||||
@ -1955,7 +1955,7 @@ public:
|
||||
void reflection_probe_set_enable_shadows(RID p_probe, bool p_enable);
|
||||
void reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers);
|
||||
void reflection_probe_set_resolution(RID p_probe, int p_resolution);
|
||||
void reflection_probe_set_lod_threshold(RID p_probe, float p_ratio);
|
||||
void reflection_probe_set_mesh_lod_threshold(RID p_probe, float p_ratio);
|
||||
|
||||
AABB reflection_probe_get_aabb(RID p_probe) const;
|
||||
RS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const;
|
||||
@ -1963,7 +1963,7 @@ public:
|
||||
Vector3 reflection_probe_get_extents(RID p_probe) const;
|
||||
Vector3 reflection_probe_get_origin_offset(RID p_probe) const;
|
||||
float reflection_probe_get_origin_max_distance(RID p_probe) const;
|
||||
float reflection_probe_get_lod_threshold(RID p_probe) const;
|
||||
float reflection_probe_get_mesh_lod_threshold(RID p_probe) const;
|
||||
|
||||
int reflection_probe_get_resolution(RID p_probe) const;
|
||||
bool reflection_probe_renders_shadows(RID p_probe) const;
|
||||
|
@ -210,7 +210,7 @@ public:
|
||||
int info[RS::VIEWPORT_RENDER_INFO_TYPE_MAX][RS::VIEWPORT_RENDER_INFO_MAX] = {};
|
||||
};
|
||||
|
||||
virtual void render_camera(RID p_render_buffers, RID p_camera, RID p_scenario, RID p_viewport, Size2 p_viewport_size, float p_lod_threshold, RID p_shadow_atlas, Ref<XRInterface> &p_xr_interface, RenderInfo *r_render_info = nullptr) = 0;
|
||||
virtual void render_camera(RID p_render_buffers, RID p_camera, RID p_scenario, RID p_viewport, Size2 p_viewport_size, float p_mesh_lod_threshold, RID p_shadow_atlas, Ref<XRInterface> &p_xr_interface, RenderInfo *r_render_info = nullptr) = 0;
|
||||
|
||||
virtual void update() = 0;
|
||||
virtual void render_probes() = 0;
|
||||
|
@ -2193,7 +2193,7 @@ void RendererSceneCull::_light_instance_setup_directional_shadow(int p_shadow_in
|
||||
}
|
||||
}
|
||||
|
||||
bool RendererSceneCull::_light_instance_update_shadow(Instance *p_instance, const Transform3D p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, bool p_cam_vaspect, RID p_shadow_atlas, Scenario *p_scenario, float p_screen_lod_threshold) {
|
||||
bool RendererSceneCull::_light_instance_update_shadow(Instance *p_instance, const Transform3D p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, bool p_cam_vaspect, RID p_shadow_atlas, Scenario *p_scenario, float p_screen_mesh_lod_threshold) {
|
||||
InstanceLightData *light = static_cast<InstanceLightData *>(p_instance->base_data);
|
||||
|
||||
Transform3D light_transform = p_instance->transform;
|
||||
@ -2416,7 +2416,7 @@ bool RendererSceneCull::_light_instance_update_shadow(Instance *p_instance, cons
|
||||
return animated_material_found;
|
||||
}
|
||||
|
||||
void RendererSceneCull::render_camera(RID p_render_buffers, RID p_camera, RID p_scenario, RID p_viewport, Size2 p_viewport_size, float p_screen_lod_threshold, RID p_shadow_atlas, Ref<XRInterface> &p_xr_interface, RenderInfo *r_render_info) {
|
||||
void RendererSceneCull::render_camera(RID p_render_buffers, RID p_camera, RID p_scenario, RID p_viewport, Size2 p_viewport_size, float p_screen_mesh_lod_threshold, RID p_shadow_atlas, Ref<XRInterface> &p_xr_interface, RenderInfo *r_render_info) {
|
||||
#ifndef _3D_DISABLED
|
||||
|
||||
Camera *camera = camera_owner.get_or_null(p_camera);
|
||||
@ -2498,7 +2498,7 @@ void RendererSceneCull::render_camera(RID p_render_buffers, RID p_camera, RID p_
|
||||
// For now just cull on the first camera
|
||||
RendererSceneOcclusionCull::get_singleton()->buffer_update(p_viewport, camera_data.main_transform, camera_data.main_projection, camera_data.is_ortogonal, RendererThreadPool::singleton->thread_work_pool);
|
||||
|
||||
_render_scene(&camera_data, p_render_buffers, environment, camera->effects, camera->visible_layers, p_scenario, p_viewport, p_shadow_atlas, RID(), -1, p_screen_lod_threshold, true, r_render_info);
|
||||
_render_scene(&camera_data, p_render_buffers, environment, camera->effects, camera->visible_layers, p_scenario, p_viewport, p_shadow_atlas, RID(), -1, p_screen_mesh_lod_threshold, true, r_render_info);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -2862,7 +2862,7 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul
|
||||
}
|
||||
}
|
||||
|
||||
void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_camera_data, RID p_render_buffers, RID p_environment, RID p_force_camera_effects, uint32_t p_visible_layers, RID p_scenario, RID p_viewport, RID p_shadow_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_lod_threshold, bool p_using_shadows, RendererScene::RenderInfo *r_render_info) {
|
||||
void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_camera_data, RID p_render_buffers, RID p_environment, RID p_force_camera_effects, uint32_t p_visible_layers, RID p_scenario, RID p_viewport, RID p_shadow_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_mesh_lod_threshold, bool p_using_shadows, RendererScene::RenderInfo *r_render_info) {
|
||||
Instance *render_reflection_probe = instance_owner.get_or_null(p_reflection_probe); //if null, not rendering to it
|
||||
|
||||
Scenario *scenario = scenario_owner.get_or_null(p_scenario);
|
||||
@ -3142,7 +3142,7 @@ void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_c
|
||||
if (redraw && max_shadows_used < MAX_UPDATE_SHADOWS) {
|
||||
//must redraw!
|
||||
RENDER_TIMESTAMP(">Rendering Light " + itos(i));
|
||||
light->shadow_dirty = _light_instance_update_shadow(ins, p_camera_data->main_transform, p_camera_data->main_projection, p_camera_data->is_ortogonal, p_camera_data->vaspect, p_shadow_atlas, scenario, p_screen_lod_threshold);
|
||||
light->shadow_dirty = _light_instance_update_shadow(ins, p_camera_data->main_transform, p_camera_data->main_projection, p_camera_data->is_ortogonal, p_camera_data->vaspect, p_shadow_atlas, scenario, p_screen_mesh_lod_threshold);
|
||||
RENDER_TIMESTAMP("<Rendering Light " + itos(i));
|
||||
} else {
|
||||
light->shadow_dirty = redraw;
|
||||
@ -3204,7 +3204,7 @@ void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_c
|
||||
}
|
||||
|
||||
RENDER_TIMESTAMP("Render Scene ");
|
||||
scene_render->render_scene(p_render_buffers, p_camera_data, scene_cull_result.geometry_instances, scene_cull_result.light_instances, scene_cull_result.reflections, scene_cull_result.voxel_gi_instances, scene_cull_result.decals, scene_cull_result.lightmaps, scene_cull_result.fog_volumes, p_environment, camera_effects, p_shadow_atlas, occluders_tex, p_reflection_probe.is_valid() ? RID() : scenario->reflection_atlas, p_reflection_probe, p_reflection_probe_pass, p_screen_lod_threshold, render_shadow_data, max_shadows_used, render_sdfgi_data, cull.sdfgi.region_count, &sdfgi_update_data, r_render_info);
|
||||
scene_render->render_scene(p_render_buffers, p_camera_data, scene_cull_result.geometry_instances, scene_cull_result.light_instances, scene_cull_result.reflections, scene_cull_result.voxel_gi_instances, scene_cull_result.decals, scene_cull_result.lightmaps, scene_cull_result.fog_volumes, p_environment, camera_effects, p_shadow_atlas, occluders_tex, p_reflection_probe.is_valid() ? RID() : scenario->reflection_atlas, p_reflection_probe, p_reflection_probe_pass, p_screen_mesh_lod_threshold, render_shadow_data, max_shadows_used, render_sdfgi_data, cull.sdfgi.region_count, &sdfgi_update_data, r_render_info);
|
||||
|
||||
for (uint32_t i = 0; i < max_shadows_used; i++) {
|
||||
render_shadow_data[i].instances.clear();
|
||||
@ -3215,7 +3215,7 @@ void RendererSceneCull::_render_scene(const RendererSceneRender::CameraData *p_c
|
||||
render_sdfgi_data[i].instances.clear();
|
||||
}
|
||||
|
||||
// virtual void render_scene(RID p_render_buffers, const Transform3D &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, const PagedArray<GeometryInstance *> &p_instances, const PagedArray<RID> &p_lights, const PagedArray<RID> &p_reflection_probes, const PagedArray<RID> &p_voxel_gi_instances, const PagedArray<RID> &p_decals, const PagedArray<RID> &p_lightmaps, RID p_environment, RID p_camera_effects, RID p_shadow_atlas, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_lod_threshold,const RenderShadowData *p_render_shadows,int p_render_shadow_count,const RenderSDFGIData *p_render_sdfgi_regions,int p_render_sdfgi_region_count,const RenderSDFGIStaticLightData *p_render_sdfgi_static_lights=nullptr) = 0;
|
||||
// virtual void render_scene(RID p_render_buffers, const Transform3D &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, const PagedArray<GeometryInstance *> &p_instances, const PagedArray<RID> &p_lights, const PagedArray<RID> &p_reflection_probes, const PagedArray<RID> &p_voxel_gi_instances, const PagedArray<RID> &p_decals, const PagedArray<RID> &p_lightmaps, RID p_environment, RID p_camera_effects, RID p_shadow_atlas, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_mesh_lod_threshold,const RenderShadowData *p_render_shadows,int p_render_shadow_count,const RenderSDFGIData *p_render_sdfgi_regions,int p_render_sdfgi_region_count,const RenderSDFGIStaticLightData *p_render_sdfgi_static_lights=nullptr) = 0;
|
||||
}
|
||||
|
||||
RID RendererSceneCull::_render_get_environment(RID p_camera, RID p_scenario) {
|
||||
@ -3293,7 +3293,7 @@ bool RendererSceneCull::_render_reflection_probe_step(Instance *p_instance, int
|
||||
Vector3 origin_offset = RSG::storage->reflection_probe_get_origin_offset(p_instance->base);
|
||||
float max_distance = RSG::storage->reflection_probe_get_origin_max_distance(p_instance->base);
|
||||
float size = scene_render->reflection_atlas_get_size(scenario->reflection_atlas);
|
||||
float lod_threshold = RSG::storage->reflection_probe_get_lod_threshold(p_instance->base) / size;
|
||||
float mesh_lod_threshold = RSG::storage->reflection_probe_get_mesh_lod_threshold(p_instance->base) / size;
|
||||
|
||||
Vector3 edge = view_normals[p_step] * extents;
|
||||
float distance = ABS(view_normals[p_step].dot(edge) - view_normals[p_step].dot(origin_offset)); //distance from origin offset to actual view distance limit
|
||||
@ -3327,7 +3327,7 @@ bool RendererSceneCull::_render_reflection_probe_step(Instance *p_instance, int
|
||||
RendererSceneRender::CameraData camera_data;
|
||||
camera_data.set_camera(xform, cm, false, false);
|
||||
|
||||
_render_scene(&camera_data, RID(), environment, RID(), RSG::storage->reflection_probe_get_cull_mask(p_instance->base), p_instance->scenario->self, RID(), shadow_atlas, reflection_probe->instance, p_step, lod_threshold, use_shadows);
|
||||
_render_scene(&camera_data, RID(), environment, RID(), RSG::storage->reflection_probe_get_cull_mask(p_instance->base), p_instance->scenario->self, RID(), shadow_atlas, reflection_probe->instance, p_step, mesh_lod_threshold, use_shadows);
|
||||
|
||||
} else {
|
||||
//do roughness postprocess step until it believes it's done
|
||||
|
@ -982,7 +982,7 @@ public:
|
||||
|
||||
void _light_instance_setup_directional_shadow(int p_shadow_index, Instance *p_instance, const Transform3D p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, bool p_cam_vaspect);
|
||||
|
||||
_FORCE_INLINE_ bool _light_instance_update_shadow(Instance *p_instance, const Transform3D p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, bool p_cam_vaspect, RID p_shadow_atlas, Scenario *p_scenario, float p_scren_lod_threshold);
|
||||
_FORCE_INLINE_ bool _light_instance_update_shadow(Instance *p_instance, const Transform3D p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, bool p_cam_vaspect, RID p_shadow_atlas, Scenario *p_scenario, float p_scren_mesh_lod_threshold);
|
||||
|
||||
RID _render_get_environment(RID p_camera, RID p_scenario);
|
||||
|
||||
@ -1054,10 +1054,10 @@ public:
|
||||
_FORCE_INLINE_ bool _visibility_parent_check(const CullData &p_cull_data, const InstanceData &p_instance_data);
|
||||
|
||||
bool _render_reflection_probe_step(Instance *p_instance, int p_step);
|
||||
void _render_scene(const RendererSceneRender::CameraData *p_camera_data, RID p_render_buffers, RID p_environment, RID p_force_camera_effects, uint32_t p_visible_layers, RID p_scenario, RID p_viewport, RID p_shadow_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_lod_threshold, bool p_using_shadows = true, RenderInfo *r_render_info = nullptr);
|
||||
void _render_scene(const RendererSceneRender::CameraData *p_camera_data, RID p_render_buffers, RID p_environment, RID p_force_camera_effects, uint32_t p_visible_layers, RID p_scenario, RID p_viewport, RID p_shadow_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_mesh_lod_threshold, bool p_using_shadows = true, RenderInfo *r_render_info = nullptr);
|
||||
void render_empty_scene(RID p_render_buffers, RID p_scenario, RID p_shadow_atlas);
|
||||
|
||||
void render_camera(RID p_render_buffers, RID p_camera, RID p_scenario, RID p_viewport, Size2 p_viewport_size, float p_screen_lod_threshold, RID p_shadow_atlas, Ref<XRInterface> &p_xr_interface, RendererScene::RenderInfo *r_render_info = nullptr);
|
||||
void render_camera(RID p_render_buffers, RID p_camera, RID p_scenario, RID p_viewport, Size2 p_viewport_size, float p_screen_mesh_lod_threshold, RID p_shadow_atlas, Ref<XRInterface> &p_xr_interface, RendererScene::RenderInfo *r_render_info = nullptr);
|
||||
void update_dirty_instances();
|
||||
|
||||
void render_particle_colliders();
|
||||
|
@ -248,7 +248,7 @@ public:
|
||||
void set_multiview_camera(uint32_t p_view_count, const Transform3D *p_transforms, const CameraMatrix *p_projections, bool p_is_ortogonal, bool p_vaspect);
|
||||
};
|
||||
|
||||
virtual void render_scene(RID p_render_buffers, const CameraData *p_camera_data, const PagedArray<GeometryInstance *> &p_instances, const PagedArray<RID> &p_lights, const PagedArray<RID> &p_reflection_probes, const PagedArray<RID> &p_voxel_gi_instances, const PagedArray<RID> &p_decals, const PagedArray<RID> &p_lightmaps, const PagedArray<RID> &p_fog_volumes, RID p_environment, RID p_camera_effects, RID p_shadow_atlas, RID p_occluder_debug_tex, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_lod_threshold, const RenderShadowData *p_render_shadows, int p_render_shadow_count, const RenderSDFGIData *p_render_sdfgi_regions, int p_render_sdfgi_region_count, const RenderSDFGIUpdateData *p_sdfgi_update_data = nullptr, RendererScene::RenderInfo *r_render_info = nullptr) = 0;
|
||||
virtual void render_scene(RID p_render_buffers, const CameraData *p_camera_data, const PagedArray<GeometryInstance *> &p_instances, const PagedArray<RID> &p_lights, const PagedArray<RID> &p_reflection_probes, const PagedArray<RID> &p_voxel_gi_instances, const PagedArray<RID> &p_decals, const PagedArray<RID> &p_lightmaps, const PagedArray<RID> &p_fog_volumes, RID p_environment, RID p_camera_effects, RID p_shadow_atlas, RID p_occluder_debug_tex, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass, float p_screen_mesh_lod_threshold, const RenderShadowData *p_render_shadows, int p_render_shadow_count, const RenderSDFGIData *p_render_sdfgi_regions, int p_render_sdfgi_region_count, const RenderSDFGIUpdateData *p_sdfgi_update_data = nullptr, RendererScene::RenderInfo *r_render_info = nullptr) = 0;
|
||||
|
||||
virtual void render_material(const Transform3D &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, const PagedArray<GeometryInstance *> &p_instances, RID p_framebuffer, const Rect2i &p_region) = 0;
|
||||
virtual void render_particle_collider_heightfield(RID p_collider, const Transform3D &p_transform, const PagedArray<GeometryInstance *> &p_instances) = 0;
|
||||
|
@ -366,7 +366,7 @@ public:
|
||||
virtual void reflection_probe_set_enable_box_projection(RID p_probe, bool p_enable) = 0;
|
||||
virtual void reflection_probe_set_enable_shadows(RID p_probe, bool p_enable) = 0;
|
||||
virtual void reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers) = 0;
|
||||
virtual void reflection_probe_set_lod_threshold(RID p_probe, float p_ratio) = 0;
|
||||
virtual void reflection_probe_set_mesh_lod_threshold(RID p_probe, float p_ratio) = 0;
|
||||
|
||||
virtual AABB reflection_probe_get_aabb(RID p_probe) const = 0;
|
||||
virtual RS::ReflectionProbeUpdateMode reflection_probe_get_update_mode(RID p_probe) const = 0;
|
||||
@ -375,7 +375,7 @@ public:
|
||||
virtual Vector3 reflection_probe_get_origin_offset(RID p_probe) const = 0;
|
||||
virtual float reflection_probe_get_origin_max_distance(RID p_probe) const = 0;
|
||||
virtual bool reflection_probe_renders_shadows(RID p_probe) const = 0;
|
||||
virtual float reflection_probe_get_lod_threshold(RID p_probe) const = 0;
|
||||
virtual float reflection_probe_get_mesh_lod_threshold(RID p_probe) const = 0;
|
||||
|
||||
virtual void base_update_dependency(RID p_base, DependencyTracker *p_instance) = 0;
|
||||
virtual void skeleton_update_dependency(RID p_base, DependencyTracker *p_instance) = 0;
|
||||
|
@ -167,8 +167,8 @@ void RendererViewport::_draw_3d(Viewport *p_viewport) {
|
||||
}
|
||||
}
|
||||
|
||||
float screen_lod_threshold = p_viewport->lod_threshold / float(p_viewport->size.width);
|
||||
RSG::scene->render_camera(p_viewport->render_buffers, p_viewport->camera, p_viewport->scenario, p_viewport->self, p_viewport->internal_size, screen_lod_threshold, p_viewport->shadow_atlas, xr_interface, &p_viewport->render_info);
|
||||
float screen_mesh_lod_threshold = p_viewport->mesh_lod_threshold / float(p_viewport->size.width);
|
||||
RSG::scene->render_camera(p_viewport->render_buffers, p_viewport->camera, p_viewport->scenario, p_viewport->self, p_viewport->internal_size, screen_mesh_lod_threshold, p_viewport->shadow_atlas, xr_interface, &p_viewport->render_info);
|
||||
|
||||
RENDER_TIMESTAMP("<End Rendering 3D Scene");
|
||||
}
|
||||
@ -1084,11 +1084,11 @@ void RendererViewport::viewport_set_occlusion_culling_build_quality(RS::Viewport
|
||||
RendererSceneOcclusionCull::get_singleton()->set_build_quality(p_quality);
|
||||
}
|
||||
|
||||
void RendererViewport::viewport_set_lod_threshold(RID p_viewport, float p_pixels) {
|
||||
void RendererViewport::viewport_set_mesh_lod_threshold(RID p_viewport, float p_pixels) {
|
||||
Viewport *viewport = viewport_owner.get_or_null(p_viewport);
|
||||
ERR_FAIL_COND(!viewport);
|
||||
|
||||
viewport->lod_threshold = p_pixels;
|
||||
viewport->mesh_lod_threshold = p_pixels;
|
||||
}
|
||||
|
||||
int RendererViewport::viewport_get_render_info(RID p_viewport, RS::ViewportRenderInfoType p_type, RS::ViewportRenderInfo p_info) {
|
||||
|
@ -95,7 +95,7 @@ public:
|
||||
|
||||
bool sdf_active;
|
||||
|
||||
float lod_threshold = 1.0;
|
||||
float mesh_lod_threshold = 1.0;
|
||||
|
||||
uint64_t last_pass = 0;
|
||||
|
||||
@ -256,7 +256,7 @@ public:
|
||||
void viewport_set_use_occlusion_culling(RID p_viewport, bool p_use_occlusion_culling);
|
||||
void viewport_set_occlusion_rays_per_thread(int p_rays_per_thread);
|
||||
void viewport_set_occlusion_culling_build_quality(RS::ViewportOcclusionCullingBuildQuality p_quality);
|
||||
void viewport_set_lod_threshold(RID p_viewport, float p_pixels);
|
||||
void viewport_set_mesh_lod_threshold(RID p_viewport, float p_pixels);
|
||||
|
||||
virtual int viewport_get_render_info(RID p_viewport, RS::ViewportRenderInfoType p_type, RS::ViewportRenderInfo p_info);
|
||||
virtual void viewport_set_debug_draw(RID p_viewport, RS::ViewportDebugDraw p_draw);
|
||||
|
@ -374,7 +374,7 @@ public:
|
||||
FUNC2(reflection_probe_set_enable_shadows, RID, bool)
|
||||
FUNC2(reflection_probe_set_cull_mask, RID, uint32_t)
|
||||
FUNC2(reflection_probe_set_resolution, RID, int)
|
||||
FUNC2(reflection_probe_set_lod_threshold, RID, float)
|
||||
FUNC2(reflection_probe_set_mesh_lod_threshold, RID, float)
|
||||
|
||||
/* DECAL API */
|
||||
|
||||
@ -575,7 +575,7 @@ public:
|
||||
FUNC2(viewport_set_use_occlusion_culling, RID, bool)
|
||||
FUNC1(viewport_set_occlusion_rays_per_thread, int)
|
||||
FUNC1(viewport_set_occlusion_culling_build_quality, ViewportOcclusionCullingBuildQuality)
|
||||
FUNC2(viewport_set_lod_threshold, RID, float)
|
||||
FUNC2(viewport_set_mesh_lod_threshold, RID, float)
|
||||
|
||||
FUNC3R(int, viewport_get_render_info, RID, ViewportRenderInfoType, ViewportRenderInfo)
|
||||
FUNC2(viewport_set_debug_draw, RID, ViewportDebugDraw)
|
||||
|
@ -1963,7 +1963,7 @@ void RenderingServer::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("reflection_probe_set_enable_shadows", "probe", "enable"), &RenderingServer::reflection_probe_set_enable_shadows);
|
||||
ClassDB::bind_method(D_METHOD("reflection_probe_set_cull_mask", "probe", "layers"), &RenderingServer::reflection_probe_set_cull_mask);
|
||||
ClassDB::bind_method(D_METHOD("reflection_probe_set_resolution", "probe", "resolution"), &RenderingServer::reflection_probe_set_resolution);
|
||||
ClassDB::bind_method(D_METHOD("reflection_probe_set_lod_threshold", "probe", "pixels"), &RenderingServer::reflection_probe_set_lod_threshold);
|
||||
ClassDB::bind_method(D_METHOD("reflection_probe_set_mesh_lod_threshold", "probe", "pixels"), &RenderingServer::reflection_probe_set_mesh_lod_threshold);
|
||||
|
||||
BIND_ENUM_CONSTANT(REFLECTION_PROBE_UPDATE_ONCE);
|
||||
BIND_ENUM_CONSTANT(REFLECTION_PROBE_UPDATE_ALWAYS);
|
||||
|
@ -528,7 +528,7 @@ public:
|
||||
virtual void reflection_probe_set_enable_shadows(RID p_probe, bool p_enable) = 0;
|
||||
virtual void reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers) = 0;
|
||||
virtual void reflection_probe_set_resolution(RID p_probe, int p_resolution) = 0;
|
||||
virtual void reflection_probe_set_lod_threshold(RID p_probe, float p_pixels) = 0;
|
||||
virtual void reflection_probe_set_mesh_lod_threshold(RID p_probe, float p_pixels) = 0;
|
||||
|
||||
/* DECAL API */
|
||||
|
||||
@ -871,7 +871,7 @@ public:
|
||||
|
||||
virtual void viewport_set_use_debanding(RID p_viewport, bool p_use_debanding) = 0;
|
||||
|
||||
virtual void viewport_set_lod_threshold(RID p_viewport, float p_pixels) = 0;
|
||||
virtual void viewport_set_mesh_lod_threshold(RID p_viewport, float p_pixels) = 0;
|
||||
|
||||
virtual void viewport_set_use_occlusion_culling(RID p_viewport, bool p_use_debanding) = 0;
|
||||
virtual void viewport_set_occlusion_rays_per_thread(int p_rays_per_thread) = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user