WIP Make shadows visible for Storm delegate #80

Closed
Vasyl Pidhirskyi wants to merge 16 commits from Vasyl-Pidhirskyi/blender_bn:BLEN-469 into hydra-render

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Collaborator

Purpose

Add support for shadows for Storm delegate.
image

Technical steps

Implemented shadow_task within light_tasks_delegate.
Added shadow_task to final and viewport engines.
Added use_storm_shadows to struct ShadingSettings.
Implemented ShadowMatrix class.
Adjusted CMakeLists.txt.
Set up shadow_params parameters for sunlight.

Notes for reviewers

At this point only Sun Light supports shadow.
Should be verified with BogdanNagirniak/blender-addons#26

### Purpose Add support for shadows for Storm delegate. ![image](/attachments/dd51b6f3-03a3-487b-baba-140732b40c93) ### Technical steps Implemented shadow_task within light_tasks_delegate. Added shadow_task to final and viewport engines. Added use_storm_shadows to struct ShadingSettings. Implemented ShadowMatrix class. Adjusted CMakeLists.txt. Set up shadow_params parameters for sunlight. ### Notes for reviewers At this point only Sun Light supports shadow. Should be verified with https://projects.blender.org/BogdanNagirniak/blender-addons/pulls/26
1.9 MiB
Vasyl Pidhirskyi added 2 commits 2023-07-28 15:31:45 +02:00
Added shadow_task to final and viewport engines.
Added use_storm_shadows to struct ShadingSettings.
Adjusted CMakeLists.txt.
Setup shadowParams_ parameters for sunlight.
Vasyl Pidhirskyi requested review from Brian Savery (AMD) 2023-07-28 15:32:46 +02:00
Vasyl Pidhirskyi requested review from Georgiy Markelov 2023-07-28 15:32:46 +02:00
Brian Savery (AMD) was assigned by Vasyl Pidhirskyi 2023-07-28 15:32:57 +02:00
Georgiy Markelov was assigned by Vasyl Pidhirskyi 2023-07-28 15:32:58 +02:00
Bogdan Nagirniak was assigned by Vasyl Pidhirskyi 2023-07-28 15:32:58 +02:00
Vasyl Pidhirskyi self-assigned this 2023-07-28 15:32:58 +02:00
Vasyl Pidhirskyi added 2 commits 2023-07-28 15:45:13 +02:00
Vasyl Pidhirskyi added 3 commits 2023-07-31 22:23:19 +02:00
### Purpose
After refactoring PRs there are render issues such as crash with RPR delegate in viewport.

### Technical steps
1. Moved binding of framebuffer and VAO to `GPURenderTaskDelegate` and use it in Viewport render.
2. Made more correct viewport render for Storm delegate by rendering it to separate framebuffer.

Pull Request #79
### Purpose
Support more AOVs

### Technical steps
Python:
* added empty `def update_render_passes` in base class (Must be overridden in child classes)

C++:
* improved code to utilize supported AOVs
* Added logging to tasks

### Note for reviewers
Use with:
HdRPR: https://github.com/bnagirniak/RPRHydraRenderBlenderAddon/pull/22/files
HdStorm: https://projects.blender.org/BogdanNagirniak/blender-addons#23

Pull Request #78
Vasyl Pidhirskyi changed title from WIP Make shadows visible for Storm delegate to WIP Make shadows visible for Storm delegate 2023-07-31 22:26:16 +02:00
Vasyl Pidhirskyi changed target branch from hydra-refactor-fixes to hydra-render 2023-07-31 22:26:17 +02:00
Bogdan Nagirniak requested changes 2023-08-01 14:15:27 +02:00
@ -44,6 +44,7 @@ class HydraSceneDelegate : public pxr::HdSceneDelegate {
std::string studiolight_name;
float studiolight_rotation;
float studiolight_intensity;
bool use_storm_shadows = false;

This parameter not needed, instead create function like HydraSceneDelegate::has_shadows()

This parameter not needed, instead create function like `HydraSceneDelegate::has_shadows()`
Vasyl-Pidhirskyi marked this conversation as resolved
@ -95,0 +100,4 @@
bool use_shadow = (light->mode & LA_SHADOW) && light->type == LA_SUN;
scene_delegate_->shading_settings.use_storm_shadows |= use_shadow;
if (use_shadow) {
data_[pxr::HdLightTokens->hasShadow] = use_shadow;

move this outside if

move this outside `if`
Vasyl-Pidhirskyi marked this conversation as resolved
@ -95,0 +101,4 @@
scene_delegate_->shading_settings.use_storm_shadows |= use_shadow;
if (use_shadow) {
data_[pxr::HdLightTokens->hasShadow] = use_shadow;
pxr::HdxShadowParams shadowParams_ = pxr::HdxShadowParams();

rename shadow_params

rename `shadow_params`
Vasyl-Pidhirskyi marked this conversation as resolved
@ -95,0 +123,4 @@
data_[pxr::HdLightTokens->shadowParams] = shadowParams_;
data_[pxr::HdLightTokens->shadowCollection] = pxr::HdRprimCollection(
pxr::HdTokens->geometry, pxr::HdReprSelector(pxr::HdReprTokens->refined));
}

Move whole block to write_shadow_params()

Move whole block to `write_shadow_params()`
Vasyl-Pidhirskyi marked this conversation as resolved
@ -0,0 +5,4 @@
namespace blender::io::hydra {
class ShadowMatrix : public pxr::HdxShadowMatrixComputation {

Move whole class to light.cc

Move whole class to light.cc
Vasyl-Pidhirskyi marked this conversation as resolved
@ -0,0 +19,4 @@
return {_shadowMatrix};
}
std::vector<pxr::GfMatrix4d> Compute(const pxr::CameraUtilFraming &framing,

add override to both Compute functions

add `override` to both Compute functions
Vasyl-Pidhirskyi marked this conversation as resolved
@ -0,0 +25,4 @@
return {_shadowMatrix};
}
void SetNearFar(const float &near_dist, const float &far_dist)

void set_near_far(const float near_dist, const float far_dist)

`void set_near_far(const float near_dist, const float far_dist)`
Vasyl-Pidhirskyi marked this conversation as resolved
@ -0,0 +35,4 @@
_frustum.Transform(transform);
}
void SetWindow(const double &x, const double &y)

void set_window(const float x, const float y)

`void set_window(const float x, const float y)`
Vasyl-Pidhirskyi marked this conversation as resolved
@ -0,0 +42,4 @@
void CalculateMatrix()
{
_shadowMatrix = _frustum.ComputeViewMatrix() * _frustum.ComputeProjectionMatrix();

Move to Compute, no need _shadowMatrix

Move to `Compute`, no need `_shadowMatrix`
Vasyl-Pidhirskyi marked this conversation as resolved
Vasyl Pidhirskyi added 3 commits 2023-08-01 20:21:01 +02:00
Vasyl Pidhirskyi added 1 commit 2023-08-01 20:43:14 +02:00
Vasyl Pidhirskyi added 1 commit 2023-08-02 09:44:06 +02:00
Vasyl Pidhirskyi added 1 commit 2023-08-02 09:47:13 +02:00
Vasyl Pidhirskyi changed title from WIP Make shadows visible for Storm delegate to Make shadows visible for Storm delegate 2023-08-02 09:47:29 +02:00
Vasyl Pidhirskyi requested review from Bogdan Nagirniak 2023-08-02 10:06:56 +02:00
Vasyl Pidhirskyi added 1 commit 2023-08-02 11:04:51 +02:00
Vasyl Pidhirskyi added 1 commit 2023-08-02 11:10:53 +02:00
Bogdan Nagirniak changed title from Make shadows visible for Storm delegate to WIP Make shadows visible for Storm delegate 2023-08-02 17:44:16 +02:00

Closing as we aren't working on this right now

Closing as we aren't working on this right now
Bogdan Nagirniak closed this pull request 2023-09-06 08:28:44 +02:00

Pull request closed

Sign in to join this conversation.
No Label
No Milestone
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: BogdanNagirniak/blender#80
No description provided.