BLEN-335: Export environment light #1

Merged
Bogdan Nagirniak merged 13 commits from BLEN-335 into hydra-render 2023-02-17 14:46:46 +01:00
Collaborator

Purpose

Add initial implementation of export environment light to hydra. Both color and images supported.

Technical steps

Added caching images.
Added new class WorldData.
How it works:

  1. find output node for word light;
  2. find linked node and read inputs;
  3. if color linked with image - cache image on disk;

Use with https://github.com/bnagirniak/RPRHydraRenderBlenderAddon/pull/6

### Purpose Add initial implementation of export environment light to hydra. Both color and images supported. ### Technical steps Added caching images. Added new class `WorldData`. How it works: 1. find output node for word light; 2. find linked node and read inputs; 3. if `color` linked with image - cache image on disk; Use with https://github.com/bnagirniak/RPRHydraRenderBlenderAddon/pull/6
Bogdan Nagirniak was assigned by Georgiy Markelov 2023-02-15 12:37:14 +01:00
Georgiy Markelov added 10 commits 2023-02-15 12:37:24 +01:00
Georgiy Markelov added 1 commit 2023-02-15 13:36:16 +01:00
Bogdan Nagirniak requested changes 2023-02-15 17:03:12 +01:00
@ -210,0 +238,4 @@
* W_000002074e812088 */
char str[32];
snprintf(str, 32, "W_%016llx", (uint64_t)b_context);
return GetDelegateID().AppendElementString(str);

return GetDelegateID().AppendElementString("World");

return GetDelegateID().AppendElementString("World");
BogdanNagirniak marked this conversation as resolved
@ -400,0 +454,4 @@
if (world_data.has_data(UsdLuxTokens->orientToStageUpAxis)) {
transform *= GfMatrix4d(GfRotation(GfVec3d(1.0, 0.0, 0.0), -90), GfVec3d());
}
if (index.GetRenderDelegate()->GetRendererDisplayName() == "RPR") {

add TODO comment like: implement this check via render settings

add TODO comment like: implement this check via render settings
BogdanNagirniak marked this conversation as resolved
@ -400,0 +458,4 @@
transform *= GfMatrix4d(GfRotation(GfVec3d(1.0, 0.0, 0.0), -180), GfVec3d());
transform *= GfMatrix4d(GfRotation(GfVec3d(0.0, 0.0, 1.0), 90.0), GfVec3d());
}
return transform;

move this to WorldData::transform()

move this to WorldData::transform()
BogdanNagirniak marked this conversation as resolved
@ -411,0 +471,4 @@
HdRenderIndex &index = GetRenderIndex();
if (index.GetSprim(HdPrimTypeTokens->domeLight, id)) {

else if (id == world_id()) {....}

else if (id == world_id()) {....}
BogdanNagirniak marked this conversation as resolved
@ -56,3 +60,4 @@
bool is_populated;
ObjectDataMap objects;
MaterialDataMap materials;
WorldData world_data;

make is as unique_ptr, implement add/remove world

make is as unique_ptr, implement add/remove world
BogdanNagirniak marked this conversation as resolved
@ -0,0 +35,4 @@
{
}
WorldData::WorldData(View3DShading *shading, World *world, BL::Context *b_context)

(World *world, bContext *context)

`(World *world, bContext *context)`
BogdanNagirniak marked this conversation as resolved
@ -0,0 +85,4 @@
}
void WorldData::set_as_world()
{

move to constructor

move to constructor
BogdanNagirniak marked this conversation as resolved
@ -0,0 +31,4 @@
template<class T>
const T &get_data(pxr::TfToken const &key);
bool has_data(pxr::TfToken const &key);
void update_world();

no need update_world() just recreate it in scene delegate

no need update_world() just recreate it in scene delegate
BogdanNagirniak marked this conversation as resolved
@ -0,0 +43,4 @@
void set_as_world();
void set_as_shading();
};

remove unused methods

remove unused methods
BogdanNagirniak marked this conversation as resolved
Georgiy Markelov added 1 commit 2023-02-16 13:08:43 +01:00
Georgiy Markelov requested review from Bogdan Nagirniak 2023-02-16 13:09:01 +01:00
Bogdan Nagirniak requested changes 2023-02-16 15:18:26 +01:00
@ -404,16 +461,27 @@ VtValue BlenderSceneDelegate::GetLightParamValue(SdfPath const& id, TfToken cons
{
LOG(INFO) << "GetLightParamValue: " << id.GetAsString() << " [" << key.GetString() << "]";
VtValue ret;
ObjectData *obj_data = object_data(id);

revert this block

revert this block
DagerD marked this conversation as resolved
@ -53,0 +61,4 @@
LOG(INFO) << "Add world: " << world_light_id;
if (!world) {
world_data.reset();

world_data = nullptr;

`world_data = nullptr;`
DagerD marked this conversation as resolved
@ -53,0 +62,4 @@
if (!world) {
world_data.reset();
GetRenderIndex().RemoveSprim(HdPrimTypeTokens->domeLight, world_light_id);

if (world_data) ...

if (world_data) ...
DagerD marked this conversation as resolved
@ -53,0 +67,4 @@
return;
}
world_data = make_unique<WorldData>(world, (bContext *)b_context->ptr.data);
if (!world_data) {
world_data = make_unique....
insertSprim
}
else {
world_data = make_unique....
changetracker
}
``` if (!world_data) { world_data = make_unique.... insertSprim } else { world_data = make_unique.... changetracker } ```
DagerD marked this conversation as resolved
@ -0,0 +91,4 @@
}
}
GfMatrix4d WorldData::transform(string renderer_name)

string const &

`string const &`
DagerD marked this conversation as resolved
@ -7,3 +15,4 @@
#include "utils.h"
using namespace pxr;

remove this

remove this
DagerD marked this conversation as resolved
@ -33,3 +42,3 @@
millisecs -= s;
if (neg)
ss << "-";
ss << "-";

add {...}

add {...}
DagerD marked this conversation as resolved
@ -49,0 +86,4 @@
BLI_path_join(tempfile, sizeof(tempfile), BKE_tempdir_session(), image_name.c_str());
STRNCPY(opts->filepath, tempfile);
if (BKE_image_save(reports, bmain, image, iuser, opts)) {

change to if (!BKE_image_save(...))

change to `if (!BKE_image_save(...))`
DagerD marked this conversation as resolved
Georgiy Markelov added 1 commit 2023-02-17 12:01:17 +01:00
Georgiy Markelov requested review from Bogdan Nagirniak 2023-02-17 12:01:23 +01:00
Bogdan Nagirniak merged commit df4c717f8e into hydra-render 2023-02-17 14:46:46 +01:00
Bogdan Nagirniak approved these changes 2023-02-17 14:46:56 +01:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
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#1
No description provided.