Skip to content

Commit

Permalink
Support deform_keys in curves (#2128)
Browse files Browse the repository at this point in the history
* Support deform_keys in curves #2127

* Add changelog
  • Loading branch information
sebastienblor authored Oct 10, 2024
1 parent 0d410fc commit 803176f
Show file tree
Hide file tree
Showing 6 changed files with 390 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
- [usd#2092](https://github.com/Autodesk/arnold-usd/issues/2092) - Fix interactive update issue when prims visibility is tweaked in the procedural
- [usd#2102](https://github.com/Autodesk/arnold-usd/issues/2102) - Remove hydra warning subdiv_iterations: use type BYTE, not INT
- [usd#2105](https://github.com/Autodesk/arnold-usd/issues/2105) - Ensure the Arnold scene isn't modified after a Hydra batch render started
- [usd#2127](https://github.com/Autodesk/arnold-usd/issues/2127) - Support deform_keys in curves

### Build
- [usd#1969](https://github.com/Autodesk/arnold-usd/issues/1969) - Remove support for USD versions older than 21.05
Expand Down
7 changes: 7 additions & 0 deletions libs/render_delegate/basis_curves.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ void HdArnoldBasisCurves::Sync(
bool dirtyTopology = HdChangeTracker::IsTopologyDirty(*dirtyBits, id);
bool dirtyPrimvars = HdArnoldGetComputedPrimvars(sceneDelegate, id, *dirtyBits, _primvars, nullptr, &pointsSample) ||
(*dirtyBits & HdChangeTracker::DirtyPrimvar);
// We need to set the deform keys first if it is specified
VtValue deformKeysVal = sceneDelegate->Get(id, str::t_deformKeys);
if (deformKeysVal.IsHolding<int>()) {
SetDeformKeys(deformKeysVal.UncheckedGet<int>());
} else {
SetDeformKeys(-1);
}
bool dirtyPoints = HdChangeTracker::IsPrimvarDirty(*dirtyBits, id, HdTokens->points);
if (dirtyPrimvars) {
// This needs to be called before HdArnoldSetPositionFromPrimvar otherwise
Expand Down
7 changes: 7 additions & 0 deletions testsuite/test_2127/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Curves with acceleration and deform_keys

Fixes #2127

author: sebastien.ortega

PARAMS: {'scene': 'test.usda', 'kick_params': '-frame 6 '}
188 changes: 188 additions & 0 deletions testsuite/test_2127/data/test.usda
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
#usda 1.0
(
endTimeCode = 6
framesPerSecond = 24
metersPerUnit = 1
startTimeCode = 6
timeCodesPerSecond = 24
upAxis = "Y"
)

def Xform "curves" (
kind = "group"
)
{
int primvars:arnold:deform_keys = 10 (
interpolation = "constant"
)

def Xform "animated_curve" (
kind = "component"
)
{
int primvars:arnold:deform_keys = 10 (
interpolation = "constant"
)
matrix4d xformOp:transform:xform = ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1) )
uniform token[] xformOpOrder = ["xformOp:transform:xform"]

def BasisCurves "curve_0"
{
vector3f[] accelerations (
interpolation = "vertex"
)
vector3f[] accelerations.timeSamples = {
6: [(0, 0, 0), (0, -144, 0), (0, -288, 0), (0, -432, 0), (0, -576, 0)],
}
uniform token basis = ""
int[] curveVertexCounts.timeSamples = {
6: [5],
}
float3[] extent.timeSamples = {
6: [(-0.05, -0.05, -0.05), (0.05, 1.05, 0.05)],
}
point3f[] points (
interpolation = "vertex"
)
point3f[] points.timeSamples = {
6: [(0, 0, 0), (0, 0.25, 0), (0, 0.5, 0), (0, 0.75, 0), (0, 1, 0)],
}
int primvars:arnold:deform_keys = 10 (
interpolation = "constant"
)
string primvars:arnold:mode = "1" (
interpolation = "constant"
)
uniform token type = "linear"
vector3f[] velocities (
interpolation = "vertex"
)
vector3f[] velocities.timeSamples = {
6: [(0, 0, 0), (-5.196152, 0, 0), (-10.392304, 0, 0), (-15.588457, 0, 0), (-20.784609, 0, 0)],
}
float[] widths (
interpolation = "vertex"
)
float[] widths.timeSamples = {
6: [0.1, 0.1, 0.1, 0.1, 0.1],
}
uniform token wrap = "nonperiodic"
matrix4d xformOp:transform:transform4 = ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0.4, 0, 0, 1) )
uniform token[] xformOpOrder = ["xformOp:transform:transform4"]
}
}
}

def Xform "cameras"
{
int primvars:arnold:deform_keys = 10 (
interpolation = "constant"
)

def Camera "camera" (
prepend apiSchemas = ["HoudiniCameraPlateAPI", "HoudiniViewportGuideAPI"]
)
{
float2 clippingRange = (0.00434915, 43491.5)
float exposure = 0
float focalLength.timeSamples = {
6: 0.321,
}
float focusDistance = 5
float fStop = 0
float horizontalAperture.timeSamples = {
6: 0.414214,
}
float horizontalApertureOffset.timeSamples = {
6: 0,
}
asset houdini:backgroundimage = @@
asset houdini:foregroundimage = @@
float houdini:guidescale.timeSamples = {
6: 1,
}
bool houdini:inviewermenu = 1
int primvars:arnold:deform_keys = 10 (
interpolation = "constant"
)
token projection = "perspective"
double shutter:close = 0.5
double shutter:open = -0.5
float verticalAperture.timeSamples = {
6: 0.23299538,
}
float verticalApertureOffset.timeSamples = {
6: 0,
}
matrix4d xformOp:transform = ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 3.113354891187284, 1) )
uniform token[] xformOpOrder = ["xformOp:transform"]
}
}

def Xform "lights"
{
int primvars:arnold:deform_keys = 10 (
interpolation = "constant"
)

def DomeLight "domelight8" (
prepend apiSchemas = ["HoudiniViewportGuideAPI"]
)
{
custom rel filters = None
float houdini:guidescale.timeSamples = {
6: 1,
}
bool houdini:inviewermenu = 0
color3f inputs:color = (1, 1, 1)
float inputs:diffuse = 1
bool inputs:enableColorTemperature = 0
float inputs:exposure = 0
float inputs:intensity = 1
bool inputs:normalize = 0
float inputs:specular = 1
asset inputs:texture:file = @@
token inputs:texture:format = "latlong"
rel light:filters = None
rel portals = None
float primvars:arnold:camera = 0 (
interpolation = "constant"
)
int primvars:arnold:deform_keys = 10 (
interpolation = "constant"
)
matrix4d xformOp:transform = ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1) )
uniform token[] xformOpOrder = ["xformOp:transform"]
}
}

def Scope "Render"
{
def Scope "Products"
{
def Scope "Vars"
{
def RenderVar "RGBA"
{
custom string arnold:filter = "box_filter"
token dataType = "color4f"
custom int driver:parameters:aov:clearValue = 0
custom token driver:parameters:aov:format = "color4f"
custom bool driver:parameters:aov:multiSampled = 0
custom string driver:parameters:aov:name = "RGBA"
string sourceName = "RGBA"
token sourceType = "raw"
}
}
}

def RenderSettings "rendersettings"
{
custom int arnold:global:AA_samples = 4
rel camera = </cameras/camera>
token[] includedPurposes = ["default"]
token[] materialBindingPurposes = ["full", "allPurpose"]
int2 resolution = (160, 120)
}
}

Loading

0 comments on commit 803176f

Please sign in to comment.