Skip to content

Commit

Permalink
Update to RPR 1.34.4 (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
hshakula authored and bsavery committed Nov 27, 2019
1 parent 4595d56 commit 18cb1d2
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 47 deletions.
1 change: 0 additions & 1 deletion cmake/modules/FindRpr.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ if(WIN32)

set(RPR_BINARIES
${RPR_BIN_LOCATION}/RadeonProRender64.dll
${RPR_BIN_LOCATION}/RprLoadStore64.dll
${RPR_TAHOE_BINARY}
${RPR_HYBRID_BINARY})
else()
Expand Down
78 changes: 39 additions & 39 deletions pxr/imaging/plugin/hdRpr/materialAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,14 @@ void GetTextures(const HdMaterialNetwork& materialNetwork, MaterialTextures& ou
MaterialAdapter::MaterialAdapter(EMaterialType type, const MaterialParams& params) : m_type(type) {
switch (type) {
case EMaterialType::COLOR: {
m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_DIFFUSE_COLOR] = GfVec4f(0.18f);
m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_DIFFUSE_WEIGHT] = GfVec4f(1.0f);
m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_REFLECTION_WEIGHT] = GfVec4f(0.0f);
m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_REFRACTION_WEIGHT] = GfVec4f(0.0f);
m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_DIFFUSE_COLOR] = GfVec4f(0.18f);
m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_DIFFUSE_WEIGHT] = GfVec4f(1.0f);
m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_REFLECTION_WEIGHT] = GfVec4f(0.0f);
m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_REFRACTION_WEIGHT] = GfVec4f(0.0f);

for (auto& entry : params) {
if (entry.first == HdRprMaterialTokens->color) {
m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_DIFFUSE_COLOR] = VtValToVec4f(entry.second);
m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_DIFFUSE_COLOR] = VtValToVec4f(entry.second);
}
}
break;
Expand Down Expand Up @@ -258,8 +258,8 @@ void MaterialAdapter::PopulateTransparent(const MaterialParams& params) {

void MaterialAdapter::PopulateUsdPreviewSurface(const MaterialParams& params, const MaterialTextures& textures) {
// initial params
m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_REFLECTION_WEIGHT] = GfVec4f(1.0f);
m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_REFRACTION_COLOR] = GfVec4f(1.0f);
m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_REFLECTION_WEIGHT] = GfVec4f(1.0f);
m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_REFRACTION_COLOR] = GfVec4f(1.0f);

int useSpecular = 0;
GfVec4f albedoColor = GfVec4f(1.0f);
Expand All @@ -276,32 +276,32 @@ void MaterialAdapter::PopulateUsdPreviewSurface(const MaterialParams& params, co

if (paramName == HdRprMaterialTokens->diffuseColor) {
albedoColor = VtValToVec4f(paramValue);
m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_DIFFUSE_COLOR] = albedoColor;
m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_DIFFUSE_COLOR] = albedoColor;
} else if (paramName == HdRprMaterialTokens->emissiveColor) {
GfVec4f emmisionColor = VtValToVec4f(paramValue);
if (!IsColorBlack(emmisionColor)) {
m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_EMISSION_WEIGHT] = GfVec4f(1.0f);
m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_EMISSION_COLOR] = emmisionColor;
m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_EMISSION_WEIGHT] = GfVec4f(1.0f);
m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_EMISSION_COLOR] = emmisionColor;
}
} else if (paramName == HdRprMaterialTokens->useSpecularWorkflow) {
useSpecular = paramValue.Get<int>();
} else if (paramName == HdRprMaterialTokens->specularColor) {
reflectionColor = VtValToVec4f(paramValue);
} else if (paramName == HdRprMaterialTokens->metallic) {
m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_REFLECTION_METALNESS] = VtValToVec4f(paramValue);
m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_REFLECTION_METALNESS] = VtValToVec4f(paramValue);
} else if (paramName == HdRprMaterialTokens->roughness) {
m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_DIFFUSE_ROUGHNESS] = VtValToVec4f(paramValue);
m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_REFLECTION_ROUGHNESS] = VtValToVec4f(paramValue);
m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_REFRACTION_ROUGHNESS] = VtValToVec4f(paramValue);
m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_DIFFUSE_ROUGHNESS] = VtValToVec4f(paramValue);
m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_REFLECTION_ROUGHNESS] = VtValToVec4f(paramValue);
m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_REFRACTION_ROUGHNESS] = VtValToVec4f(paramValue);
} else if (paramName == HdRprMaterialTokens->clearcoat) {
m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_COATING_WEIGHT] = VtValToVec4f(paramValue);
m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_COATING_WEIGHT] = VtValToVec4f(paramValue);
} else if (paramName == HdRprMaterialTokens->clearcoatRoughness) {
m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_COATING_ROUGHNESS] = VtValToVec4f(paramValue);
m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_COATING_ROUGHNESS] = VtValToVec4f(paramValue);
} else if (paramName == HdRprMaterialTokens->ior) {
m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_REFRACTION_IOR] = VtValToVec4f(paramValue);
m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_REFRACTION_IOR] = VtValToVec4f(paramValue);
} else if (paramName == HdRprMaterialTokens->opacity) {
m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_DIFFUSE_WEIGHT] = VtValToVec4f(paramValue);
m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_REFRACTION_WEIGHT] = GfVec4f(1.0f) - m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_DIFFUSE_WEIGHT];
m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_DIFFUSE_WEIGHT] = VtValToVec4f(paramValue);
m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_REFRACTION_WEIGHT] = GfVec4f(1.0f) - m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_DIFFUSE_WEIGHT];
}
}

Expand All @@ -311,54 +311,54 @@ void MaterialAdapter::PopulateUsdPreviewSurface(const MaterialParams& params, co
if (paramName == HdRprMaterialTokens->diffuseColor) {
isAlbedoTexture = true;
albedoTex = materialTexture;
m_texRpr[RPR_UBER_MATERIAL_INPUT_DIFFUSE_COLOR] = materialTexture;
m_texRpr[RPR_MATERIAL_INPUT_UBER_DIFFUSE_COLOR] = materialTexture;
} else if (paramName == HdRprMaterialTokens->emissiveColor) {
m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_EMISSION_WEIGHT] = GfVec4f(1.0f);
m_texRpr[RPR_UBER_MATERIAL_INPUT_EMISSION_COLOR] = materialTexture;
m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_EMISSION_WEIGHT] = GfVec4f(1.0f);
m_texRpr[RPR_MATERIAL_INPUT_UBER_EMISSION_COLOR] = materialTexture;
} else if (paramName == HdRprMaterialTokens->specularColor) {
isReflectionTexture = true;
reflectionTex = materialTexture;
} else if (paramName == HdRprMaterialTokens->metallic) {
m_texRpr[RPR_UBER_MATERIAL_INPUT_REFLECTION_METALNESS] = materialTexture;
m_texRpr[RPR_MATERIAL_INPUT_UBER_REFLECTION_METALNESS] = materialTexture;
} else if (paramName == HdRprMaterialTokens->roughness) {
m_texRpr[RPR_UBER_MATERIAL_INPUT_DIFFUSE_ROUGHNESS] = materialTexture;
m_texRpr[RPR_UBER_MATERIAL_INPUT_REFLECTION_ROUGHNESS] = materialTexture;
m_texRpr[RPR_UBER_MATERIAL_INPUT_REFRACTION_ROUGHNESS] = materialTexture;
m_texRpr[RPR_MATERIAL_INPUT_UBER_DIFFUSE_ROUGHNESS] = materialTexture;
m_texRpr[RPR_MATERIAL_INPUT_UBER_REFLECTION_ROUGHNESS] = materialTexture;
m_texRpr[RPR_MATERIAL_INPUT_UBER_REFRACTION_ROUGHNESS] = materialTexture;
} else if (paramName == HdRprMaterialTokens->clearcoat) {
m_texRpr[RPR_UBER_MATERIAL_INPUT_COATING_WEIGHT] = materialTexture;
m_texRpr[RPR_MATERIAL_INPUT_UBER_COATING_WEIGHT] = materialTexture;
} else if (paramName == HdRprMaterialTokens->clearcoatRoughness) {
m_texRpr[RPR_UBER_MATERIAL_INPUT_COATING_ROUGHNESS] = materialTexture;
m_texRpr[RPR_MATERIAL_INPUT_UBER_COATING_ROUGHNESS] = materialTexture;
} else if (paramName == HdRprMaterialTokens->ior) {
m_texRpr[RPR_UBER_MATERIAL_INPUT_REFRACTION_IOR] = materialTexture;
m_texRpr[RPR_MATERIAL_INPUT_UBER_REFRACTION_IOR] = materialTexture;
} else if (paramName == HdRprMaterialTokens->opacity) {
m_texRpr[RPR_UBER_MATERIAL_INPUT_DIFFUSE_WEIGHT] = materialTexture;
m_texRpr[RPR_MATERIAL_INPUT_UBER_DIFFUSE_WEIGHT] = materialTexture;
materialTexture.isOneMinusSrcColor = true;
m_texRpr[RPR_UBER_MATERIAL_INPUT_REFRACTION_WEIGHT] = materialTexture;
m_texRpr[RPR_MATERIAL_INPUT_UBER_REFRACTION_WEIGHT] = materialTexture;
} else if (paramName == HdRprMaterialTokens->normal) {
m_texRpr[RPR_UBER_MATERIAL_INPUT_DIFFUSE_NORMAL] = materialTexture;
m_texRpr[RPR_UBER_MATERIAL_INPUT_REFLECTION_NORMAL] = materialTexture;
m_texRpr[RPR_MATERIAL_INPUT_UBER_DIFFUSE_NORMAL] = materialTexture;
m_texRpr[RPR_MATERIAL_INPUT_UBER_REFLECTION_NORMAL] = materialTexture;
} else if (paramName == HdRprMaterialTokens->displacement) {
m_displacementTexture = materialTexture;
}

}

if (useSpecular) {
m_uRprParams[RPR_UBER_MATERIAL_INPUT_REFLECTION_MODE] = RPR_UBER_MATERIAL_IOR_MODE_PBR;
m_uRprParams[RPR_MATERIAL_INPUT_UBER_REFLECTION_MODE] = RPR_UBER_MATERIAL_IOR_MODE_PBR;

if (isReflectionTexture) {
m_texRpr[RPR_UBER_MATERIAL_INPUT_REFLECTION_COLOR] = reflectionTex;
m_texRpr[RPR_MATERIAL_INPUT_UBER_REFLECTION_COLOR] = reflectionTex;
} else {
m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_REFLECTION_COLOR] = reflectionColor;
m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_REFLECTION_COLOR] = reflectionColor;
}

} else {
m_uRprParams[RPR_UBER_MATERIAL_INPUT_REFLECTION_MODE] = RPR_UBER_MATERIAL_IOR_MODE_METALNESS;
m_uRprParams[RPR_MATERIAL_INPUT_UBER_REFLECTION_MODE] = RPR_UBER_MATERIAL_IOR_MODE_METALNESS;

if (isAlbedoTexture) {
m_texRpr[RPR_UBER_MATERIAL_INPUT_REFLECTION_COLOR] = albedoTex;
m_texRpr[RPR_MATERIAL_INPUT_UBER_REFLECTION_COLOR] = albedoTex;
} else {
m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_REFLECTION_COLOR] = albedoColor;
m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_REFLECTION_COLOR] = albedoColor;
}
}

Expand Down
12 changes: 6 additions & 6 deletions pxr/imaging/plugin/hdRpr/materialFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,22 +230,22 @@ RprApiMaterial* RprMaterialFactory::CreateMaterial(EMaterialType type, const Mat
continue;
}

if (paramId == RPR_UBER_MATERIAL_INPUT_EMISSION_COLOR) {
if (paramId == RPR_MATERIAL_INPUT_UBER_EMISSION_COLOR) {
emissionColorNode = outNode;
}

// SIGGRAPH HACK: Fix for models from Apple AR quick look gallery.
// Of all the available ways to load images, none of them gives the opportunity to
// get the gamma of the image and does not convert the image to linear space
if ((paramId == RPR_UBER_MATERIAL_INPUT_DIFFUSE_COLOR ||
paramId == RPR_UBER_MATERIAL_INPUT_REFLECTION_COLOR) &&
if ((paramId == RPR_MATERIAL_INPUT_UBER_DIFFUSE_COLOR ||
paramId == RPR_MATERIAL_INPUT_UBER_REFLECTION_COLOR) &&
ArGetResolver().GetExtension(matTex.path) == "png") {
rprImageSetGamma(material->materialImages.back()->GetHandle(), 2.2f);
}

// normal map textures need to be passed through the normal map node
if (paramId == RPR_UBER_MATERIAL_INPUT_DIFFUSE_NORMAL ||
paramId == RPR_UBER_MATERIAL_INPUT_REFLECTION_NORMAL) {
if (paramId == RPR_MATERIAL_INPUT_UBER_DIFFUSE_NORMAL ||
paramId == RPR_MATERIAL_INPUT_UBER_REFLECTION_NORMAL) {
rpr_material_node textureNode = outNode;
int status = rprMaterialSystemCreateNode(m_matSys, RPR_MATERIAL_NODE_NORMAL_MAP, &outNode);
if (status == RPR_SUCCESS) {
Expand Down Expand Up @@ -273,7 +273,7 @@ RprApiMaterial* RprMaterialFactory::CreateMaterial(EMaterialType type, const Mat
rprMaterialNodeSetInputNByKey(isBlackColorNode, RPR_MATERIAL_INPUT_COLOR0, averageNode);
rprMaterialNodeSetInputFByKey(isBlackColorNode, RPR_MATERIAL_INPUT_COLOR1, 0.0f, 0.0f, 0.0f, 0.0f);

rprMaterialNodeSetInputNByKey(material->rootMaterial, RPR_UBER_MATERIAL_INPUT_EMISSION_WEIGHT, isBlackColorNode);
rprMaterialNodeSetInputNByKey(material->rootMaterial, RPR_MATERIAL_INPUT_UBER_EMISSION_WEIGHT, isBlackColorNode);
} else {
rprObjectDelete(averageNode);
}
Expand Down
2 changes: 1 addition & 1 deletion pxr/imaging/plugin/hdRpr/rprApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ class HdRprApiImpl {
m_rprContext->GetHandle(), &curve
, newPoints.size(), (float*)newPoints.data(), sizeof(GfVec3f)
, newIndexes.size(), 1, (const rpr_uint*)newIndexes.data()
, &width, nullptr, segmentsPerCurve.data()), "Fail to create curve")) {
, &width, nullptr, segmentsPerCurve.data(), 0), "Fail to create curve")) {
return nullptr;
}
auto curveObject = RprApiObject::Wrap(curve);
Expand Down

0 comments on commit 18cb1d2

Please sign in to comment.