EEVEE-Next: Planar Probe Pipeline #113203
@ -30,11 +30,12 @@ void PlanarProbeModule::sync_object(Object *ob, ObjectHandle &ob_handle)
|
||||
return;
|
||||
}
|
||||
|
||||
/* TODO Cull out of view planars. */
|
||||
|
||||
PlanarProbe &probe = find_or_insert(ob_handle);
|
||||
probe.plane_to_world = float4x4(ob->object_to_world);
|
||||
probe.world_to_plane = float4x4(ob->world_to_object);
|
||||
probe.clipping_offset = light_probe->clipsta;
|
||||
probe.resolution_percentage = 1.0f / float(1 << light_probe->resolution_scale);
|
||||
probe.is_probe_used = true;
|
||||
}
|
||||
Jeroen-Bakker marked this conversation as resolved
Outdated
|
||||
|
||||
@ -72,13 +73,15 @@ void PlanarProbeModule::set_view(const draw::View &main_view, int2 main_view_ext
|
||||
resources_.reinitialize(num_probes);
|
||||
}
|
||||
|
||||
int64_t resource_index = 0;
|
||||
/* TODO resolution percentage. */
|
||||
int2 extent = main_view_extent;
|
||||
|
||||
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_SHADER_READ;
|
||||
color_tx_.ensure_2d_array(GPU_R11F_G11F_B10F, extent, num_probes, usage);
|
||||
depth_tx_.ensure_2d_array(GPU_DEPTH_COMPONENT32F, extent, num_probes, usage);
|
||||
|
||||
int resource_index = 0;
|
||||
for (PlanarProbe &probe : probes_.values()) {
|
||||
/* TODO Cull out of view planars. */
|
||||
|
||||
/* TODO resolution percentage. */
|
||||
int2 extent = main_view_extent;
|
||||
|
||||
PlanarProbeResources &res = resources_[resource_index];
|
||||
|
||||
float4x4 winmat = main_view.winmat();
|
||||
@ -90,11 +93,8 @@ void PlanarProbeModule::set_view(const draw::View &main_view, int2 main_view_ext
|
||||
world_clip_buf_.plane = reflection_clip_plane_get(probe.plane_to_world, probe.clipping_offset);
|
||||
world_clip_buf_.push_update();
|
||||
|
||||
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_SHADER_READ;
|
||||
res.color_tx.ensure_2d(GPU_R11F_G11F_B10F, extent, usage);
|
||||
res.depth_tx.ensure_2d(GPU_DEPTH_COMPONENT32F, extent, usage);
|
||||
res.combined_fb.ensure(GPU_ATTACHMENT_TEXTURE(res.depth_tx),
|
||||
GPU_ATTACHMENT_TEXTURE(res.color_tx));
|
||||
res.combined_fb.ensure(GPU_ATTACHMENT_TEXTURE_LAYER(depth_tx_, resource_index),
|
||||
GPU_ATTACHMENT_TEXTURE_LAYER(color_tx_, resource_index));
|
||||
|
||||
instance_.pipelines.planar.render(res.view, res.combined_fb, main_view_extent);
|
||||
}
|
||||
|
@ -31,8 +31,6 @@ struct PlanarProbe {
|
||||
float4x4 world_to_plane;
|
||||
/* Offset to the clipping plane in the normal direction. */
|
||||
float clipping_offset;
|
||||
/* Percentage of the main resolution to render this planar probe at. */
|
||||
float resolution_percentage;
|
||||
/* Index in the resource array. */
|
||||
int resource_index;
|
||||
/* Pruning flag. */
|
||||
@ -40,8 +38,6 @@ struct PlanarProbe {
|
||||
};
|
||||
|
||||
struct PlanarProbeResources : NonCopyable {
|
||||
Texture color_tx = {"planar.color_tx"};
|
||||
Texture depth_tx = {"planar.depth_tx"};
|
||||
Framebuffer combined_fb = {"planar.combined_fb"};
|
||||
draw::View view = {"planar.view"};
|
||||
};
|
||||
@ -62,6 +58,9 @@ class PlanarProbeModule {
|
||||
PlanarProbes probes_;
|
||||
Resources resources_;
|
||||
|
||||
Texture color_tx_ = {"planar.color_tx"};
|
||||
Texture depth_tx_ = {"planar.depth_tx"};
|
||||
|
||||
ClipPlaneBuf world_clip_buf_ = {"world_clip_buf"};
|
||||
|
||||
bool update_probes_ = false;
|
||||
@ -76,7 +75,7 @@ class PlanarProbeModule {
|
||||
|
||||
void set_view(const draw::View &main_view, int2 main_view_extent);
|
||||
|
||||
template<typename T> void bind_resources(draw::detail::PassBase<T> *pass) {}
|
||||
template<typename T> void bind_resources(draw::detail::PassBase<T> * /*pass*/) {}
|
||||
|
||||
private:
|
||||
PlanarProbe &find_or_insert(ObjectHandle &ob_handle);
|
||||
|
Loading…
Reference in New Issue
Block a user
This shouldn't be a power of 2. But a screen percentage. Should be fine to change the meaning of it in the RNA for planar.
I added its own attribute, otherwise bpy API will get confusing.