forked from blender/blender
Fix rendering of Final render for Storm delegate #61
@ -246,13 +246,13 @@ void FinalEngineGL::render1(Depsgraph *depsgraph)
|
|||||||
{
|
{
|
||||||
prepare_for_render(depsgraph);
|
prepare_for_render(depsgraph);
|
||||||
|
|
||||||
//pxr::TraceCollector::GetInstance().SetEnabled(true);
|
// pxr::TraceCollector::GetInstance().SetEnabled(true);
|
||||||
|
|
||||||
auto d = pxr::GlfDrawTarget::New(resolution_);
|
auto d = pxr::GlfDrawTarget::New(resolution_);
|
||||||
d->Bind();
|
d->Bind();
|
||||||
d->AddAttachment("color", GL_RGBA, GL_FLOAT, GL_RGBA);
|
d->AddAttachment("color", GL_RGBA, GL_FLOAT, GL_RGBA);
|
||||||
engine_->Execute(render_index_.get(), &tasks_);
|
engine_->Execute(render_index_.get(), &tasks_);
|
||||||
//d->Unbind();
|
// d->Unbind();
|
||||||
|
|
||||||
std::vector<float> &pixels = render_images_["Combined"];
|
std::vector<float> &pixels = render_images_["Combined"];
|
||||||
char elapsed_time[32];
|
char elapsed_time[32];
|
||||||
@ -281,8 +281,8 @@ void FinalEngineGL::render1(Depsgraph *depsgraph)
|
|||||||
|
|
||||||
GLuint rendered_texture;
|
GLuint rendered_texture;
|
||||||
|
|
||||||
//glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_FLOAT, pixels.data());
|
// glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_FLOAT, pixels.data());
|
||||||
//update_render_result();
|
// update_render_result();
|
||||||
pxr::TraceCollector::GetInstance().SetEnabled(false);
|
pxr::TraceCollector::GetInstance().SetEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ bool BlenderSceneDelegate::GetDoubleSided(pxr::SdfPath const &id)
|
|||||||
pxr::HdCullStyle BlenderSceneDelegate::GetCullStyle(pxr::SdfPath const &id)
|
pxr::HdCullStyle BlenderSceneDelegate::GetCullStyle(pxr::SdfPath const &id)
|
||||||
{
|
{
|
||||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s", id.GetText());
|
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s", id.GetText());
|
||||||
return mesh_data(id)->cull_style;
|
return mesh_data(id)->cull_style(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
pxr::SdfPath BlenderSceneDelegate::GetInstancerId(pxr::SdfPath const &prim_id)
|
pxr::SdfPath BlenderSceneDelegate::GetInstancerId(pxr::SdfPath const &prim_id)
|
||||||
|
@ -45,7 +45,7 @@ static std::string cache_image_file(Image *image,
|
|||||||
BKE_image_path_ext_from_imformat(&scene->r.im_format, &r_ext);
|
BKE_image_path_ext_from_imformat(&scene->r.im_format, &r_ext);
|
||||||
opts.im_format = scene->r.im_format;
|
opts.im_format = scene->r.im_format;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(file_name, sizeof(file_name), "img_%016llx%s", (uintptr_t)image, r_ext);
|
snprintf(file_name, sizeof(file_name), "img_%016llx%s", (uintptr_t)image, r_ext);
|
||||||
|
|
||||||
file_path = get_cache_file(file_name);
|
file_path = get_cache_file(file_name);
|
||||||
|
@ -89,6 +89,11 @@ pxr::VtValue MaterialData::get_material_resource() const
|
|||||||
return material_network_map_;
|
return material_network_map_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pxr::HdCullStyle MaterialData::cull_style() const
|
||||||
|
{
|
||||||
|
return double_sided ? pxr::HdCullStyle::HdCullStyleNothing : pxr::HdCullStyle::HdCullStyleBack;
|
||||||
BogdanNagirniak marked this conversation as resolved
|
|||||||
|
}
|
||||||
|
|
||||||
void MaterialData::export_mtlx()
|
void MaterialData::export_mtlx()
|
||||||
{
|
{
|
||||||
/* Call of python function hydra.export_mtlx() */
|
/* Call of python function hydra.export_mtlx() */
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "pxr/base/tf/hashmap.h"
|
#include <pxr/imaging/hd/enums.h>
|
||||||
#include <pxr/usd/sdf/assetPath.h>
|
#include <pxr/usd/sdf/assetPath.h>
|
||||||
#include <pxr/usd/sdf/path.h>
|
#include <pxr/usd/sdf/path.h>
|
||||||
|
|
||||||
@ -27,6 +27,7 @@ class MaterialData : public IdData {
|
|||||||
|
|
||||||
pxr::VtValue get_data(pxr::TfToken const &key) const override;
|
pxr::VtValue get_data(pxr::TfToken const &key) const override;
|
||||||
pxr::VtValue get_material_resource() const;
|
pxr::VtValue get_material_resource() const;
|
||||||
|
pxr::HdCullStyle cull_style() const;
|
||||||
|
|
||||||
bool double_sided = true;
|
bool double_sided = true;
|
||||||
|
|
||||||
|
@ -149,6 +149,15 @@ pxr::SdfPath MeshData::material_id(pxr::SdfPath const &id) const
|
|||||||
return sm.mat_data->prim_id;
|
return sm.mat_data->prim_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pxr::HdCullStyle MeshData::cull_style(pxr::SdfPath const &id) const
|
||||||
|
{
|
||||||
|
const SubMesh &sm = submesh(id);
|
||||||
|
if (sm.mat_data) {
|
||||||
|
return sm.mat_data->cull_style();
|
||||||
|
}
|
||||||
|
return pxr::HdCullStyle::HdCullStyleDontCare;
|
||||||
|
}
|
||||||
|
|
||||||
bool MeshData::double_sided(pxr::SdfPath const &id) const
|
bool MeshData::double_sided(pxr::SdfPath const &id) const
|
||||||
{
|
{
|
||||||
const SubMesh &sm = submesh(id);
|
const SubMesh &sm = submesh(id);
|
||||||
@ -163,7 +172,8 @@ void MeshData::update_double_sided(MaterialData *mat_data)
|
|||||||
for (int i = 0; i < submeshes_.size(); ++i) {
|
for (int i = 0; i < submeshes_.size(); ++i) {
|
||||||
if (submeshes_[i].mat_data == mat_data) {
|
if (submeshes_[i].mat_data == mat_data) {
|
||||||
scene_delegate_->GetRenderIndex().GetChangeTracker().MarkRprimDirty(
|
scene_delegate_->GetRenderIndex().GetChangeTracker().MarkRprimDirty(
|
||||||
submesh_prim_id(i), pxr::HdChangeTracker::DirtyDoubleSided);
|
submesh_prim_id(i),
|
||||||
|
pxr::HdChangeTracker::DirtyDoubleSided | pxr::HdChangeTracker::DirtyCullStyle);
|
||||||
ID_LOG(1, "%d", i);
|
ID_LOG(1, "%d", i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,13 +38,12 @@ class MeshData : public ObjectData {
|
|||||||
pxr::HdMeshTopology mesh_topology(pxr::SdfPath const &id) const;
|
pxr::HdMeshTopology mesh_topology(pxr::SdfPath const &id) const;
|
||||||
pxr::HdPrimvarDescriptorVector primvar_descriptors(pxr::HdInterpolation interpolation) const;
|
pxr::HdPrimvarDescriptorVector primvar_descriptors(pxr::HdInterpolation interpolation) const;
|
||||||
pxr::SdfPath material_id(pxr::SdfPath const &id) const;
|
pxr::SdfPath material_id(pxr::SdfPath const &id) const;
|
||||||
|
pxr::HdCullStyle cull_style(pxr::SdfPath const &id) const;
|
||||||
bool double_sided(pxr::SdfPath const &id) const;
|
bool double_sided(pxr::SdfPath const &id) const;
|
||||||
void update_double_sided(MaterialData *mat_data);
|
void update_double_sided(MaterialData *mat_data);
|
||||||
void available_materials(Set<pxr::SdfPath> &paths) const;
|
void available_materials(Set<pxr::SdfPath> &paths) const;
|
||||||
pxr::SdfPathVector submesh_paths() const;
|
pxr::SdfPathVector submesh_paths() const;
|
||||||
|
|
||||||
pxr::HdCullStyle cull_style = pxr::HdCullStyleBack;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
pxr::SdfPath submesh_prim_id(int index) const;
|
pxr::SdfPath submesh_prim_id(int index) const;
|
||||||
const SubMesh &submesh(pxr::SdfPath const &id) const;
|
const SubMesh &submesh(pxr::SdfPath const &id) const;
|
||||||
|
@ -176,11 +176,8 @@ void WorldData::write_transform()
|
|||||||
{
|
{
|
||||||
transform = pxr::GfMatrix4d(pxr::GfRotation(pxr::GfVec3d(1.0, 0.0, 0.0), -90), pxr::GfVec3d());
|
transform = pxr::GfMatrix4d(pxr::GfRotation(pxr::GfVec3d(1.0, 0.0, 0.0), -90), pxr::GfVec3d());
|
||||||
|
|
||||||
transform *= pxr::GfMatrix4d(pxr::GfRotation(pxr::GfVec3d(1.0, 0.0, 0.0), -180),
|
transform *= pxr::GfMatrix4d(pxr::GfRotation(pxr::GfVec3d(1.0, 0.0, 0.0), -180), pxr::GfVec3d());
|
||||||
pxr::GfVec3d());
|
transform *= pxr::GfMatrix4d(pxr::GfRotation(pxr::GfVec3d(0.0, 0.0, 1.0), 90.0), pxr::GfVec3d());
|
||||||
transform *= pxr::GfMatrix4d(pxr::GfRotation(pxr::GfVec3d(0.0, 0.0, 1.0), 90.0),
|
|
||||||
pxr::GfVec3d());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace blender::render::hydra
|
} // namespace blender::render::hydra
|
||||||
|
Loading…
Reference in New Issue
Block a user
Check please value with
mesh::cull_style()