Eevee-Next: World Reflective Light #108149
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#108149
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "Jeroen-Bakker/blender:eevee-next-world-shader"
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?
This PR adds world probe baking to Eevee-next. The world is baked to a
cubemap and is used for reflective light in the deferred render pass.
The world probe is baked to a resolution of 2048x2048. In the future this
would become a user facing setting, but wasn't considered essential for
the first implementation.
When updating the world cubemap the world surface shader is reused.
Currently the world surface shader clears many render passes. It was
decided to replace the render passes with dummy textures as the effort
and potential slowdown didn't weigh against the benefit of doing this nicely.
Updating the world reflection probe isn't expected to happen often.
A big difference with Eevee(-legacy) is that the roughness GGX reflection
parameter isn't baked into the texture (as mipmap levels), but is calculated
during shading. This improves accuracy as we don't assume that every
object is an infinitive small sphere. The result has more noise and that
will be tackled after SSR will land.
@ -0,0 +30,4 @@
class Instance;
/* -------------------------------------------------------------------- */
/** \name Cryptomatte
👎
@ -0,0 +50,4 @@
class CubemapsModule {
private:
/** The max number of cubemaps to track. */
static constexpr int MaxCubemaps = 1;
Codestyle!
@ -65,0 +95,4 @@
side.cubemap_face_ps.framebuffer_set(&side.cubemap_face_fb);
side.cubemap_face_ps.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_ALWAYS);
side.cubemap_face_ps.material_set(manager, gpumat);
Currently reuses previous resources, as the last one would be the world background pass this kinda works. But should be fixed.
@ -0,0 +52,4 @@
}
/* -------------------------------------------------------------------- */
/** \name World
Reflection Probe
@ -46,0 +55,4 @@
struct CubemapSide {
PassSimple cubemap_face_ps;
View view;
Use a single View instance and fill with different view ids.
As far as I have seen this requires other changes.
transform_point
andinvert
14973fabe67d435f0eaa
to773c58ba3c
WIP: Eevee-Next: World Lightingto Eevee-Next: World Lightingf6b871b57a
toe3608d689d
@ -0,0 +1,16 @@
void light_world_eval(ClosureDiffuse diffuse,
Do we also need to update out_diffuse
Miguel Pozo referenced this pull request2023-05-29 20:06:24 +02:00
Eevee-Next: World Lightingto Eevee-Next: World Reflective Light@ -96,6 +96,7 @@
/* Only during shadow rendering. */
#define SHADOW_RENDER_MAP_SLOT 13
#define RBUFS_UTILITY_TEX_SLOT 14
#define REFLECTION_PROBE_TEX_SLOT 16
We should not bind on numbers higher than 15. As more changes do this we should check on the best solution. @fclem looking at open PR we need 4 new slots (SSS, Reflection Probes, Global Illumination).
e52410f3d8
to845406721f
@ -0,0 +7,4 @@
float lod = linear_roughness * lod_cube_max;
vec3 R = -reflect(V, reflection.N);
vec3 world_light = textureLod_cubemapArray(reflectionProbes, vec4(R, 0.0), lod).rgb;
Check
lightprobe_filter_glossy_frag
I'm unsure about having a dedicated
ReflectionProbeModule
when we haveLightProbeModule
which does kind of the same thing (detecting updates and deletion). What was the incentive for adding another one? (maybe I told you so, if that's the reason, I'm sorry.) Maybe it was because the IrradianceCache patch wasn't merged yet.@ -59,0 +74,4 @@
side.cubemap_face_ps.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_ALWAYS);
}
const int2 extent(1);
constexpr eGPUTextureUsage usage = GPU_TEXTURE_USAGE_MEMORYLESS | GPU_TEXTURE_USAGE_SHADER_WRITE;
Can we use GPU_TEXTURE_USAGE_MEMORYLESS with GPU_TEXTURE_USAGE_SHADER_WRITE here? sounds like potential issue.
@ -46,0 +53,4 @@
private:
Instance &inst_;
Texture dummy_renderpass_tx_;
Add comment saying these are required in order to reuse the background shader and avoid another shader variation.
@ -46,0 +58,4 @@
Texture dummy_aov_color_tx_;
Texture dummy_aov_value_tx_;
struct CubemapSide {
This struct shouldn't be contained by the pipeline. The pipeline should only contain the pass and be view agnostic.
So you should only have one pass that is being drawn for the 6 views.
@ -46,0 +83,4 @@
public:
WorldProbePipeline(Instance &inst) : inst_(inst){};
void sync();
You shouldn't have 3
sync
functions. Kind of related to my other comments: Prefer syncing one view agnostic render pass and always sync it fromWorld::sync()
.@ -288,6 +338,7 @@ class UtilityTexture : public Texture {
class PipelineModule {
public:
WorldPipeline world;
Maybe we could rename this to BackgroundPipeline and use WorldPipeline for world rendering. Could do that in another PR.
I did the change in #109495
@ -0,0 +43,4 @@
{
if (cubemap.type == ReflectionProbe::Type::World) {
GPUMaterial *world_material = instance_.world.get_world_material();
instance_.pipelines.world_probe.sync(world_material);
Prefer always syncing it inside
World::sync()
just like the other world pipeline is doinginst_.pipelines.world.sync(gpumat);
.@ -0,0 +35,4 @@
* \{ */
class ReflectionProbe {
public:
enum Type { Unused, World };
Style: Uppercase enum members.
@ -0,0 +46,4 @@
class ReflectionProbeModule {
private:
/** The max number of probes to track. */
static constexpr int MAX_PROBES = 1;
Style: No uppercase
@ -0,0 +53,4 @@
*
* Must be a power of two; intension to be used as a cubemap atlas.
*/
static constexpr int MAX_RESOLUTION = 2048;
I don't know if this is covered by the next patch, but this should become an option.
Yes, that will be part of the reflection probe baking patch. Might even land earlier when specific parts of that patch are stable. Currently this part isn't stable to land in main yet.
@ -0,0 +54,4 @@
* Must be a power of two; intension to be used as a cubemap atlas.
*/
static constexpr int MAX_RESOLUTION = 2048;
static constexpr int MIPMAP_LEVELS = 12;
Maybe derive it from
MAX_RESOLUTION
?log2(MAX_RESOLUTION) + 1
@ -194,0 +195,4 @@
void CaptureView::render()
{
if (!world_capture_enable_) {
Replace by
inst_.reflection_probes.do_world_update
.@ -194,0 +210,4 @@
float4x4 view_m4 = cubeface_mat(face);
float4x4 win_m4;
cubeface_winmat_get(win_m4, 1.0f, 10.0f);
use
math::projection::perspective()