Skip to content

fix: load scenes with useFileUnits so they are not rescaled to the worker's system units - #306

Merged
wyongzhi merged 2 commits into
aws-deadline:mainlinefrom
wyongzhi:fix/use-file-units
Oct 26, 2026
Merged

wyongzhi merged 2 commits into
aws-deadline:mainlinefrom
wyongzhi:fix/use-file-units

Conversation

@wyongzhi

Copy link
Copy Markdown
Contributor

What was the problem/requirement? (What/Why)

DefaultMaxHandler.set_scene_file calls rt.loadMaxFile(file_path, quiet=True) without useFileUnits. The MAXScript default is useFileUnits: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 modify 3dsmax.ini.
  • Log units.SystemType / units.SystemScale before and after load. The log is best-effort: a failure to read units is a warning and never affects the load or path mapping.
  • Regenerated test/integ/test_scripts/batch_render_test/expected_images. BatchRenderTest2024.max is 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_000 differs in 76% of pixels, the six with_override_* frames in 20%, cam_only_000 and with_preset_000 are unchanged within JPEG noise.

Scope: the 3dsmaxbatch/3dsmax adaptor path only. The 3dsmaxcmd submitter renders via 3dsmaxcmd.exe and the V-Ray standalone submitter exports a .vrscene; neither loads a .max file through this handler. job_bundle_output_test_runner.py also calls loadMaxFile but 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 lint clean.

  • loadMaxFile is called with quiet=True, useFileUnits=True
  • units are logged before and after load
  • a failing units read still loads the scene, still runs path mapping, and emits a warning instead of raising

Integration tests, pytest test/integ -m adaptor on 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 (lightmix needs V-Ray GPU and the headless session had no GPU device; vrmesh_path_remap fails identically on unmodified mainline on this machine). test_batch_render_adaptor passes 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:

authored (cm) useFileUnits:false (before) useFileUnits:true (after)
session units after load cm inches cm
Terrain verts / faces 1417 / 2830 923 / 1842 1417 / 2830
Terrain bbox Z range -492 .. 633 -2.9 .. 38.5 -492 .. 633
TrackPath X extent 2000 787.4 (= 2000 / 2.54) 2000

With useFileUnits:false the vertex count changes, so the terrain is reshaped, not just scaled. With useFileUnits:true every measurement matches the authored scene.

Was this change documented?

Commit message / changelog entry. No user-facing docs change needed.

Did you modify schema files?

  • Yes
  • No

Is this a breaking change?

No. Output for unit-mismatched scenes changes to match interactive 3ds Max; that is the fix.

@wyongzhi
wyongzhi requested a review from a team as a code owner October 23, 2026 23:38
@github-actions github-actions Bot added the waiting-on-maintainers Waiting on the maintainers to review. label Oct 23, 2026
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Claude review · advisory

Reviewed 037766c (changes since 2a8bc34): 0 new, 0 resolved.

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.

@wyongzhi wyongzhi changed the title Fix/use file units fix: use file units Oct 26, 2026
@wyongzhi wyongzhi changed the title fix: use file units fix: Use file units Oct 26, 2026
@wyongzhi wyongzhi changed the title fix: Use file units fix: load scenes with useFileUnits so they are not rescaled to the worker's system units Oct 26, 2026
@seant-aws

Copy link
Copy Markdown
Contributor

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..

@wyongzhi

Copy link
Copy Markdown
Contributor Author

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 test/integ/test_scripts on 3ds Max 2026: BatchRenderTest2024.max is the only one authored in cm, all the others (minimal_test, lightmix, re_enabled_test, re_disabled_test, vray_re_test, vray_vrmesh_remap_test) are inches, same as the worker default, so loading them with useFileUnits=True changes nothing. The other 7 adaptor integ tests passed unchanged on the same machine.

@wyongzhi
wyongzhi enabled auto-merge (squash) October 26, 2026 23:18
@wyongzhi
wyongzhi disabled auto-merge October 26, 2026 23:18
…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>
@wyongzhi
wyongzhi merged commit dd64380 into aws-deadline:mainline Oct 26, 2026
10 checks passed
@wyongzhi
wyongzhi deleted the fix/use-file-units branch October 26, 2026 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting-on-maintainers Waiting on the maintainers to review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants