Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connect the opacity on the transmission #1252

Merged
merged 10 commits into from
Aug 16, 2022
Prev Previous commit
Next Next commit
remap opacity after converting it
  • Loading branch information
cpichard committed Aug 16, 2022
commit 58a5c89a52f84ce34f3cee1061730f5ac991e45a
6 changes: 3 additions & 3 deletions render_delegate/node_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,13 @@ RemapNodeFunc previewSurfaceRemap = [](MaterialEditContext* ctx) {
}

// Float opacity needs to be remapped to 1 - transmission
ctx->RenameParam(str::t_opacity, str::t_transmission);
const auto opacityValue = ctx->GetParam(str::t_opacity);
if (opacityValue.IsHolding<float>()) {
const auto opacity = opacityValue.UncheckedGet<float>();
ctx->SetParam(str::t_transmission, VtValue(1.f - opacity));
ctx->SetParam(str::t_opacity, VtValue(1.f - opacity));
}

ctx->RenameParam(str::t_opacity, str::t_transmission);

ctx->RenameParam(str::t_diffuseColor, str::t_base_color);
ctx->RenameParam(str::t_emissiveColor, str::t_emission_color);
ctx->RenameParam(str::t_roughness, str::t_specular_roughness);
Expand Down