Repository navigation
fix: load scenes with useFileUnits so they are not rescaled to the worker's system units - #306
Conversation
|
Claude review · advisory Reviewed Open: 0 blocking · 0 should-fix · 0 nit. ✅ Nothing blocking. Fix or reply to each thread; the next revision's review re-checks open threads and resolves those it agrees are handled. Resolving a thread yourself also closes it. Later revisions review only what changed. |
|
double checking, do we need changes with cross component tests with this test change ? I think no right, the units should remain the same for those tests.. |
Right, there's no need to change the cross component tests. Scanned the file units of every scene under |
…rker's system units loadMaxFile defaults to useFileUnits=false, which rescales the scene to the session's system units. Workers start 3ds Max under a fresh profile (inches), so scenes authored in other units were rescaled on load. Geometry scales uniformly, but parameters stored in absolute units (Normalize Spline segment length, Path Deform offsets) do not, so those objects change shape. Scenes whose units differ from the worker default now render at file scale, matching interactive 3ds Max. System units are logged before and after load; the log is best-effort and never affects the load. Signed-off-by: wyongzhi <276409147+wyongzhi@users.noreply.github.com>
BatchRenderTest2024.max is authored in centimetres. The previous expected images were rendered after the scene had been rescaled to the worker's inch system units. Re-rendered on 3ds Max 2026 with the scene loaded at file units. Signed-off-by: wyongzhi <276409147+wyongzhi@users.noreply.github.com>
2a8bc34 to
037766c
Compare
What was the problem/requirement? (What/Why)
DefaultMaxHandler.set_scene_filecallsrt.loadMaxFile(file_path, quiet=True)withoutuseFileUnits. The MAXScript default isuseFileUnits:false, which rescales the scene to the current system units, regardless of the "Respect System Units in Files" preference. Workers run 3ds Max under a fresh profile whose system unit is inches, so any scene authored in another unit is silently rescaled on load.Uniformly scaled geometry renders the same, but modifier parameters stored in absolute units do not scale with it. A customer scene authored in centimetres rendered a Normalize Spline + Sweep terrain with a different shape and a Path Deform train at the wrong height on Deadline Cloud, while rendering correctly on their on-prem farm. Nothing in the adaptor logged units, so there was no diagnostic trail.
What was the solution? (How)
rt.loadMaxFile(file_path, quiet=True, useFileUnits=True), so the session adopts the file's units. Per Autodesk docs this does not modify3dsmax.ini.units.SystemType/units.SystemScalebefore and after load. The log is best-effort: a failure to read units is a warning and never affects the load or path mapping.test/integ/test_scripts/batch_render_test/expected_images.BatchRenderTest2024.maxis authored in centimetres (every other integ scene is in inches), so its golden images had been rendered from the rescaled scene. With the fix the scene renders at file scale and the images change:with_state_000differs in 76% of pixels, the sixwith_override_*frames in 20%,cam_only_000andwith_preset_000are unchanged within JPEG noise.Scope: the
3dsmaxbatch/3dsmaxadaptor path only. The 3dsmaxcmd submitter renders via3dsmaxcmd.exeand the V-Ray standalone submitter exports a.vrscene; neither loads a.maxfile through this handler.job_bundle_output_test_runner.pyalso callsloadMaxFilebut is a local submitter test tool, left unchanged.What is the impact of this change?
Behaviour change: scenes whose file units differ from the worker's system units now render at file scale, matching interactive 3ds Max. Previously they were rescaled to the worker's units. Scenes authored in inches are unaffected.
How was this change tested?
Unit tests,
hatch run all:test(py3.10, 3.11, 3.12): 483 passed each.hatch run lintclean.loadMaxFileis called withquiet=True, useFileUnits=TrueIntegration tests,
pytest test/integ -m adaptoron a Windows g5 workstation with 3ds Max 2026 and V-Ray 7: 7 passed, 1 xfailed (pre-existing), 2 failed for environment reasons unrelated to this change (lightmixneeds V-Ray GPU and the headless session had no GPU device;vrmesh_path_remapfails identically on unmodified mainline on this machine).test_batch_render_adaptorpasses with the regenerated images and fails without them.Direct verification on the same 3ds Max 2026 (fresh profile, inches) from work station. Scene authored in cm: spline + Normalize Spline (seg length 20) + Sweep terrain, Box + Path Deform train, measured at frame 7:
useFileUnits:false(before)useFileUnits:true(after)With
useFileUnits:falsethe vertex count changes, so the terrain is reshaped, not just scaled. WithuseFileUnits:trueevery measurement matches the authored scene.Was this change documented?
Commit message / changelog entry. No user-facing docs change needed.
Did you modify schema files?
Is this a breaking change?
No. Output for unit-mismatched scenes changes to match interactive 3ds Max; that is the fix.