occlusion culling multiple camera fixes
This commit is contained in:
@@ -15,6 +15,7 @@ void CameraPreview::RenderPreview()
|
||||
renderpath.camera = camera;
|
||||
scale_local.y = scale_local.x * renderpath.camera->height / renderpath.camera->width;
|
||||
renderpath.setSceneUpdateEnabled(false); // we just view our scene with this that's updated by the main rernderpath
|
||||
renderpath.setOcclusionCullingEnabled(false); // occlusion culling only works for one camera
|
||||
renderpath.PreUpdate();
|
||||
renderpath.Update(0);
|
||||
renderpath.PostUpdate();
|
||||
|
||||
@@ -364,6 +364,10 @@ namespace wi
|
||||
visibility_main.scene = scene;
|
||||
visibility_main.camera = camera;
|
||||
visibility_main.flags = wi::renderer::Visibility::ALLOW_EVERYTHING;
|
||||
if (!getOcclusionCullingEnabled())
|
||||
{
|
||||
visibility_main.flags &= ~wi::renderer::Visibility::ALLOW_OCCLUSION_CULLING;
|
||||
}
|
||||
wi::renderer::UpdateVisibility(visibility_main);
|
||||
|
||||
if (visibility_main.planar_reflection_visible)
|
||||
@@ -803,7 +807,7 @@ namespace wi
|
||||
wi::renderer::DRAWSCENE_TESSELLATION |
|
||||
wi::renderer::DRAWSCENE_OCCLUSIONCULLING |
|
||||
wi::renderer::DRAWSCENE_MAINCAMERA
|
||||
;
|
||||
;
|
||||
|
||||
// Main camera depth prepass + occlusion culling:
|
||||
cmd = device->BeginCommandList();
|
||||
@@ -819,7 +823,10 @@ namespace wi
|
||||
cmd
|
||||
);
|
||||
|
||||
wi::renderer::OcclusionCulling_Reset(visibility_main, cmd); // must be outside renderpass!
|
||||
if (getOcclusionCullingEnabled())
|
||||
{
|
||||
wi::renderer::OcclusionCulling_Reset(visibility_main, cmd); // must be outside renderpass!
|
||||
}
|
||||
|
||||
wi::renderer::RefreshImpostors(*scene, cmd);
|
||||
|
||||
@@ -886,7 +893,10 @@ namespace wi
|
||||
|
||||
device->RenderPassEnd(cmd);
|
||||
|
||||
wi::renderer::OcclusionCulling_Resolve(visibility_main, cmd); // must be outside renderpass!
|
||||
if (getOcclusionCullingEnabled())
|
||||
{
|
||||
wi::renderer::OcclusionCulling_Resolve(visibility_main, cmd); // must be outside renderpass!
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -1871,9 +1881,8 @@ namespace wi
|
||||
RENDERPASS_MAIN,
|
||||
cmd,
|
||||
wi::renderer::DRAWSCENE_TRANSPARENT |
|
||||
wi::renderer::DRAWSCENE_OCCLUSIONCULLING |
|
||||
wi::renderer::DRAWSCENE_HAIRPARTICLE |
|
||||
wi::renderer::DRAWSCENE_TESSELLATION |
|
||||
wi::renderer::DRAWSCENE_OCCLUSIONCULLING |
|
||||
wi::renderer::DRAWSCENE_OCEAN |
|
||||
wi::renderer::DRAWSCENE_MAINCAMERA
|
||||
);
|
||||
|
||||
@@ -3084,8 +3084,13 @@ void UpdateVisibility(Visibility& vis)
|
||||
|
||||
const ObjectComponent& object = vis.scene->objects[args.jobIndex];
|
||||
Scene::OcclusionResult& occlusion_result = vis.scene->occlusion_results_objects[args.jobIndex];
|
||||
bool occluded = false;
|
||||
if (vis.flags & Visibility::ALLOW_OCCLUSION_CULLING)
|
||||
{
|
||||
occluded = occlusion_result.IsOccluded();
|
||||
}
|
||||
|
||||
if ((vis.flags & Visibility::ALLOW_REQUEST_REFLECTION) && object.IsRequestPlanarReflection() && !occlusion_result.IsOccluded())
|
||||
if ((vis.flags & Visibility::ALLOW_REQUEST_REFLECTION) && object.IsRequestPlanarReflection() && !occluded)
|
||||
{
|
||||
// Planar reflection priority request:
|
||||
float dist = wi::math::DistanceEstimated(vis.camera->Eye, object.center);
|
||||
@@ -4650,7 +4655,12 @@ void UpdateRenderDataAsync(
|
||||
// Compute water simulation:
|
||||
if (vis.scene->weather.IsOceanEnabled())
|
||||
{
|
||||
if (!GetOcclusionCullingEnabled() || !vis.scene->ocean.IsOccluded())
|
||||
bool occluded = false;
|
||||
if (vis.flags & Visibility::ALLOW_OCCLUSION_CULLING)
|
||||
{
|
||||
occluded = vis.scene->ocean.IsOccluded();
|
||||
}
|
||||
if (!occluded)
|
||||
{
|
||||
auto range = wi::profiler::BeginRangeGPU("Ocean - Simulate", cmd);
|
||||
vis.scene->ocean.UpdateDisplacementMap(vis.scene->weather.oceanParameters, cmd);
|
||||
@@ -6020,7 +6030,7 @@ void DrawScene(
|
||||
const bool transparent = flags & DRAWSCENE_TRANSPARENT;
|
||||
const bool hairparticle = flags & DRAWSCENE_HAIRPARTICLE;
|
||||
const bool impostor = flags & DRAWSCENE_IMPOSTOR;
|
||||
const bool occlusion = (flags & DRAWSCENE_OCCLUSIONCULLING) && GetOcclusionCullingEnabled();
|
||||
const bool occlusion = (flags & DRAWSCENE_OCCLUSIONCULLING) && (vis.flags & Visibility::ALLOW_OCCLUSION_CULLING) && GetOcclusionCullingEnabled();
|
||||
const bool ocean = flags & DRAWSCENE_OCEAN;
|
||||
const bool skip_planar_reflection_objects = flags & DRAWSCENE_SKIP_PLANAR_REFLECTION_OBJECTS;
|
||||
const bool foreground_only = flags & DRAWSCENE_FOREGROUND_ONLY;
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace wi::version
|
||||
// minor features, major updates, breaking compatibility changes
|
||||
const int minor = 71;
|
||||
// minor bug fixes, alterations, refactors, updates
|
||||
const int revision = 374;
|
||||
const int revision = 375;
|
||||
|
||||
const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user