Skip to content

Commit

Permalink
Tweaks to physicallyBased material
Browse files Browse the repository at this point in the history
and other, smaller fixes
  • Loading branch information
johguenther committed Sep 23, 2024
1 parent ddce4e1 commit 29f9db2
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
6 changes: 6 additions & 0 deletions scene/light/HDRI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ void HDRI::commit()
return;
}

if (m_image->elementType() != ANARI_FLOAT32_VEC3) {
reportMessage(
ANARI_SEVERITY_WARNING, "radiance data for HDRI light needs to be of format FLOAT32_VEC3");
return;
}

auto ol = osprayLight();
ospSetParam(ol, "visible", OSP_BOOL, &visible);
ospSetParam(ol, "color", OSP_VEC3F, &color);
Expand Down
1 change: 1 addition & 0 deletions scene/surface/geometry/Geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ void Geometry::setColorAttribute(Attribute attr, OSPGeometricModel om)
auto d = ospNewSharedData1D(
unpackedValues.data(), OSP_VEC4F, unpackedValues.size());
ospSetParam(om, "color", OSP_DATA, &d);
ospCommit(om);
ospRelease(d);
}
}
Expand Down
21 changes: 21 additions & 0 deletions scene/surface/material/PBM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ void PBM::commit()
auto transmission = getParam<float>("transmission", 0.f);
auto ior = getParam<float>("ior", 1.5);
auto thickness = getParam<float>("thickness", 0.f);
auto attenuationDistance = getParam<float>("attenuationDistance", INFINITY);
auto attenuationColor = getParam<float3>("attenuationColor", float3(1.f));
auto sheen = getParam<float3>("sheen", float3(0.f));
auto sheenRoughness = getParam<float>("sheenRoughness", 0.f);
auto emissive = getParam<float3>("emissive", float3(0.f));

OSPTexture ot = nullptr;
if (m_colorSampler && m_colorSampler->isValid()) {
Expand All @@ -40,11 +45,27 @@ void PBM::commit()
ospSetParam(om, "metallic", OSP_FLOAT, &metallic);
ospSetParam(om, "roughness", OSP_FLOAT, &roughness);
ospSetParam(om, "specular", OSP_FLOAT, &specular);
bool b = false;
ospSetParam(om, "specularMetallic", OSP_BOOL, &b);
ospSetParam(om, "coat", OSP_FLOAT, &clearcoat);
ospSetParam(om, "coatRoughness", OSP_FLOAT, &clearcoatRoughness);
ospSetParam(om, "transmission", OSP_FLOAT, &transmission);
if (transmission) {
bool b = thickness > 0.0f;
ospSetParam(om, "thin", OSP_BOOL, &b);
ospSetParam(om, "transmissionColor", OSP_VEC3F, &m_color);
}
ospSetParam(om, "ior", OSP_FLOAT, &ior);
ospSetParam(om, "thickness", OSP_FLOAT, &thickness);
ospSetParam(om, "transmissionDepth", OSP_FLOAT, &attenuationDistance);
ospSetParam(om, "transmissionColor", OSP_VEC3F, &attenuationColor);
if (sum(sheen) > 0.0f) {
float f = 1.0f;
ospSetParam(om, "sheen", OSP_FLOAT, &f);
}
ospSetParam(om, "sheenColor", OSP_VEC3F, &sheen);
ospSetParam(om, "sheenRoughness", OSP_FLOAT, &sheenRoughness);
ospSetParam(om, "emissiveColor", OSP_VEC3F, &emissive);
ospCommit(om);
}

Expand Down
4 changes: 2 additions & 2 deletions scene/volume/TransferFunction1D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void TransferFunction1DVolume::commit()
m_field = getParamObject<SpatialField>("value");
if (!m_field) {
reportMessage(
ANARI_SEVERITY_WARNING, "no spatial field provided to scivis volume");
ANARI_SEVERITY_WARNING, "no spatial field provided to transfer function");
return;
}

Expand All @@ -30,7 +30,7 @@ void TransferFunction1DVolume::commit()

if (!m_colorData) {
reportMessage(
ANARI_SEVERITY_WARNING, "no color data provided to scivis volume");
ANARI_SEVERITY_WARNING, "no color data provided to transfer function");
return;
}

Expand Down

0 comments on commit 29f9db2

Please sign in to comment.