Godot Version
4.2.2-stable
Question
why iterator 3 times to build sdf base data in RenderForwardClustered::_render_sdfgi()?I think just one time is enough.
The iterators go over each axis in 3d. Hence the 3. I would ask why it couldn’t be vectorized? Seems like a pretty heavy function either way.
If anyone else is curious here is the source code
render_list_params.uv_offset = Vector2();
render_list_params.force_wireframe = false;
_render_list(draw_list, RD::get_singleton()->framebuffer_get_format(p_framebuffer), &render_list_params, 0, render_list_params.element_count); //second regular triangles
RD::get_singleton()->draw_list_end();
}
RD::get_singleton()->draw_command_end_label();
}
void RenderForwardClustered::_render_sdfgi(Ref<RenderSceneBuffersRD> p_render_buffers, const Vector3i &p_from, const Vector3i &p_size, const AABB &p_bounds, const PagedArray<RenderGeometryInstance *> &p_instances, const RID &p_albedo_texture, const RID &p_emission_texture, const RID &p_emission_aniso_texture, const RID &p_geom_facing_texture, float p_exposure_normalization) {
RENDER_TIMESTAMP("Render SDFGI");
RD::get_singleton()->draw_command_begin_label("Render SDFGI Voxel");
RenderSceneDataRD scene_data;
RenderDataRD render_data;
render_data.scene_data = &scene_data;
render_data.cluster_size = 1;
render_data.cluster_max_elements = 32;
seems go over any one of the three axis is enough.
because under passmode MODE_RENDER_SDF, in scene_forward_clustered.glsl , godot save the information into the corresponding 3d texture through FragmentShader which we can think called on every point of the mesh