EEVEE Next: Tag shadowmap usage for transparent object volumes #104580
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
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
EEVEE & Viewport
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
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
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
EEVEE & Viewport
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
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
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#104580
Loading…
Reference in New Issue
No description provided.
Delete Branch "pragma37/blender:pull-eevee-shadows-tag-usage-transparent"
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?
Render the transparent object bounds to a low-res frame-buffer and ray-march the bounds volume, tagging tiles along the way.
I think the debug code is confusing and not isolated. Might be better to remove it. We don't need that in production (I mean the cost of having a separate framebuffer + clear etc...), you can just use an empty framebuffer for that.
It came to my mind that we also need to raster one pixel outside the frustum. Otherwise we could miss tagging pages that are between the center of the texel and the border.
One way would be to do the raycast 2 to 4 times (for the corners) for these border pixels.
I do think we can use a much coarser LOD. I think LOD 4 (16px stride) or 5 (32px stride) would be nicer. This needs to be somewhat adjusted to the mean screenspace tile size (which is quite hard to figure out). Too big and you might skip over some tiles.
Note that the LOD selection (not in this patch) will need to take into account not only the step size but also the spacing between the fragments.
@ -16,0 +58,4 @@
float near_box_t = distance(ws_near_plane, ws_near_box);
float far_box_t = distance(ws_near_plane, interp.P);
/* Depth test. */
far_box_t = min(far_box_t, distance(ws_near_plane, ws_opaque));
Be conservative in Z too. Bias
far_box_t
by step_size to have one more iteration before and after.This is for the same issue as the full 1px inflate.
@ -16,0 +78,4 @@
vec3 P = ws_near_plane + (ws_view_direction * t);
vec3 vP = vs_near_plane + (vs_view_direction * t);
/* TODO (Miguel Pozo): Pass step size to ensure conservative enough LOD selection */
shadow_tag_usage(vP, P, gl_FragCoord.xy * pow(2, fb_lod));
Use
exp2
instead ofpow(2, x)
. Try to apply this everywhere.@ -10,0 +19,4 @@
if (is_persp) {
inflate_scale *= -vP.z;
}
inflate_scale *= 0.5f; /* Half pixel. */
I think we need a fullpixel here.
Imagine a really tiny box.
A tile map boundary cannot be mitigated by tagging a lower LOD selection.
Inflating a whole pixel:
@ -10,0 +23,4 @@
vec3 vs_inflate_vector = normal_object_to_view(sign(lP - ls_center));
vs_inflate_vector.z = 0;
vs_inflate_vector /= max_v2(abs(vs_inflate_vector));
This only works because
max_v2
is a define. Usevs_inflate_vector.xy
to avoid the confusion.Also not entierly sure what's this about. Can you add a comment on this?
@ -14,0 +63,4 @@
}
#ifdef DEBUG_CONSERVATIVE_RASTERIZATION
interp.ls_aabb_min = point_world_to_object(ws_aabb_min);
Im' not sure why you are changing that for the debug visuals.
Because to debug the conservative rasterization I raycast against the original aabb in the fragment shader. If there's no hit, then it's a "conservatively rasterized" pixel.
If we keep the debugging visualizations that will have to be sent through its own varying.
1683255827
to02cc1bcdfa
I think the decission to take is whether we want/need to have debugging visualizations for this, at least for now.
If we do, then the code must be cleaned up and ensure the non-debugging path doesn't do anything unnecesary. Otherwise it can be deleted.
But I don't think we should decide whether to keep it or not based on the current (hacky and WIP) quality of the code.
I've tried to use LOD5 and the tagging breaks.
It seems to be related to the step sizes, not to the conservative rasterization. 🤔
18f7a4aeb8
to241978b13e
The
TODO (Miguel Pozo)
comments should be removed or solved. A bit more documentation is needed to for such algorithm.Functionality wise, it works.
@ -18,0 +25,4 @@
}
void shadow_tag_usage_tilemap_directional(
uint l_idx, vec3 P, vec3 V, float dist_to_cam, float radius)
dist_to_cam
is not used.@ -89,3 +148,3 @@
}
void shadow_tag_usage(vec3 vP, vec3 P, vec2 pixel)
void shadow_tag_usage(vec3 vP, vec3 P, vec3 V, float radius, float dist_to_cam, vec2 pixel)
Document the parameters of this functions. This should be enough to explain the need for radius.
@ -176,0 +174,4 @@
ShadowCoordinates shadow_directional_coordinates(LightData light, vec3 lP)
{
/* TODO (Miguel Pozo): This is somewhat confusing, lP is used for P in light space, but also for
* P in light oriented world space ? */
Well,
light oriented world space
is the light local space for directional. This is because they are considered always at the origin. Maybe this should be added somewhere.Could you confirm if this is correct?
29d79d2210
Not quite.
lP
here is shading point relative to the shadow origin in light space.light._position
isn't the actual position of the light in world space but the offset in light space to the shadow center, which is chosen by using the view near plane center point projected to the tile space of the shadow.So
lP
is still a position and it is still in light local space but it hasn't the same origin.Ok, so the original
lP shading point position in light space (world unit) and translated to camera position snapped to smallest clipmap level.
comment was correct, but it should be inshadow_directional_level
instead ofshadow_directional_coordinates
.241978b13e
to29d79d2210
WIP: EEVEE Next: Tag shadowmap usage for transparent object volumesto EEVEE Next: Tag shadowmap usage for transparent object volumes@ -102,0 +102,4 @@
* This function should be the inverse of ShadowDirectional::coverage_get().
*
* \a lP shading point position in light space relative to the view position
* (shadow_world_to_local - light._position).
This is confusing since
shadow_world_to_local
is a function. Also put backticks ` around code inside comments.