EEVEE Next: Ambient Occlusion #108398
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#108398
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "pragma37/blender:pull-eevee-next-ao"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Port Ambient Occlusion to EEVEE Next.
Only the AO pass and the AO node work at the moment. Regular shading AO requires IBL.
f5ab001261
to1d60aced03
@ -0,0 +49,4 @@
}
data_.distance = scene->eevee.gtao_distance;
data_.factor = std::max(1e-4f, scene->eevee.gtao_factor);
Remove that. We don't want that in the new implementation. Same for the UI parameter and the code.
This was a NPR parameter that was ported from the old AO implementation and has no meaning in the PBR world. It is a hindrance to a better PBR integration of the AO.
@ -0,0 +51,4 @@
data_.distance = scene->eevee.gtao_distance;
data_.factor = std::max(1e-4f, scene->eevee.gtao_factor);
data_.quality = scene->eevee.gtao_quality;
data_.use_bent_normals = scene->eevee.flag & SCE_EEVEE_GTAO_BENT_NORMALS;
Remove also that parameter. Bent normals will be used by default.
@ -0,0 +52,4 @@
data_.factor = std::max(1e-4f, scene->eevee.gtao_factor);
data_.quality = scene->eevee.gtao_quality;
data_.use_bent_normals = scene->eevee.flag & SCE_EEVEE_GTAO_BENT_NORMALS;
data_.bounce_factor = (scene->eevee.flag & SCE_EEVEE_GTAO_BOUNCE) ? 1.0f : 0.0f;
Also remove.
_ao_
files toambient_occlusion
.horizons
>horizon
.eevee_ao_lib.glsl
have theambient_occlusion_
prefix.@ -148,0 +157,4 @@
def draw_header(self, context):
scene = context.scene
props = scene.eevee
self.layout.prop(props, "use_gtao", text="")
Do not make it optional. Always enable it if render pass is needed. It might become a core part of the raytracing module.
It already works that way. See
AmbientOcclusion::init
.Do you want to always enable it for the main shading too?
I think some users wouldn’t like that.
Kind of. If it has to be an option it would be elsewhere.
@ -0,0 +63,4 @@
return;
}
horizons_search_ps_.init();
I'm almost tempted to remove this pass altogether. It might just become a subpass of the raytracing pipeline.
@ -243,0 +248,4 @@
ELEM(pipeline_type, MAT_PIPE_FORWARD, MAT_PIPE_DEFERRED) &&
ELEM(geometry_type, MAT_GEOM_MESH, MAT_GEOM_CURVES))
{
info.define("MAT_AO");
no abreviation here too
MAT_AMBIENT_OCCLUSION
@ -889,0 +912,4 @@
/** \name Ambient Occlussion
* \{ */
struct AOData {
Do not use AO as abreviation in either typenames or members name.
@ -0,0 +4,4 @@
#pragma BLENDER_REQUIRE(eevee_sampling_lib.glsl)
#pragma BLENDER_REQUIRE(eevee_raytrace_lib.glsl)
/* TODO(Miguel Pozo): Move somewhere else. */
It is unclear what this TODO is referring to: a specific function, or the whole file?
@ -0,0 +25,4 @@
* http://blog.selfshadow.com/publications/s2016-shading-course/activision/s2016_pbs_activision_occlusion.pptx
*/
#define NO_OCCLUSION_DATA OcclusionData(vec4(M_PI, -M_PI, M_PI, -M_PI), 1.0)
Prefer a function that returns an empty occlusion data.
@ -0,0 +38,4 @@
#ifdef GPU_METAL
/* Constructors required for OcclusionData(..) syntax. */
inline OcclusionData() = default;
inline OcclusionData(vec4 in_horizons, float in_custom_occlusion)
Remove these and prefer individual member assignment.
@ -0,0 +397,4 @@
/* Visibility to cone angle (eq. 18). */
float vis_angle = fast_acos(sqrt(1 - visibility));
/* Roughness to cone angle (eq. 26). */
float spec_angle = max(0.00990998744964599609375, fast_acos(cone_cosine(roughness)));
Declare the constant before this line and add a comment that this fixes a NaN issue on some Intel GPU (add link to original issue).
What's the original issue?
I don't see any recent change in the current EEVEE implementation or any related open issue.
https://archive.blender.org/developer/D12508
I got it the other way around.
I thought moving it to a separate const WAS the fix.
@ -0,0 +78,4 @@
vec3 Ng = transform_direction(ViewMatrixInverse, vNg);
vec3 N = imageLoad(in_normal_img, texel).xyz;
// OcclusionData data = unpack_occlusion_data(texelFetch(horizons_tx, texel, 0));
Remove commented code without purpose.
@ -88,3 +89,3 @@
imageStore(rp_value_img, ivec3(texel, rp_buf.shadow_id), vec4(shadow));
}
/* TODO: AO. */
/** NOTE: AO is done on its own pass. */
Remove the comment.
Why specifically on this one?
It's in the other shaders that write to the renderpasses too.
I think it makes sense to mention why AO is omitted.
@ -10,6 +10,7 @@
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
#pragma BLENDER_REQUIRE(common_math_lib.glsl)
#pragma BLENDER_REQUIRE(common_hair_lib.glsl)
#pragma BLENDER_REQUIRE(eevee_ao_lib.glsl)
Why is this needed?
Because the AO lib is required by the AO node in the nodetree lib.
But I can’t include the AO lib directly from the nodetree lib since then it ends up also in the depth, shadow and world passes.
AFAIK there’s no way to make a conditional BLENDER_REQUIRE, so the other option would be to put the whole AO lib behind a define (which would be kind of annoying in most code editors).
The AO lib depends on the raytracing lib, which depends on its own buffer parameters.
We can make it self-contained, but it would require duplicating the screen space ray creation code.
Related to this, I think we could re-evaluate the way uniform buffers are used in EEVEE Next.
There are many small ones that could be easily merged, and their management would become simpler.
There's also some data that is useful in general, like the render extent or the pixel size.
I would like to avoid this.
One lib file for common structures (here
eevee_ray_types_lib.glsl
for the ray init).One specific file for each effect that need specific resources:
eevee_ray_screen_trace_lib.glsl
(not to include in this PR),eevee_ambient_occlusion_trace_lib.glsl
.This way you can include one without having to add much of other resource dependencies.
The design is like this. Everything should be granular and well contained. When an effect depends on a shared module, it should be a simple dependency addition in a few places.
Render extent should usually be queried by some fullscreen buffer
textureSize(tx, 0).xy
and pixel size by inversing it.@ -0,0 +49,4 @@
template<typename T> void bind_resources(draw::detail::PassBase<T> *pass)
{
inst_.sampling.bind_resources(pass);
Do not bind other resources here. Will result in double binds and it is against the design of this function.
@ -0,0 +188,4 @@
return hit;
}
#if 0
Just remove the code. Dead code lying around is not good.
Also the F12 Ambient Occlusion render pass doesn't work. It doesn't show in the render passes.
I know it's intended, and I see the advantage for initializing the data.
But on the GPU side, it adds a lot of busy work for managing many small buffers that in practice are used in pretty much the same passes.
Anyway, I addressed all the feedback.
I fixed the F12 rendering for Shadows too, although It may have made more sense as a separate PR.
Note that you need have to change the UBO slot in
eevee_defines
as I made some changes there yesterday.Now slot 0 is reserved for nodetree and slots 0-6 are reserved for engine use.
WIP: EEVEE Next: Ambient Occlusionto EEVEE Next: Ambient Occlusion