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

Use renderSettingsPrimPath metadata #1235

Merged
merged 3 commits into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions testsuite/test_1223/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Support renderSettingsPrimPath metadata in the reader

author: cyril.pichard

PARAMS: {'scene':'test.usda', 'kick_params':''}
146 changes: 146 additions & 0 deletions testsuite/test_1223/data/test.usda
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
#usda 1.0
(
renderSettingsPrimPath = "/Render/TertiarySettings"
)

def Scope "Render"
{
def RenderSettings "PrimarySettings"
{
rel camera = </World/main_cam0002>
rel products = </Render/PrimaryProduct>
}

def RenderSettings "SecondarySettings"
{
rel camera = </World/main_cam0001>
rel products = </Render/PrimaryProduct>
}

def RenderSettings "TertiarySettings"
{
rel camera = </World/main_cam>
rel products = </Render/PrimaryProduct>
}

def RenderProduct "PrimaryProduct"
{
rel camera = </World/main_cam>
}

}

def "World"
{
def Camera "main_cam"
{
matrix4d xformOp:transform.timeSamples = {
1: ( (-0.8191520442889908, 1.6321175169494996e-15, -0.5735764363510479, 0), (-0.15809909227474528, 0.9612616959383157, 0.22578890349991687, 0), (0.551357057957064, 0.2756373558170103, -0.7874194833245733, 0), (12.157394811434061, 6.323548585074947, -16.733218418488544, 1) ),
}
uniform token[] xformOpOrder = ["xformOp:transform"]
}

def DomeLight "light"
{
float inputs:intensity = 0.1
}

def Xform "Plane"
{
matrix4d xformOp:transform = ( (0.8840559124946594, 0.46738117933273315, 0, 0), (-0.35344699025154114, 0.6685483455657959, 0.6543075442314148, 0), (0.3058110177516937, -0.5784444212913513, 0.7562285661697388, 0), (0, 0, 0, 1) )
uniform token[] xformOpOrder = ["xformOp:transform"]

def Mesh "Plane"
{
uniform bool doubleSided = 1
int[] faceVertexCounts = [4]
int[] faceVertexIndices = [0, 1, 3, 2]
normal3f[] normals = [(-0.16940932, -0.16940932, 0.9708764), (-0.16940932, -0.16940932, 0.9708764), (-0.16940932, -0.16940932, 0.9708764), (-0.16940932, -0.16940932, 0.9708764)] (
interpolation = "faceVarying"
)
point3f[] points = [(-1, -1, 0), (1, -1, 0), (-1, 1, 0), (1, 1, 0.69796455)]
color3f[] primvars:displayColor = [(0.6666666, 0.090014055, 0.090014055)]
texCoord2f[] primvars:UVMap = [(1, 1), (2, 1), (2, 2), (1, 1)] (
interpolation = "faceVarying"
)
uniform token subdivisionScheme = "none"
}
}

def Camera "main_cam0001"
{
float4[] clippingPlanes.timeSamples = {
1: [],
}
float2 clippingRange.timeSamples = {
1: (1, 1000000),
}
float focalLength.timeSamples = {
1: 49.999996,
}
float focusDistance.timeSamples = {
1: 0,
}
float fStop.timeSamples = {
1: 0,
}
float horizontalAperture.timeSamples = {
1: 20.955,
}
float horizontalApertureOffset.timeSamples = {
1: 0,
}
token projection.timeSamples = {
1: "perspective",
}
float verticalAperture.timeSamples = {
1: 8.980715,
}
float verticalApertureOffset.timeSamples = {
1: 0,
}
matrix4d xformOp:transform.timeSamples = {
1: ( (-0.7986355100472944, 1.4787140733094438e-15, -0.6018150231520465, 0), (-0.1455922312013086, 0.9702957262759928, 0.1932074164838614, 0), (0.5839385449731187, 0.24192189559968225, -0.7749126222511372, 0), (12.157394811434061, 6.323548585074947, -16.733218418488544, 1) ),
}
uniform token[] xformOpOrder = ["xformOp:transform"]
}

def Camera "main_cam0002"
{
float4[] clippingPlanes.timeSamples = {
1: [],
}
float2 clippingRange.timeSamples = {
1: (1, 1000000),
}
float focalLength.timeSamples = {
1: 49.999996,
}
float focusDistance.timeSamples = {
1: 0,
}
float fStop.timeSamples = {
1: 0,
}
float horizontalAperture.timeSamples = {
1: 20.955,
}
float horizontalApertureOffset.timeSamples = {
1: 0,
}
token projection.timeSamples = {
1: "perspective",
}
float verticalAperture.timeSamples = {
1: 8.980715,
}
float verticalApertureOffset.timeSamples = {
1: 0,
}
matrix4d xformOp:transform.timeSamples = {
1: ( (-0.7986355100472973, 7.853356648234202e-16, -0.6018150231520436, 0), (-0.23514786313800393, 0.9205048534524346, 0.3120517540923984, 0), (0.5539736496920457, 0.39073112848928726, -0.7351478631379975, 0), (12.157394811434061, 6.323548585074947, -16.733218418488544, 1) ),
}
uniform token[] xformOpOrder = ["xformOp:transform"]
}
}

Binary file added testsuite/test_1223/ref/reference.tif
Binary file not shown.
11 changes: 10 additions & 1 deletion translator/reader/reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,16 @@ void UsdArnoldReader::ReadStage(UsdStageRefPtr stage, const std::string &path)

// Simplest use case : the render settings name has been explicitely set.
std::string optionsName = _renderSettings;
// If not, we'll first search for a primitive called "options", which is the node name

// If not, we'll first search for a metadata called renderSettingsPrimPath on the stage
// https://graphics.pixar.com/usd/release/api/usd_render_page_front.html
if (optionsName.empty() && _stage->HasMetadata(UsdRenderTokens->renderSettingsPrimPath)) {
VtValue renderSettingsPrimPath;
_stage->GetMetadata(UsdRenderTokens->renderSettingsPrimPath, &renderSettingsPrimPath);
optionsName = renderSettingsPrimPath.Get<std::string>();
}

// If not found, we'll search for a primitive called "options", which is the node name
// in Arnold, and which is the name we author by default
if (optionsName.empty())
optionsName = "/options";
Expand Down