diff --git a/testsuite/test_0157/README b/testsuite/test_0157/README new file mode 100644 index 0000000000..40cf6fd2ad --- /dev/null +++ b/testsuite/test_0157/README @@ -0,0 +1,6 @@ +Mesh Velocities with varying topologies + +See #221 #564 + +author: sebastien ortega + diff --git a/testsuite/test_0157/data/scene.usda b/testsuite/test_0157/data/scene.usda new file mode 100644 index 0000000000..8117adcbd7 --- /dev/null +++ b/testsuite/test_0157/data/scene.usda @@ -0,0 +1,71 @@ +#usda 1.0 +( + defaultPrim = "sopcreate1" + endTimeCode = 8 + framesPerSecond = 24 + metersPerUnit = 1 + startTimeCode = 4 + timeCodesPerSecond = 24 + upAxis = "Y" +) + +def Xform "sopcreate1" ( + kind = "component" +) +{ + 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 Mesh "mesh_0" + { + float3[] extent.timeSamples = { + 3: [(-0.50000006, -0.86602545, -0.5), (1, 0.8660254, 0.5)], + 4: [(-1, -1, -0.5), (1, 1, 0.5)], + 5: [(-0.80901706, -0.9510565, -0.5), (1, 0.95105654, 0.5)], + 6: [(-1, -0.86602545, -0.5), (1, 0.86602545, 0.5)], + 7: [(-0.9009689, -0.9749279, -0.5), (1, 0.9749279, 0.5)], + 8: [(-1, -1, -0.5), (1, 1, 0.5)], + } + int[] faceVertexCounts.timeSamples = { + 3: [3, 3, 4, 4, 4], + 4: [4, 4, 4, 4, 4, 4], + 5: [5, 5, 4, 4, 4, 4, 4], + 6: [6, 6, 4, 4, 4, 4, 4, 4], + 7: [7, 7, 4, 4, 4, 4, 4, 4, 4], + 8: [8, 8, 4, 4, 4, 4, 4, 4, 4, 4], + } + int[] faceVertexIndices.timeSamples = { + 3: [2, 1, 0, 3, 4, 5, 0, 1, 4, 3, 1, 2, 5, 4, 2, 0, 3, 5], + 4: [3, 2, 1, 0, 4, 5, 6, 7, 0, 1, 5, 4, 1, 2, 6, 5, 2, 3, 7, 6, 3, 0, 4, 7], + 5: [4, 3, 2, 1, 0, 5, 6, 7, 8, 9, 0, 1, 6, 5, 1, 2, 7, 6, 2, 3, 8, 7, 3, 4, 9, 8, 4, 0, 5, 9], + 6: [5, 4, 3, 2, 1, 0, 6, 7, 8, 9, 10, 11, 0, 1, 7, 6, 1, 2, 8, 7, 2, 3, 9, 8, 3, 4, 10, 9, 4, 5, 11, 10, 5, 0, 6, 11], + 7: [6, 5, 4, 3, 2, 1, 0, 7, 8, 9, 10, 11, 12, 13, 0, 1, 8, 7, 1, 2, 9, 8, 2, 3, 10, 9, 3, 4, 11, 10, 4, 5, 12, 11, 5, 6, 13, 12, 6, 0, 7, 13], + 8: [7, 6, 5, 4, 3, 2, 1, 0, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 9, 8, 1, 2, 10, 9, 2, 3, 11, 10, 3, 4, 12, 11, 4, 5, 13, 12, 5, 6, 14, 13, 6, 7, 15, 14, 7, 0, 8, 15], + } + uniform token orientation = "leftHanded" + point3f[] points ( + interpolation = "vertex" + ) + point3f[] points.timeSamples = { + 3: [(1, 0, 0.5), (-0.50000006, 0.8660254, 0.5), (-0.4999999, -0.86602545, 0.5), (1, 0, -0.5), (-0.50000006, 0.8660254, -0.5), (-0.4999999, -0.86602545, -0.5)], + 4: [(1, 0, 0.5), (-4.371139e-8, 1, 0.5), (-1, -8.742278e-8, 0.5), (1.1924881e-8, -1, 0.5), (1, 0, -0.5), (-4.371139e-8, 1, -0.5), (-1, -8.742278e-8, -0.5), (1.1924881e-8, -1, -0.5)], + 5: [(1, 0, 0.5), (0.30901697, 0.95105654, 0.5), (-0.80901706, 0.5877852, 0.5), (-0.80901694, -0.58778536, 0.5), (0.30901712, -0.9510565, 0.5), (1, 0, -0.5), (0.30901697, 0.95105654, -0.5), (-0.80901706, 0.5877852, -0.5), (-0.80901694, -0.58778536, -0.5), (0.30901712, -0.9510565, -0.5)], + 6: [(1, 0, 0.5), (0.49999997, 0.86602545, 0.5), (-0.50000006, 0.8660254, 0.5), (-1, -8.742278e-8, 0.5), (-0.4999999, -0.86602545, 0.5), (0.4999999, -0.86602545, 0.5), (1, 0, -0.5), (0.49999997, 0.86602545, -0.5), (-0.50000006, 0.8660254, -0.5), (-1, -8.742278e-8, -0.5), (-0.4999999, -0.86602545, -0.5), (0.4999999, -0.86602545, -0.5)], + 7: [(1, 0, 0.5), (0.6234898, 0.7818315, 0.5), (-0.22252095, 0.9749279, 0.5), (-0.9009689, 0.4338836, 0.5), (-0.90096885, -0.43388376, 0.5), (-0.222521, -0.9749279, 0.5), (0.62349004, -0.7818313, 0.5), (1, 0, -0.5), (0.6234898, 0.7818315, -0.5), (-0.22252095, 0.9749279, -0.5), (-0.9009689, 0.4338836, -0.5), (-0.90096885, -0.43388376, -0.5), (-0.222521, -0.9749279, -0.5), (0.62349004, -0.7818313, -0.5)], + 8: [(1, 0, 0.5), (0.70710677, 0.70710677, 0.5), (-4.371139e-8, 1, 0.5), (-0.70710677, 0.70710677, 0.5), (-1, -8.742278e-8, 0.5), (-0.70710665, -0.7071069, 0.5), (1.1924881e-8, -1, 0.5), (0.707107, -0.70710653, 0.5), (1, 0, -0.5), (0.70710677, 0.70710677, -0.5), (-4.371139e-8, 1, -0.5), (-0.70710677, 0.70710677, -0.5), (-1, -8.742278e-8, -0.5), (-0.70710665, -0.7071069, -0.5), (1.1924881e-8, -1, -0.5), (0.707107, -0.70710653, -0.5)], + } + uniform token subdivisionScheme = "none" + vector3f[] velocities ( + interpolation = "vertex" + ) + vector3f[] velocities.timeSamples = { + 3: [(0, -50, 25), (43.30127, 25.000004, 25), (-43.301273, 24.999996, 25), (0, -50, -25), (43.30127, 25.000004, -25), (-43.301273, 24.999996, -25)], + 4: [(0, -50, 25), (50, 0.0000021855694, 25), (-0.000004371139, 50, 25), (-50, -5.9624404e-7, 25), (0, -50, -25), (50, 0.0000021855694, -25), (-0.000004371139, 50, -25), (-50, -5.9624404e-7, -25)], + 5: [(0, -50, 25), (47.552826, -15.450849, 25), (29.38926, 40.45085, 25), (-29.389269, 40.450848, 25), (-47.552826, -15.450856, 25), (0, -50, -25), (47.552826, -15.450849, -25), (29.38926, 40.45085, -25), (-29.389269, 40.450848, -25), (-47.552826, -15.450856, -25)], + 6: [(0, -50, 25), (43.301273, -24.999998, 25), (43.30127, 25.000004, 25), (-0.000004371139, 50, 25), (-43.301273, 24.999996, 25), (-43.301273, -24.999996, 25), (0, -50, -25), (43.301273, -24.999998, -25), (43.30127, 25.000004, -25), (-0.000004371139, 50, -25), (-43.301273, 24.999996, -25), (-43.301273, -24.999996, -25)], + 7: [(0, -50, 25), (39.091576, -31.17449, 25), (48.746395, 11.126047, 25), (21.69418, 45.048447, 25), (-21.694187, 45.048443, 25), (-48.746395, 11.12605, 25), (-39.091568, -31.174501, 25), (0, -50, -25), (39.091576, -31.17449, -25), (48.746395, 11.126047, -25), (21.69418, 45.048447, -25), (-21.694187, 45.048443, -25), (-48.746395, 11.12605, -25), (-39.091568, -31.174501, -25)], + 8: [(0, -50, 25), (35.35534, -35.35534, 25), (50, 0.0000021855694, 25), (35.35534, 35.35534, 25), (-0.000004371139, 50, 25), (-35.355343, 35.35533, 25), (-50, -5.9624404e-7, 25), (-35.355328, -35.35535, 25), (0, -50, -25), (35.35534, -35.35534, -25), (50, 0.0000021855694, -25), (35.35534, 35.35534, -25), (-0.000004371139, 50, -25), (-35.355343, 35.35533, -25), (-50, -5.9624404e-7, -25), (-35.355328, -35.35535, -25)], + } + } +} + diff --git a/testsuite/test_0157/data/test.ass b/testsuite/test_0157/data/test.ass new file mode 100644 index 0000000000..d053adf2a5 --- /dev/null +++ b/testsuite/test_0157/data/test.ass @@ -0,0 +1,116 @@ +### exported: Fri Feb 26 16:21:18 2021 +### from: Arnold 6.2.0.1 [903992ac] windows clang-10.0.1 oiio-2.2.1 osl-1.11.6 vdb-7.1.1 clm-2.0.0.235 rlm-12.4.2 optix-6.6.0 2021/02/09 10:40:42 +### host app: MtoA 4.2.2 8271f300 (develop) Maya 2022 +### bounds: 0 0 0 0 0 0 +### user: blaines +### render_layer: defaultRenderLayer +### scene: C:/maya/scenes/usd_vel.mb + + + +options +{ + AA_samples 5 + AA_seed 4 + outputs "RGBA RGBA myfilter mydriver" + xres 160 + yres 120 + pixel_aspect_ratio 1.33333325 + texture_per_file_stats on + texture_automip off + camera "/persp/perspShape" + frame 4 + GI_diffuse_depth 1 + GI_specular_depth 1 + GI_transmission_depth 8 + declare render_layer constant STRING + render_layer "defaultRenderLayer" +} + +gaussian_filter +{ + name myfilter +} + +driver_tiff +{ + name mydriver + filename "testrender.tif" + color_space "" +} + +persp_camera +{ + name /persp/perspShape + matrix 1 2 b85MATRIX +8Fca(W:BqD`7Dirz_qN;u8El@&a7M[3z7*dw.8+]+<8El>mz7I(E[8Hbc38c;hKy8Fca(W:BqD`7Dirz_qN;u8El@&a7M[3z7*dw.8+]+<8El>mz7I(E[8Hbc38c;hKy + near_clip 0.100000001 + far_clip 10000 + shutter_start -0.02 + shutter_end 0.02 + shutter_type "box" + rolling_shutter "off" + rolling_shutter_duration 0 + motion_start -0.5 + motion_end 0.5 + exposure 0 + fov 1 2 FLOAT +54.4322243 54.4322243 + uv_remap 0 0 0 1 + lens_tilt_angle 1 2 VECTOR2 +0 0 0 0 + lens_shift 1 2 VECTOR2 +0 0 0 0 + declare dcc_name constant STRING + dcc_name "perspShape" +} + +skydome_light +{ + name /aiSkyDomeLight1/aiSkyDomeLightShape1 + matrix 1 2 b85MATRIX +y!$$$$$$$$$(y!$$$$$$$$$(y!$$$$$$$$$(yy!$$$$$$$$$(y!$$$$$$$$$(y!$$$$$$$$$(y + exposure 1 + cast_shadows on + cast_volumetric_shadows on + shadow_density 1 + shadow_color 0 0 0 + samples 1 + normalize on + camera 0 + transmission 1 + diffuse 1 + specular 1 + sss 1 + indirect 1 + max_bounces 999 + motion_start -0.5 + motion_end 0.5 + volume_samples 2 + volume 1 + aov "default" + resolution 1000 + format "latlong" + portal_mode "interior_only" + aov_indirect off + declare dcc_name constant STRING + dcc_name "aiSkyDomeLightShape1" +} + +usd +{ + name /aiStandIn/aiStandInShape + visibility 255 + matrix 1 2 b85MATRIX +y!$$$$$$$$$(y!$$$$$$$$$(y!$$$$$$$$$(yy!$$$$$$$$$(y!$$$$$$$$$(y!$$$$$$$$$(y + use_light_group off + motion_start -0.02 + motion_end 0.02 + override_nodes off + filename "scene.usda" + object_path "" + frame 4 + declare dcc_name constant STRING + dcc_name "aiStandInShape" +} + diff --git a/testsuite/test_0157/ref/reference.log b/testsuite/test_0157/ref/reference.log new file mode 100644 index 0000000000..6c6e205bf7 --- /dev/null +++ b/testsuite/test_0157/ref/reference.log @@ -0,0 +1,197 @@ +00:00:00 72MB | log started Fri Feb 26 18:37:30 2021 +00:00:00 72MB | Arnold 6.2.0.1 [903992ac] windows clang-10.0.1 oiio-2.2.1 osl-1.11.6 vdb-7.1.1 clm-2.0.0.235 rlm-12.4.2 optix-6.6.0 2021/02/09 10:40:42 +00:00:00 72MB | running on REMS4QL1726, pid=30264 +00:00:00 72MB | 2 x Intel(R) Xeon(R) Gold 5218 CPU @ 2.30GHz (32 cores, 64 logical) with 65154MB +00:00:00 75MB | NVIDIA driver version 442.50 (Optix 60600) +00:00:00 75MB | GPU 0: Quadro RTX 4000 @ 1545MHz (compute 7.5) with 8192MB (6629MB available) (NVLink:0) +00:00:00 75MB | Windows 10 (version 10.0, build 19041) +00:00:00 75MB | soft limit for open files is set at 2048 +00:00:00 75MB | +00:00:00 75MB | loading plugins from C:\arnold\arnold-usd\build\windows_x86_64\msvc_opt\usd-0.20.11_arnold-6.2.0.1\procedural ... +00:00:00 79MB | usd_proc.dll: usd uses Arnold 6.2.0.1 +00:00:00 79MB | loaded 1 plugins from 1 lib(s) in 0:00.08 +00:00:00 79MB | loading plugins from C:\arnold\sdk\6.2.0.1\bin\..\plugins ... +00:00:00 79MB | alembic_proc.dll: alembic uses Arnold 6.2.0.1 +00:00:00 79MB | cryptomatte.dll: cryptomatte uses Arnold 6.2.0.1 +00:00:00 79MB | cryptomatte.dll: cryptomatte_filter uses Arnold 6.2.0.1 +00:00:00 79MB | cryptomatte.dll: cryptomatte_manifest_driver uses Arnold 6.2.0.1 +00:00:00 79MB | skipping already loaded plugin: C:\arnold\sdk\6.2.0.1\bin\..\plugins\usd_proc.dll ... +00:00:00 79MB | loaded 4 plugins from 2 lib(s) in 0:00.01 +00:00:00 79MB | [kick] command: C:\arnold\sdk\6.2.0.1\bin\kick test.ass -dw -r 160 120 -sm lambert -bs 16 -o testrender.tif -set driver_tiff.dither false -nocrashpopup -dp -v 6 +00:00:00 79MB | loading plugins from . ... +00:00:00 79MB | no plugins loaded +00:00:00 79MB | [metadata] loading metadata file: test.ass +00:00:00 80MB | [ass] loading test.ass ... +00:00:00 80MB | [ass] read 2328 bytes, 6 nodes in 0:00.00 +00:00:00 80MB | [kick] applying 2 attr value overrides +00:00:00 81MB | +00:00:00 81MB | authorizing with default license managers: rlm, network, user ... +00:00:01 86MB | [network] authorized for "87287ARNOL_2020_0F" in 0:01.62 +00:00:01 86MB | [network] expiration date: permanent, in use: 1/100 +00:00:01 86MB | +00:00:01 105MB | [color_manager] no color manager is active +00:00:01 106MB | [color_manager] rendering color space is "linear" with declared chromaticities: +00:00:01 106MB | r(0.6400, 0.3300) g(0.3000, 0.6000) b(0.1500, 0.0600) and w(0.3127, 0.3290) +00:00:01 120MB | +00:00:01 120MB | there are 1 light and 2 objects: +00:00:01 120MB | 1 persp_camera +00:00:01 120MB | 1 skydome_light +00:00:01 120MB | 1 utility +00:00:01 120MB | 1 driver_tiff +00:00:01 120MB | 1 gaussian_filter +00:00:01 120MB | 1 list_aggregate +00:00:01 120MB | 1 usd +00:00:01 120MB | +00:00:01 120MB | rendering image at 160 x 120, 5 AA samples +00:00:01 120MB | AA samples max +00:00:01 120MB | AA sample clamp +00:00:01 120MB | diffuse samples 2 / depth 1 +00:00:01 120MB | specular samples 2 / depth 1 +00:00:01 120MB | transmission samples 2 / depth 8 +00:00:01 120MB | volume indirect +00:00:01 120MB | total depth 10 +00:00:01 120MB | bssrdf samples 2 +00:00:01 120MB | transparency depth 10 +00:00:01 120MB | initializing 8 nodes ... +00:00:01 151MB | [proc] /aiStandIn/aiStandInShape: loaded 3 nodes (1 objects, 2 shaders) +00:00:01 152MB | creating root object list ... +00:00:01 152MB | node initialization done in 0:00.05 (multithreaded) +00:00:01 152MB | updating 12 nodes ... +00:00:01 152MB | /aiSkyDomeLight1/aiSkyDomeLightShape1: skydome_light using 1 sample, 2 volume samples +00:00:01 152MB | scene bounds: (-1.00000012 -1.00000012 -1) -> (1 1 1) +00:00:01 152MB | node update done in 0:00.00 (multithreaded) +00:00:01 152MB | [aov] parsing 1 output statements ... +00:00:01 152MB | [aov] registered driver: "mydriver" (driver_tiff) +00:00:01 152MB | [aov] * "RGBA" of type RGBA filtered by "myfilter" (gaussian_filter) +00:00:01 152MB | [aov] done preparing 2 AOVs for 1 output to 1 driver (0 deep AOVs) +00:00:01 153MB | starting 64 bucket workers of size 16x16 ... +00:00:01 161MB | [accel] polymesh bvh4_motion done - 0:00.00 - 6 prims, 2 keys +00:00:01 171MB | 0% done - 2613 rays/pixel +00:00:01 172MB | 5% done - 214 rays/pixel +00:00:01 172MB | 10% done - 84 rays/pixel +00:00:01 172MB | 15% done - 87 rays/pixel +00:00:01 172MB | 20% done - 82 rays/pixel +00:00:01 173MB | 25% done - 34 rays/pixel +00:00:01 173MB | 30% done - 297 rays/pixel +00:00:01 173MB | 35% done - 112 rays/pixel +00:00:01 173MB | 40% done - 31 rays/pixel +00:00:01 173MB | 45% done - 27 rays/pixel +00:00:01 174MB | 50% done - 60 rays/pixel +00:00:01 174MB | 55% done - 114 rays/pixel +00:00:01 174MB | 60% done - 88 rays/pixel +00:00:01 174MB | 65% done - 180 rays/pixel +00:00:01 174MB | 70% done - 225 rays/pixel +00:00:01 168MB | 75% done - 500 rays/pixel +00:00:01 168MB | 80% done - 136 rays/pixel +00:00:01 168MB | 85% done - 119 rays/pixel +00:00:01 168MB | 90% done - 156 rays/pixel +00:00:01 168MB | 95% done - 38 rays/pixel +00:00:01 168MB | 100% done - 69 rays/pixel +00:00:01 168MB | render done in 0:00.070 +00:00:01 168MB | [driver_tiff] writing file `testrender.tif' +00:00:01 168MB | render done +00:00:01 168MB | +00:00:01 168MB | ----------------------------------------------------------------------------------- +00:00:01 168MB | scene creation time 0:00.12 machine utilization (0.40%) +00:00:01 168MB | plugin loading 0:00.10 +00:00:01 168MB | ----------------------------------------------------------------------------------- +00:00:01 168MB | frame time 0:01.83 machine utilization (5.62%) +00:00:01 168MB | node init 0:00.06 +00:00:01 168MB | rendering 0:00.07 +00:00:01 168MB | pixel rendering 0:00.07 +00:00:01 168MB | unaccounted 0:01.69 +00:00:01 168MB | ----------------------------------------------------------------------------------- +00:00:01 168MB | top session self-times by category +00:00:01 168MB | worker waiting 0:00.06 (35.23%) +00:00:01 168MB | InitializeNodes 0:00.04 (25.89%) +00:00:01 168MB | RenderBucket 0:00.01 ( 7.55%) +00:00:01 168MB | surface closure (_default_arnold_shader) 0:00.01 ( 5.74%) +00:00:01 168MB | ray traversal+intersection 0:00.00 ( 4.20%) +00:00:01 168MB | TraceCameraRay 0:00.00 ( 3.78%) +00:00:01 168MB | accumulateBucketSamples 0:00.00 ( 3.36%) +00:00:01 168MB | polymesh::intersect (/sopcreate1/mesh_0) 0:00.00 ( 2.66%) +00:00:01 168MB | standard_surface (_default_arnold_shader) 0:00.00 ( 2.24%) +00:00:01 168MB | ----------------------------------------------------------------------------------- +00:00:01 168MB | top session self-times by node +00:00:01 168MB | worker waiting 0:00.06 (35.23%) +00:00:01 168MB | InitializeNodes 0:00.04 (25.89%) +00:00:01 168MB | standard_surface:_default_arnold_shader 0:00.02 (15.39%) +00:00:01 168MB | surface closure 0:00.01 ( 5.74%) +00:00:01 168MB | ray traversal+intersection 0:00.00 ( 3.22%) +00:00:01 168MB | AiLightsTrace 0:00.00 ( 1.96%) +00:00:01 168MB | TraceShadow 0:00.00 ( 1.40%) +00:00:01 168MB | RenderBucket 0:00.01 ( 7.55%) +00:00:01 168MB | polymesh:/sopcreate1/mesh_0 0:00.00 ( 4.48%) +00:00:01 168MB | polymesh::intersect 0:00.00 ( 2.66%) +00:00:01 168MB | BVH_motion::intersect 0:00.00 ( 1.54%) +00:00:01 168MB | TraceCameraRay 0:00.00 ( 3.78%) +00:00:01 168MB | accumulateBucketSamples 0:00.00 ( 3.36%) +00:00:01 168MB | ----------------------------------------------------------------------------------- +00:00:01 168MB | peak CPU memory used 174.65MB +00:00:01 168MB | at startup 75.51MB +00:00:01 168MB | plugins 3.77MB +00:00:01 168MB | AOV samples 10.01MB +00:00:01 168MB | output buffers 0.39MB +00:00:01 168MB | framebuffers 0.39MB +00:00:01 168MB | node overhead 0.01MB +00:00:01 168MB | message passing 0.13MB +00:00:01 168MB | memory pools 42.05MB +00:00:01 168MB | geometry 0.00MB +00:00:01 168MB | polymesh 0.00MB +00:00:01 168MB | accel structs 0.00MB +00:00:01 168MB | strings 24.25MB +00:00:01 168MB | profiler 0.03MB +00:00:01 168MB | unaccounted 18.11MB +00:00:01 168MB | ----------------------------------------------------------------------------------- +00:00:01 168MB | ray counts ( /pixel, /sample) (% total) (avg. hits) (max hits) +00:00:01 168MB | camera 537600 ( 28.00, 1.00) ( 18.75%) ( 0.28) ( 1) +00:00:01 168MB | shadow 1164522 ( 60.65, 2.17) ( 40.62%) ( 0.00) ( 0) +00:00:01 168MB | diffuse_reflect 573676 ( 29.88, 1.07) ( 20.01%) ( 0.00) ( 0) +00:00:01 168MB | specular_reflect 590846 ( 30.77, 1.10) ( 20.61%) ( 0.00) ( 0) +00:00:01 168MB | total 2866644 ( 149.30, 5.33) (100.00%) ( 0.05) ( 1) +00:00:01 168MB | by ray depth: 0 1 +00:00:01 168MB | total 59.4% 40.6% +00:00:01 168MB | ----------------------------------------------------------------------------------- +00:00:01 168MB | shader calls ( /pixel, /sample) (% total) +00:00:01 168MB | primary 299818 ( 15.62, 0.56) (100.00%) +00:00:01 168MB | total 299818 ( 15.62, 0.56) (100.00%) +00:00:01 168MB | by ray depth: 0 1 +00:00:01 168MB | total 100.0% 0.0% +00:00:01 168MB | ----------------------------------------------------------------------------------- +00:00:01 168MB | geometry (% hit ) (instances) ( init mem, final mem) +00:00:01 168MB | lists 1 (100.0%) ( 0) ( 0.00, 0.00) +00:00:01 168MB | procs 1 (100.0%) ( 0) ( 0.00, 0.00) +00:00:01 168MB | polymeshes 1 (100.0%) ( 0) ( 0.00, 0.00) +00:00:01 168MB | ----------------------------------------------------------------------------------- +00:00:01 168MB | geometric elements ( min) ( avg.) ( max) +00:00:01 168MB | objects (procs) 1 ( 1) ( 1.0) ( 1) +00:00:01 168MB | polygons 6 ( 6) ( 6.0) ( 6) +00:00:01 168MB | ----------------------------------------------------------------------------------- +00:00:01 168MB | triangle tessellation ( min) ( avg.) ( max) (/ element) (% total) +00:00:01 168MB | polymeshes 12 ( 12) ( 12.0) ( 12) ( 2.00) (100.00%) +00:00:01 168MB | unique triangles 12 +00:00:01 168MB | CPU memory use 0.00MB +00:00:01 168MB | vertices 0.00MB +00:00:01 168MB | vertex indices 0.00MB +00:00:01 168MB | packed normals 0.00MB +00:00:01 168MB | normal indices 0.00MB +00:00:01 168MB | uniform indices 0.00MB +00:00:01 168MB | largest polymeshes by triangle count +00:00:01 168MB | 12 tris -- /sopcreate1/mesh_0 +00:00:01 168MB | ----------------------------------------------------------------------------------- +00:00:01 168MB | acceleration structures: (% total) +00:00:01 168MB | list 2 ( 66.67%) +00:00:01 168MB | bvh motion (2 keys) 1 ( 33.33%) +00:00:01 168MB | total 3 (100.00%) +00:00:01 168MB | ----------------------------------------------------------------------------------- +00:00:01 168MB | performance warnings: +00:00:01 168MB WARNING | Rendering CPU utilization was only 6%. Your render may be bound by a single threaded process or I/O. +00:00:01 168MB | ----------------------------------------------------------------------------------- +00:00:01 163MB | +00:00:01 163MB | releasing resources +00:00:02 122MB | unloading 3 plugins +00:00:02 122MB | closing usd_proc.dll ... +00:00:02 122MB | closing alembic_proc.dll ... +00:00:02 122MB | closing cryptomatte.dll ... +00:00:02 122MB | unloading plugins done +00:00:02 122MB | Arnold shutdown diff --git a/testsuite/test_0157/ref/reference.tif b/testsuite/test_0157/ref/reference.tif new file mode 100644 index 0000000000..40cbb0e6c8 Binary files /dev/null and b/testsuite/test_0157/ref/reference.tif differ diff --git a/translator/reader/read_geometry.cpp b/translator/reader/read_geometry.cpp index e0ff3020ed..bbe3602b73 100644 --- a/translator/reader/read_geometry.cpp +++ b/translator/reader/read_geometry.cpp @@ -43,12 +43,80 @@ PXR_NAMESPACE_USING_DIRECTIVE + +namespace { + +/** + * Read a UsdGeomPointsBased points attribute to get its positions, as well as its velocities + * If velocities are found, we just get the positions at the "current" frame, and interpolate + * to compute the positions keys. + * If no velocities are found, we get the positions at the different motion steps + **/ +static inline void _ReadPointsAndVelocities(const UsdGeomPointBased &geom, AtNode *node, + const char *attrName, const TimeSettings &time) +{ + UsdAttribute pointsAttr = geom.GetPointsAttr(); + UsdAttribute velAttr = geom.GetVelocitiesAttr(); + + VtValue velValue; + if (time.motionBlur && velAttr && velAttr.Get(&velValue, time.frame)) { + // Motion blur is enabled and velocity attribute is present + const VtArray& velArray = velValue.Get>(); + size_t velSize = velArray.size(); + if (velSize > 0) { + // Non-empty velocities + VtValue posValue; + if (pointsAttr.Get(&posValue, time.frame)) { + const VtArray& posArray = posValue.Get>(); + size_t posSize = posArray.size(); + // Only consider velocities if they're the same size as positions + if (posSize == velSize) { + VtArray fullVec; + fullVec.resize(2 * posSize); // we just want 2 motion keys + const GfVec3f *pos = posArray.data(); + const GfVec3f *vel = velArray.data(); + for (size_t i = 0; i < posSize; ++i, pos++, vel++) { + // Set 2 keys, the first one will be the extrapolated + // position at "shutter start", and the second the + // extrapolated position at "shutter end", based + // on the velocities + fullVec[i] = (*pos) + time.motionStart * (*vel); + fullVec[i + posSize] = (*pos) + time.motionEnd * (*vel); + } + // Set the arnold array attribute + AiNodeSetArray(node, attrName, AiArrayConvert(posSize, 2, + AI_TYPE_VECTOR, fullVec.data())); + // We need to set the motion start and motion end + // corresponding the array keys we've just set + AiNodeSetFlt(node, "motion_start", time.motionStart); + AiNodeSetFlt(node, "motion_end", time.motionEnd); + return; + } + } + } + } + + // No velocities, let's read the positions, eventually at different motion frames + if (ReadArray(pointsAttr, node, attrName, time) > 1) { + // We got more than 1 key, so we need to set the motion start/end + AiNodeSetFlt(node, "motion_start", time.motionStart); + AiNodeSetFlt(node, "motion_end", time.motionEnd); + } +} + +} // namespace + /** Reading a USD Mesh description to Arnold **/ void UsdArnoldReadMesh::Read(const UsdPrim &prim, UsdArnoldReaderContext &context) { const TimeSettings &time = context.GetTimeSettings(); float frame = time.frame; + + // For some attributes, we should never try to read them with motion blur, + // we use another timeSettings for them + TimeSettings staticTime(time); + staticTime.motionBlur = false; AtNode *node = context.CreateArnoldNode("polymesh", prim.GetPath().GetText()); @@ -69,11 +137,11 @@ void UsdArnoldReadMesh::Read(const UsdPrim &prim, UsdArnoldReaderContext &contex } } } - ReadArray(mesh.GetFaceVertexCountsAttr(), node, "nsides", time); + ReadArray(mesh.GetFaceVertexCountsAttr(), node, "nsides", staticTime); if (!meshOrientation.reverse) { // Basic right-handed orientation, no need to do anything special here - ReadArray(mesh.GetFaceVertexIndicesAttr(), node, "vidxs", time); + ReadArray(mesh.GetFaceVertexIndicesAttr(), node, "vidxs", staticTime); } else { // We can't call ReadArray here because the orientation requires to // reverse face attributes. So we're duplicating the function here. @@ -90,12 +158,8 @@ void UsdArnoldReadMesh::Read(const UsdPrim &prim, UsdArnoldReaderContext &contex AiNodeResetParameter(node, "vidxs"); } - // Vertex positions - if (ReadArray(mesh.GetPointsAttr(), node, "vlist", time) > 1) { - AiNodeSetFlt(node, "motion_start", time.motionStart); - AiNodeSetFlt(node, "motion_end", time.motionEnd); - } - + _ReadPointsAndVelocities(mesh, node, "vlist", time); + VtValue sidednessValue; if (mesh.GetDoubleSidedAttr().Get(&sidednessValue)) AiNodeSetByte(node, "sidedness", VtValueGetBool(sidednessValue) ? AI_RAY_ALL : 0); @@ -173,10 +237,9 @@ void UsdArnoldReadCurves::Read(const UsdPrim &prim, UsdArnoldReaderContext &cont // CV counts per curve ReadArray(curves.GetCurveVertexCountsAttr(), node, "num_points", time); // CVs positions - if (ReadArray(curves.GetPointsAttr(), node, "points", time) > 1) { - AiNodeSetFlt(node, "motion_start", time.motionStart); - AiNodeSetFlt(node, "motion_end", time.motionEnd); - } + + _ReadPointsAndVelocities(curves, node, "points", time); + AtArray *pointsArray = AiNodeGetArray(node, "points"); unsigned int pointsSize = (pointsArray) ? AiArrayGetNumElements(pointsArray) : 0; @@ -235,10 +298,8 @@ void UsdArnoldReadPoints::Read(const UsdPrim &prim, UsdArnoldReaderContext &cont UsdGeomPoints points(prim); // Points positions - if (ReadArray(points.GetPointsAttr(), node, "points", time) > 1) { - AiNodeSetFlt(node, "motion_start", time.motionStart); - AiNodeSetFlt(node, "motion_end", time.motionEnd); - } + _ReadPointsAndVelocities(points, node, "points", time); + AtArray *pointsArray = AiNodeGetArray(node, "points"); unsigned int pointsSize = (pointsArray) ? AiArrayGetNumElements(pointsArray) : 0;