EEVEE-Next: Per probe viewport display #114176
|
@ -110,6 +110,12 @@ class DATA_PT_lightprobe_eevee_next(DataButtonsPanel, Panel):
|
|||
col.operator("object.lightprobe_cache_bake").subset = 'ACTIVE'
|
||||
col.operator("object.lightprobe_cache_free").subset = 'ACTIVE'
|
||||
|
||||
col.separator()
|
||||
|
||||
row = col.row(align=True)
|
||||
row.prop(probe, "data_display_size", text="Display Data")
|
||||
row.prop(probe, "use_data_display", text="", toggle=True)
|
||||
|
||||
col.separator()
|
||||
|
||||
col.prop(probe, "grid_bake_samples")
|
||||
|
@ -160,11 +166,15 @@ class DATA_PT_lightprobe_eevee_next(DataButtonsPanel, Panel):
|
|||
sub.prop(probe, "clip_start", text="Clipping Start")
|
||||
sub.prop(probe, "clip_end", text="End")
|
||||
|
||||
row = col.row(align=True)
|
||||
row.prop(probe, "data_display_size", text="Display Data")
|
||||
row.prop(probe, "use_data_display", text="", toggle=True)
|
||||
|
||||
elif probe.type == 'PLANE':
|
||||
col = layout.column()
|
||||
row = col.row()
|
||||
col.prop(probe, "clip_start", text="Clipping Offset")
|
||||
col.prop(probe, "influence_distance", text="Distance")
|
||||
col.prop(probe, "use_data_display", toggle=True)
|
||||
pass
|
||||
else:
|
||||
# Currently unsupported
|
||||
|
|
|
@ -493,7 +493,8 @@ static void version_mesh_crease_generic(Main &bmain)
|
|||
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
|
||||
if (STR_ELEM(node->idname,
|
||||
"GeometryNodeStoreNamedAttribute",
|
||||
"GeometryNodeInputNamedAttribute")) {
|
||||
"GeometryNodeInputNamedAttribute"))
|
||||
{
|
||||
bNodeSocket *socket = nodeFindSocket(node, SOCK_IN, "Name");
|
||||
if (STREQ(socket->default_value_typed<bNodeSocketValueString>()->value, "crease")) {
|
||||
STRNCPY(socket->default_value_typed<bNodeSocketValueString>()->value, "crease_edge");
|
||||
|
@ -1333,7 +1334,8 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
|
|||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 400, 14)) {
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "SceneEEVEE", "RaytraceEEVEE", "reflection_options")) {
|
||||
fd->filesdna, "SceneEEVEE", "RaytraceEEVEE", "reflection_options"))
|
||||
{
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
scene->eevee.reflection_options.flag = RAYTRACE_EEVEE_USE_DENOISE;
|
||||
scene->eevee.reflection_options.denoise_stages = RAYTRACE_EEVEE_DENOISE_SPATIAL |
|
||||
|
@ -1563,7 +1565,8 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
|
|||
|
||||
RegionAssetShelf *shelf_data = static_cast<RegionAssetShelf *>(region->regiondata);
|
||||
if (shelf_data && shelf_data->active_shelf &&
|
||||
(shelf_data->active_shelf->preferred_row_count == 0)) {
|
||||
(shelf_data->active_shelf->preferred_row_count == 0))
|
||||
{
|
||||
shelf_data->active_shelf->preferred_row_count = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1579,7 +1582,8 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
|
|||
if (item.item_type == NODE_INTERFACE_SOCKET) {
|
||||
bNodeTreeInterfaceSocket &socket = reinterpret_cast<bNodeTreeInterfaceSocket &>(item);
|
||||
if ((socket.flag & NODE_INTERFACE_SOCKET_INPUT) &&
|
||||
(socket.flag & NODE_INTERFACE_SOCKET_OUTPUT)) {
|
||||
(socket.flag & NODE_INTERFACE_SOCKET_OUTPUT))
|
||||
{
|
||||
sockets_to_split.append(&socket);
|
||||
}
|
||||
}
|
||||
|
@ -1826,5 +1830,12 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "LightProbe", "float", "data_display_size")) {
|
||||
LightProbe default_probe = *DNA_struct_default_get(LightProbe);
|
||||
LISTBASE_FOREACH (LightProbe *, probe, &bmain->lightprobes) {
|
||||
probe->data_display_size = default_probe.data_display_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -491,6 +491,10 @@ set(GLSL_SRC
|
|||
engines/eevee_next/shaders/eevee_depth_of_field_tiles_flatten_comp.glsl
|
||||
engines/eevee_next/shaders/eevee_display_probe_grid_frag.glsl
|
||||
engines/eevee_next/shaders/eevee_display_probe_grid_vert.glsl
|
||||
engines/eevee_next/shaders/eevee_display_probe_planar_frag.glsl
|
||||
engines/eevee_next/shaders/eevee_display_probe_planar_vert.glsl
|
||||
engines/eevee_next/shaders/eevee_display_probe_reflection_frag.glsl
|
||||
engines/eevee_next/shaders/eevee_display_probe_reflection_vert.glsl
|
||||
engines/eevee_next/shaders/eevee_film_comp.glsl
|
||||
engines/eevee_next/shaders/eevee_film_cryptomatte_post_comp.glsl
|
||||
engines/eevee_next/shaders/eevee_film_frag.glsl
|
||||
|
|
|
@ -23,8 +23,7 @@ namespace blender::eevee {
|
|||
|
||||
void IrradianceCache::init()
|
||||
{
|
||||
display_grids_enabled_ = DRW_state_draw_support() &&
|
||||
(inst_.scene->eevee.flag & SCE_EEVEE_SHOW_IRRADIANCE);
|
||||
display_grids_enabled_ = DRW_state_draw_support();
|
||||
|
||||
int atlas_byte_size = 1024 * 1024 * inst_.scene->eevee.gi_irradiance_pool_size;
|
||||
/* This might become an option in the future. */
|
||||
|
@ -535,16 +534,14 @@ void IrradianceCache::display_pass_draw(View &view, GPUFrameBuffer *view_fb)
|
|||
}
|
||||
|
||||
for (const IrradianceGrid &grid : inst_.light_probes.grid_map_.values()) {
|
||||
if (grid.cache == nullptr) {
|
||||
if (!grid.viewport_display || grid.viewport_display_size == 0.0f || !grid.cache ||
|
||||
!grid.cache->grid_static_cache)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
LightProbeGridCacheFrame *cache = grid.cache->grid_static_cache;
|
||||
|
||||
if (cache == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Display texture. Updated for each individual light grid to avoid increasing VRAM usage. */
|
||||
draw::Texture irradiance_a_tx = {"irradiance_a_tx"};
|
||||
draw::Texture irradiance_b_tx = {"irradiance_b_tx"};
|
||||
|
@ -596,7 +593,7 @@ void IrradianceCache::display_pass_draw(View &view, GPUFrameBuffer *view_fb)
|
|||
display_grids_ps_.framebuffer_set(&view_fb);
|
||||
display_grids_ps_.shader_set(inst_.shaders.static_shader_get(DISPLAY_PROBE_GRID));
|
||||
|
||||
display_grids_ps_.push_constant("sphere_radius", inst_.scene->eevee.gi_irradiance_draw_size);
|
||||
display_grids_ps_.push_constant("sphere_radius", grid.viewport_display_size);
|
||||
display_grids_ps_.push_constant("grid_resolution", grid_size);
|
||||
display_grids_ps_.push_constant("grid_to_world", grid.object_to_world);
|
||||
display_grids_ps_.push_constant("world_to_grid", grid.world_to_object);
|
||||
|
|
|
@ -48,6 +48,10 @@ void LightProbeModule::sync_grid(const Object *ob, ObjectHandle &handle)
|
|||
grid.dilation_threshold = lightprobe->grid_dilation_threshold;
|
||||
grid.dilation_radius = lightprobe->grid_dilation_radius;
|
||||
grid.intensity = lightprobe->intensity;
|
||||
|
||||
grid.viewport_display = lightprobe->flag & LIGHTPROBE_FLAG_SHOW_DATA;
|
||||
grid.viewport_display_size = lightprobe->data_display_size;
|
||||
|
||||
/* Force reupload. */
|
||||
inst_.irradiance_cache.bricks_free(grid.bricks);
|
||||
}
|
||||
|
|
|
@ -51,6 +51,9 @@ struct IrradianceGrid : public LightProbe, IrradianceGridData {
|
|||
float dilation_threshold;
|
||||
float dilation_radius;
|
||||
float intensity;
|
||||
/** Display irradiance samples in the viewport. */
|
||||
bool viewport_display;
|
||||
float viewport_display_size;
|
||||
};
|
||||
|
||||
struct ReflectionCube : public LightProbe {
|
||||
|
|
|
@ -15,12 +15,14 @@ using namespace blender::math;
|
|||
|
||||
void PlanarProbe::sync(const float4x4 &world_to_object,
|
||||
float clipping_offset,
|
||||
float influence_distance)
|
||||
float influence_distance,
|
||||
bool viewport_display)
|
||||
{
|
||||
this->plane_to_world = float4x4(world_to_object);
|
||||
this->plane_to_world.z_axis() = normalize(this->plane_to_world.z_axis()) * influence_distance;
|
||||
this->world_to_plane = invert(this->plane_to_world);
|
||||
this->clipping_offset = clipping_offset;
|
||||
this->viewport_display = viewport_display;
|
||||
}
|
||||
|
||||
void PlanarProbe::set_view(const draw::View &view, int layer_id)
|
||||
|
@ -59,6 +61,8 @@ void PlanarProbeModule::init()
|
|||
if (assign_if_different(update_probes_, !probes_.is_empty())) {
|
||||
instance_.sampling.reset();
|
||||
}
|
||||
|
||||
do_display_draw_ = false;
|
||||
}
|
||||
|
||||
void PlanarProbeModule::begin_sync()
|
||||
|
@ -76,7 +80,10 @@ void PlanarProbeModule::sync_object(Object *ob, ObjectHandle &ob_handle)
|
|||
}
|
||||
|
||||
PlanarProbe &probe = find_or_insert(ob_handle);
|
||||
probe.sync(float4x4(ob->object_to_world), light_probe->clipsta, light_probe->distinf);
|
||||
probe.sync(float4x4(ob->object_to_world),
|
||||
light_probe->clipsta,
|
||||
light_probe->distinf,
|
||||
light_probe->flag & LIGHTPROBE_FLAG_SHOW_DATA);
|
||||
probe.is_probe_used = true;
|
||||
}
|
||||
|
||||
|
@ -108,7 +115,10 @@ void PlanarProbeModule::set_view(const draw::View &main_view, int2 main_view_ext
|
|||
radiance_tx_.ensure_2d_array(GPU_R11F_G11F_B10F, extent, layer_count, usage);
|
||||
depth_tx_.ensure_2d_array(GPU_DEPTH_COMPONENT32F, extent, layer_count, usage);
|
||||
|
||||
do_display_draw_ = DRW_state_draw_support() && num_probes > 0;
|
||||
|
||||
int resource_index = 0;
|
||||
int display_index = 0;
|
||||
for (PlanarProbe &probe : probes_.values()) {
|
||||
if (resource_index == PLANAR_PROBES_MAX) {
|
||||
break;
|
||||
|
@ -131,6 +141,10 @@ void PlanarProbeModule::set_view(const draw::View &main_view, int2 main_view_ext
|
|||
|
||||
instance_.pipelines.planar.render(res.view, res.combined_fb, resource_index, extent);
|
||||
|
||||
if (do_display_draw_ && probe.viewport_display) {
|
||||
display_data_buf_.get_or_resize(display_index++) = {probe.plane_to_world, resource_index};
|
||||
}
|
||||
|
||||
resource_index++;
|
||||
}
|
||||
|
||||
|
@ -139,6 +153,12 @@ void PlanarProbeModule::set_view(const draw::View &main_view, int2 main_view_ext
|
|||
probe_planar_buf_[resource_index].layer_id = -1;
|
||||
}
|
||||
probe_planar_buf_.push_update();
|
||||
|
||||
do_display_draw_ = display_index > 0;
|
||||
if (do_display_draw_) {
|
||||
display_data_buf_.resize(display_index);
|
||||
display_data_buf_.push_update();
|
||||
}
|
||||
}
|
||||
|
||||
PlanarProbe &PlanarProbeModule::find_or_insert(ObjectHandle &ob_handle)
|
||||
|
@ -147,6 +167,24 @@ PlanarProbe &PlanarProbeModule::find_or_insert(ObjectHandle &ob_handle)
|
|||
return planar_probe;
|
||||
}
|
||||
|
||||
void PlanarProbeModule::viewport_draw(View &view, GPUFrameBuffer *view_fb)
|
||||
{
|
||||
if (!do_display_draw_) {
|
||||
return;
|
||||
}
|
||||
|
||||
viewport_display_ps_.init();
|
||||
viewport_display_ps_.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH |
|
||||
DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_CULL_BACK);
|
||||
viewport_display_ps_.framebuffer_set(&view_fb);
|
||||
viewport_display_ps_.shader_set(instance_.shaders.static_shader_get(DISPLAY_PROBE_PLANAR));
|
||||
bind_resources(viewport_display_ps_);
|
||||
viewport_display_ps_.bind_ssbo("display_data_buf", display_data_buf_);
|
||||
viewport_display_ps_.draw_procedural(GPU_PRIM_TRIS, 1, display_data_buf_.size() * 6);
|
||||
|
||||
instance_.manager->submit(viewport_display_ps_, view);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
} // namespace blender::eevee
|
||||
|
|
|
@ -36,9 +36,14 @@ struct PlanarProbe : ProbePlanarData {
|
|||
int resource_index;
|
||||
/* Pruning flag. */
|
||||
bool is_probe_used = false;
|
||||
/** Display a debug plane in the viewport. */
|
||||
bool viewport_display = false;
|
||||
|
||||
public:
|
||||
void sync(const float4x4 &world_to_object, float clipping_offset, float influence_distance);
|
||||
void sync(const float4x4 &world_to_object,
|
||||
float clipping_offset,
|
||||
float influence_distance,
|
||||
bool viewport_display);
|
||||
|
||||
/**
|
||||
* Update the ProbePlanarData part of the struct.
|
||||
|
@ -90,6 +95,11 @@ class PlanarProbeModule {
|
|||
|
||||
bool update_probes_ = false;
|
||||
|
||||
/** Viewport data display drawing. */
|
||||
bool do_display_draw_ = false;
|
||||
ProbePlanarDisplayDataBuf display_data_buf_;
|
||||
PassSimple viewport_display_ps_ = {"PlanarProbeModule.Viewport Display"};
|
||||
|
||||
public:
|
||||
PlanarProbeModule(Instance &instance) : instance_(instance) {}
|
||||
|
||||
|
@ -100,6 +110,8 @@ class PlanarProbeModule {
|
|||
|
||||
void set_view(const draw::View &main_view, int2 main_view_extent);
|
||||
|
||||
void viewport_draw(View &view, GPUFrameBuffer *view_fb);
|
||||
|
||||
template<typename PassType> void bind_resources(PassType &pass)
|
||||
{
|
||||
/* Disable filter to avoid interpolation with missing background. */
|
||||
|
|
|
@ -192,6 +192,8 @@ void ReflectionProbeModule::init()
|
|||
pass.bind_texture("reflection_probes_tx", &probes_tx_);
|
||||
pass.dispatch(int2(1, 1));
|
||||
}
|
||||
|
||||
do_display_draw_ = false;
|
||||
}
|
||||
|
||||
void ReflectionProbeModule::begin_sync()
|
||||
|
@ -269,7 +271,7 @@ void ReflectionProbeModule::sync_object(Object *ob, ObjectHandle &ob_handle)
|
|||
return;
|
||||
}
|
||||
|
||||
ReflectionProbe &probe = probes_.lookup_or_add_cb(ob_handle.object_key.hash(), []() {
|
||||
ReflectionProbe &probe = probes_.lookup_or_add_cb(ob_handle.object_key.hash(), [&]() {
|
||||
ReflectionProbe probe = {};
|
||||
probe.do_render = true;
|
||||
probe.type = ReflectionProbe::Type::PROBE;
|
||||
|
@ -315,6 +317,9 @@ void ReflectionProbeModule::sync_object(Object *ob, ObjectHandle &ob_handle)
|
|||
probe.influence_scale = 1.0 / max_ff(1e-8f, influence_falloff);
|
||||
probe.influence_bias = probe.influence_scale;
|
||||
probe.parallax_distance = parallax_distance / influence_distance;
|
||||
|
||||
probe.viewport_display = light_probe.flag & LIGHTPROBE_FLAG_SHOW_DATA;
|
||||
probe.viewport_display_size = light_probe.data_display_size;
|
||||
}
|
||||
|
||||
ReflectionProbeAtlasCoordinate ReflectionProbeModule::find_empty_atlas_region(
|
||||
|
@ -539,6 +544,22 @@ void ReflectionProbeModule::set_view(View & /*view*/)
|
|||
}
|
||||
data_buf_.push_update();
|
||||
|
||||
do_display_draw_ = DRW_state_draw_support() && probe_active.size() > 0;
|
||||
if (do_display_draw_) {
|
||||
int display_index = 0;
|
||||
for (int i : probe_active.index_range()) {
|
||||
if (probe_active[i]->viewport_display) {
|
||||
display_data_buf_.get_or_resize(display_index++) = {
|
||||
i, probe_active[i]->viewport_display_size};
|
||||
}
|
||||
}
|
||||
do_display_draw_ = display_index > 0;
|
||||
if (do_display_draw_) {
|
||||
display_data_buf_.resize(display_index);
|
||||
display_data_buf_.push_update();
|
||||
}
|
||||
}
|
||||
|
||||
/* Add one for world probe. */
|
||||
reflection_probe_count_ = probe_active.size() + 1;
|
||||
dispatch_probe_select_.x = divide_ceil_u(reflection_probe_count_,
|
||||
|
@ -551,6 +572,24 @@ ReflectionProbeAtlasCoordinate ReflectionProbeModule::world_atlas_coord_get() co
|
|||
return probes_.lookup(world_object_key_).atlas_coord;
|
||||
}
|
||||
|
||||
void ReflectionProbeModule::viewport_draw(View &view, GPUFrameBuffer *view_fb)
|
||||
{
|
||||
if (!do_display_draw_) {
|
||||
return;
|
||||
}
|
||||
|
||||
viewport_display_ps_.init();
|
||||
viewport_display_ps_.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH |
|
||||
DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_CULL_BACK);
|
||||
viewport_display_ps_.framebuffer_set(&view_fb);
|
||||
viewport_display_ps_.shader_set(instance_.shaders.static_shader_get(DISPLAY_PROBE_REFLECTION));
|
||||
bind_resources(viewport_display_ps_);
|
||||
viewport_display_ps_.bind_ssbo("display_data_buf", display_data_buf_);
|
||||
viewport_display_ps_.draw_procedural(GPU_PRIM_TRIS, 1, display_data_buf_.size() * 6);
|
||||
|
||||
instance_.manager->submit(viewport_display_ps_, view);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
|
|
@ -53,6 +53,10 @@ struct ReflectionProbe : ReflectionProbeData {
|
|||
*/
|
||||
float2 clipping_distances;
|
||||
|
||||
/** Display debug spheres in the viewport. */
|
||||
bool viewport_display;
|
||||
float viewport_display_size;
|
||||
|
||||
ReflectionProbe()
|
||||
{
|
||||
this->atlas_coord.layer_subdivision = -1;
|
||||
|
@ -123,6 +127,11 @@ class ReflectionProbeModule {
|
|||
bool update_probes_next_sample_ = false;
|
||||
bool update_probes_this_sample_ = false;
|
||||
|
||||
/** Viewport data display drawing. */
|
||||
bool do_display_draw_ = false;
|
||||
ReflectionProbeDisplayDataBuf display_data_buf_;
|
||||
PassSimple viewport_display_ps_ = {"ReflectionProbeModule.Viewport Display"};
|
||||
|
||||
public:
|
||||
ReflectionProbeModule(Instance &instance) : instance_(instance) {}
|
||||
|
||||
|
@ -133,6 +142,8 @@ class ReflectionProbeModule {
|
|||
void sync_object(Object *ob, ObjectHandle &ob_handle);
|
||||
void end_sync();
|
||||
|
||||
void viewport_draw(View &view, GPUFrameBuffer *view_fb);
|
||||
|
||||
template<typename PassType> void bind_resources(PassType &pass)
|
||||
{
|
||||
pass.bind_texture(REFLECTION_PROBE_TEX_SLOT, &probes_tx_);
|
||||
|
|
|
@ -120,6 +120,10 @@ const char *ShaderModule::static_shader_create_info_name_get(eShaderType shader_
|
|||
return "eevee_debug_irradiance_grid";
|
||||
case DISPLAY_PROBE_GRID:
|
||||
return "eevee_display_probe_grid";
|
||||
case DISPLAY_PROBE_REFLECTION:
|
||||
return "eevee_display_probe_reflection";
|
||||
case DISPLAY_PROBE_PLANAR:
|
||||
return "eevee_display_probe_planar";
|
||||
case DOF_BOKEH_LUT:
|
||||
return "eevee_depth_of_field_bokeh_lut";
|
||||
case DOF_DOWNSAMPLE:
|
||||
|
|
|
@ -41,6 +41,8 @@ enum eShaderType {
|
|||
DEBUG_IRRADIANCE_GRID,
|
||||
|
||||
DISPLAY_PROBE_GRID,
|
||||
DISPLAY_PROBE_REFLECTION,
|
||||
DISPLAY_PROBE_PLANAR,
|
||||
|
||||
DOF_BOKEH_LUT,
|
||||
DOF_DOWNSAMPLE,
|
||||
|
|
|
@ -1348,6 +1348,15 @@ struct ReflectionProbeData {
|
|||
};
|
||||
BLI_STATIC_ASSERT_ALIGN(ReflectionProbeData, 16)
|
||||
|
||||
/** Viewport Display Pass. */
|
||||
struct ReflectionProbeDisplayData {
|
||||
int probe_index;
|
||||
float display_size;
|
||||
float _pad0;
|
||||
float _pad1;
|
||||
};
|
||||
BLI_STATIC_ASSERT_ALIGN(ReflectionProbeDisplayData, 16)
|
||||
|
||||
struct ProbePlanarData {
|
||||
/** Matrices used to render the planar capture. */
|
||||
float4x4 viewmat;
|
||||
|
@ -1367,6 +1376,16 @@ struct ClipPlaneData {
|
|||
};
|
||||
BLI_STATIC_ASSERT_ALIGN(ClipPlaneData, 16)
|
||||
|
||||
/** Viewport Display Pass. */
|
||||
struct ProbePlanarDisplayData {
|
||||
float4x4 plane_to_world;
|
||||
int probe_index;
|
||||
float _pad0;
|
||||
float _pad1;
|
||||
float _pad2;
|
||||
};
|
||||
BLI_STATIC_ASSERT_ALIGN(ProbePlanarDisplayData, 16)
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
@ -1484,7 +1503,9 @@ using RayTraceTileBuf = draw::StorageArrayBuffer<uint, 1024, true>;
|
|||
using SubsurfaceTileBuf = RayTraceTileBuf;
|
||||
using ReflectionProbeDataBuf =
|
||||
draw::UniformArrayBuffer<ReflectionProbeData, REFLECTION_PROBES_MAX>;
|
||||
using ReflectionProbeDisplayDataBuf = draw::StorageArrayBuffer<ReflectionProbeDisplayData>;
|
||||
using ProbePlanarDataBuf = draw::UniformArrayBuffer<ProbePlanarData, PLANAR_PROBES_MAX>;
|
||||
using ProbePlanarDisplayDataBuf = draw::StorageArrayBuffer<ProbePlanarDisplayData>;
|
||||
using SamplingDataBuf = draw::StorageBuffer<SamplingData>;
|
||||
using ShadowStatisticsBuf = draw::StorageBuffer<ShadowStatistics>;
|
||||
using ShadowPagesInfoDataBuf = draw::StorageBuffer<ShadowPagesInfoData>;
|
||||
|
|
|
@ -150,6 +150,8 @@ void ShadingView::render()
|
|||
inst_.hiz_buffer.debug_draw(render_view_new_, combined_fb_);
|
||||
inst_.shadows.debug_draw(render_view_new_, combined_fb_);
|
||||
inst_.irradiance_cache.viewport_draw(render_view_new_, combined_fb_);
|
||||
inst_.reflection_probes.viewport_draw(render_view_new_, combined_fb_);
|
||||
inst_.planar_probes.viewport_draw(render_view_new_, combined_fb_);
|
||||
|
||||
inst_.ambient_occlusion.render_pass(render_view_new_);
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 uv = gl_FragCoord.xy / textureSize(planar_radiance_tx, 0).xy;
|
||||
out_color = texture(planar_radiance_tx, vec3(uv, probe_index));
|
||||
out_color.a = 0.0;
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#pragma BLENDER_REQUIRE(gpu_shader_math_matrix_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(draw_view_lib.glsl)
|
||||
|
||||
void main()
|
||||
{
|
||||
/* Constant array moved inside function scope.
|
||||
* Minimizes local register allocation in MSL. */
|
||||
const vec2 pos[6] = vec2[6](vec2(-1.0, -1.0),
|
||||
vec2(1.0, -1.0),
|
||||
vec2(-1.0, 1.0),
|
||||
|
||||
vec2(1.0, -1.0),
|
||||
vec2(1.0, 1.0),
|
||||
vec2(-1.0, 1.0));
|
||||
|
||||
vec2 lP = pos[gl_VertexID % 6];
|
||||
int display_index = gl_VertexID / 6;
|
||||
|
||||
probe_index = display_data_buf[display_index].probe_index;
|
||||
|
||||
vec3 P = transform_point(display_data_buf[display_index].plane_to_world, vec3(lP, 0.0));
|
||||
|
||||
gl_Position = drw_point_world_to_homogenous(P);
|
||||
/* Small bias to let the icon draw without Z-fighting. */
|
||||
gl_Position.z += 0.0001;
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#pragma BLENDER_REQUIRE(draw_view_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(eevee_reflection_probe_lib.glsl)
|
||||
|
||||
void main()
|
||||
{
|
||||
float dist_sqr = dot(lP, lP);
|
||||
|
||||
/* Discard outside the circle. */
|
||||
if (dist_sqr > 1.0) {
|
||||
discard;
|
||||
return;
|
||||
}
|
||||
|
||||
vec3 vN = vec3(lP, sqrt(max(0.0, 1.0 - dist_sqr)));
|
||||
vec3 N = drw_normal_view_to_world(vN);
|
||||
|
||||
out_color = reflection_probes_sample(N, 0, reflection_probe_buf[probe_index].atlas_coord);
|
||||
out_color.a = 0.0;
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#pragma BLENDER_REQUIRE(draw_view_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(eevee_lightprobe_lib.glsl)
|
||||
|
||||
void main()
|
||||
{
|
||||
/* Constant array moved inside function scope.
|
||||
* Minimizes local register allocation in MSL. */
|
||||
const vec2 pos[6] = vec2[6](vec2(-1.0, -1.0),
|
||||
vec2(1.0, -1.0),
|
||||
vec2(-1.0, 1.0),
|
||||
|
||||
vec2(1.0, -1.0),
|
||||
vec2(1.0, 1.0),
|
||||
vec2(-1.0, 1.0));
|
||||
|
||||
lP = pos[gl_VertexID % 6];
|
||||
int display_index = gl_VertexID / 6;
|
||||
|
||||
probe_index = display_data_buf[display_index].probe_index;
|
||||
float sphere_radius = display_data_buf[display_index].display_size;
|
||||
|
||||
vec3 ws_probe_pos = reflection_probe_buf[probe_index].location;
|
||||
|
||||
vec3 vs_offset = vec3(lP, 0.0) * sphere_radius;
|
||||
vec3 vP = drw_point_world_to_view(ws_probe_pos) + vs_offset;
|
||||
|
||||
gl_Position = drw_point_view_to_homogenous(vP);
|
||||
/* Small bias to let the icon draw without Z-fighting. */
|
||||
gl_Position.z += 0.0001;
|
||||
}
|
|
@ -50,4 +50,28 @@ GPU_SHADER_CREATE_INFO(eevee_reflection_probe_select)
|
|||
.compute_source("eevee_reflection_probe_select_comp.glsl")
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(eevee_display_probe_reflection_iface, "")
|
||||
.smooth(Type::VEC2, "lP")
|
||||
.flat(Type::INT, "probe_index");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_display_probe_reflection)
|
||||
.additional_info("eevee_shared", "draw_view", "eevee_reflection_probe_data")
|
||||
.storage_buf(0, Qualifier::READ, "ReflectionProbeDisplayData", "display_data_buf[]")
|
||||
.vertex_source("eevee_display_probe_reflection_vert.glsl")
|
||||
.vertex_out(eevee_display_probe_reflection_iface)
|
||||
.fragment_source("eevee_display_probe_reflection_frag.glsl")
|
||||
.fragment_out(0, Type::VEC4, "out_color")
|
||||
.do_static_compilation(true);
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(eevee_display_probe_planar_iface, "").flat(Type::INT, "probe_index");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(eevee_display_probe_planar)
|
||||
.additional_info("eevee_shared", "draw_view", "eevee_lightprobe_planar_data")
|
||||
.storage_buf(0, Qualifier::READ, "ProbePlanarDisplayData", "display_data_buf[]")
|
||||
.vertex_source("eevee_display_probe_planar_vert.glsl")
|
||||
.vertex_out(eevee_display_probe_planar_iface)
|
||||
.fragment_source("eevee_display_probe_planar_frag.glsl")
|
||||
.fragment_out(0, Type::VEC4, "out_color")
|
||||
.do_static_compilation(true);
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
.intensity = 1.0f, \
|
||||
.flag = LIGHTPROBE_FLAG_SHOW_INFLUENCE, \
|
||||
.grid_flag = LIGHTPROBE_GRID_CAPTURE_INDIRECT | LIGHTPROBE_GRID_CAPTURE_EMISSION, \
|
||||
.data_display_size = 0.1f, \
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -77,6 +77,10 @@ typedef struct LightProbe {
|
|||
|
||||
/** Object visibility group, inclusive or exclusive. */
|
||||
struct Collection *visibility_grp;
|
||||
|
||||
/** LIGHTPROBE_FLAG_SHOW_DATA display size. */
|
||||
float data_display_size;
|
||||
char _pad1[4];
|
||||
} LightProbe;
|
||||
|
||||
/* Probe->type */
|
||||
|
|
|
@ -316,9 +316,25 @@ static void rna_def_lightprobe(BlenderRNA *brna)
|
|||
/* Data preview */
|
||||
prop = RNA_def_property(srna, "show_data", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIGHTPROBE_FLAG_SHOW_DATA);
|
||||
RNA_def_property_ui_text(prop,
|
||||
"Show Preview Plane",
|
||||
"Show captured lighting data into the 3D view for debugging purpose");
|
||||
RNA_def_property_ui_icon(prop, ICON_HIDE_ON, 1);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Display Data (Deprecated)", "Deprecated, use use_data_display instead");
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "use_data_display", PROP_BOOLEAN, PROP_NONE);
|
||||
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", LIGHTPROBE_FLAG_SHOW_DATA);
|
||||
RNA_def_property_ui_icon(prop, ICON_HIDE_ON, 1);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Display Data", "Display sampled data in the viewport to debug captured light");
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "data_display_size", PROP_FLOAT, PROP_DISTANCE);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "data_display_size");
|
||||
RNA_def_property_range(prop, 0.0f, FLT_MAX);
|
||||
RNA_def_property_ui_range(prop, 0.01f, 1.0f, 1, 3);
|
||||
RNA_def_property_ui_text(prop, "Display Data Size", "Viewport display size of the sampled data");
|
||||
RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, nullptr);
|
||||
|
||||
/* common */
|
||||
|
|
|
@ -7597,37 +7597,40 @@ static void rna_def_scene_eevee(BlenderRNA *brna)
|
|||
RNA_def_property_range(prop, 1.0f, 8.0f);
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
|
||||
prop = RNA_def_property(srna, "gi_show_irradiance", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", SCE_EEVEE_SHOW_IRRADIANCE);
|
||||
RNA_def_property_ui_icon(prop, ICON_HIDE_ON, 1);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Show Irradiance Cache", "Display irradiance samples in the viewport");
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, nullptr);
|
||||
/* TODO(Miguel Pozo): Remove once EEVEE is fully replaced. */
|
||||
{
|
||||
prop = RNA_def_property(srna, "gi_show_irradiance", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", SCE_EEVEE_SHOW_IRRADIANCE);
|
||||
RNA_def_property_ui_icon(prop, ICON_HIDE_ON, 1);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Show Irradiance Cache", "Display irradiance samples in the viewport");
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "gi_show_cubemaps", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", SCE_EEVEE_SHOW_CUBEMAPS);
|
||||
RNA_def_property_ui_icon(prop, ICON_HIDE_ON, 1);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Show Cubemap Cache", "Display captured cubemaps in the viewport");
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, nullptr);
|
||||
prop = RNA_def_property(srna, "gi_show_cubemaps", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", SCE_EEVEE_SHOW_CUBEMAPS);
|
||||
RNA_def_property_ui_icon(prop, ICON_HIDE_ON, 1);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Show Cubemap Cache", "Display captured cubemaps in the viewport");
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "gi_irradiance_display_size", PROP_FLOAT, PROP_DISTANCE);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "gi_irradiance_draw_size");
|
||||
RNA_def_property_range(prop, 0.0f, FLT_MAX);
|
||||
RNA_def_property_ui_range(prop, 0.01f, 1.0f, 1, 3);
|
||||
RNA_def_property_ui_text(prop,
|
||||
"Irradiance Display Size",
|
||||
"Size of the irradiance sample spheres to debug captured light");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, nullptr);
|
||||
prop = RNA_def_property(srna, "gi_irradiance_display_size", PROP_FLOAT, PROP_DISTANCE);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "gi_irradiance_draw_size");
|
||||
RNA_def_property_range(prop, 0.0f, FLT_MAX);
|
||||
RNA_def_property_ui_range(prop, 0.01f, 1.0f, 1, 3);
|
||||
RNA_def_property_ui_text(prop,
|
||||
"Irradiance Display Size",
|
||||
"Size of the irradiance sample spheres to debug captured light");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "gi_cubemap_display_size", PROP_FLOAT, PROP_DISTANCE);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "gi_cubemap_draw_size");
|
||||
RNA_def_property_range(prop, 0.05f, 10.0f);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Cubemap Display Size", "Size of the cubemap spheres to debug captured light");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, nullptr);
|
||||
prop = RNA_def_property(srna, "gi_cubemap_display_size", PROP_FLOAT, PROP_DISTANCE);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "gi_cubemap_draw_size");
|
||||
RNA_def_property_range(prop, 0.05f, 10.0f);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Cubemap Display Size", "Size of the cubemap spheres to debug captured light");
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, nullptr);
|
||||
}
|
||||
|
||||
prop = RNA_def_property(srna, "gi_auto_bake", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", SCE_EEVEE_GI_AUTOBAKE);
|
||||
|
|
Loading…
Reference in New Issue
The naming is confusing. Could be interpreted that it shows the size.
I'm tempted to rename the
show_data
touse_data_display
. Then this property would becomedata_display_size
which would avoid this confusion.I would go with
show_data_display_size
, to avoid breaking the Python API.Like I said in another task, we can keep the old name in the RNA for compatibility reason and add a deprecation warning in the property description. The new property would just be an alias.