diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2021-06-05 14:49:45 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2021-06-05 16:29:00 +0300 |
commit | 3caf7ba32de00a3c354a4a13dd078e790d056ebe (patch) | |
tree | 4face2b68c14eb1b697b981f40874fc8ff0c7ad5 /source/blender/draw/engines/eevee/eevee_instance.hh | |
parent | b3084d23bf719862866e4c558033595219090a42 (diff) |
EEVEE: Lookdev: Add back lighting support
This does not include reference spheres rendering.
The approach is a bit different than before.
Now we use a `bNodeTree` to control the rendering of lookdev. This
generates a `GPUMaterial` that is stored per `Instance`. This way
rendering lookdev is just updating the temp light cache using this
material as world material. Removing the use of custom shader.
This introduces a small hack in order to bind the studiolight hdri after
the nodetree glsl parsing.
The background display however is still using a custom shader in order
to sample the world cubemap with different roughness.
The view space option of the studiolight is now faster by using a
transform before shading instead of rebaking the lightprobe constantly.
This should not have any particular impact on render time.
Diffstat (limited to 'source/blender/draw/engines/eevee/eevee_instance.hh')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_instance.hh | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_instance.hh b/source/blender/draw/engines/eevee/eevee_instance.hh index 154928b1662..27aa69e8fcc 100644 --- a/source/blender/draw/engines/eevee/eevee_instance.hh +++ b/source/blender/draw/engines/eevee/eevee_instance.hh @@ -32,6 +32,7 @@ #include "eevee_id_map.hh" #include "eevee_light.hh" #include "eevee_lightprobe.hh" +#include "eevee_lookdev.hh" #include "eevee_material.hh" #include "eevee_motion_blur.hh" #include "eevee_renderpasses.hh" @@ -72,7 +73,7 @@ class Instance { SyncModule sync; MaterialModule materials; /** Lookdev own lightweight instance. May not be allocated. */ - // Lookdev *lookdev = nullptr; + LookDev lookdev; /** Input data. */ Depsgraph *depsgraph; @@ -109,7 +110,8 @@ class Instance { lightprobes(*this), shadows(*this), sync(*this), - materials(*this){}; + materials(*this), + lookdev(*this){}; ~Instance(){}; void init(const ivec2 &output_res, @@ -139,6 +141,24 @@ class Instance { return !DRW_state_is_scene_render(); } + bool use_scene_light(void) const + { + return (!v3d) || + ((v3d->shading.type == OB_MATERIAL) && + (v3d->shading.flag & V3D_SHADING_SCENE_LIGHTS)) || + ((v3d->shading.type == OB_RENDER) && + (v3d->shading.flag & V3D_SHADING_SCENE_LIGHTS_RENDER)); + } + + /* Do we light the scene using the HDRI setup in the viewport settings. */ + bool use_studio_light(void) const + { + return (v3d) && (((v3d->shading.type == OB_MATERIAL) && + ((v3d->shading.flag & V3D_SHADING_SCENE_WORLD) == 0)) || + ((v3d->shading.type == OB_RENDER) && + ((v3d->shading.flag & V3D_SHADING_SCENE_WORLD_RENDER) == 0))); + } + private: void render_sample(void); static void object_sync_render(void *instance_, |