Cryengine LOD creation script in 3ds max
Last active
August 23, 2023 13:22
-
-
Save csprance/ed21190a1b29f8ac71fd81a67209dc80 to your computer and use it in GitHub Desktop.
Lod Tool for CRYENGINE using 3ds max Maxscript and proOptimizer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Define the UI Rollout | |
try (destroyDialog EILodMaker) catch() | |
rollout EILodMaker "Lod Maker" width:150 height:250 ( | |
label lbl_num_lods "Number of Lods" | |
spinner num_lods_spinner "" across:2 offset:[20,0] width:124.05 usePercentageWidth:true percentageWidth:82.7 enabled:true type:#integer range:[0,6,2] | |
checkbox chk_collapse "Collapse?" pos:[18,52] checked:false | |
group "Advanced Options" ( | |
spinner spinner_lod1 "LOD 1" range:[0,100,50] type:#float | |
spinner spinner_lod2 "LOD 2" range:[0,100,24.5] type:#float | |
spinner spinner_lod3 "LOD 3" range:[0,100,11.4] type:#float | |
spinner spinner_lod4 "LOD 4" range:[0,100,4.2] type:#float | |
spinner spinner_lod5 "LOD 5" range:[0,100,3] type:#float | |
spinner spinner_lod6 "LOD 6" range:[0,100,1] type:#float | |
) | |
button btn_exec "Execute" width:150 | |
on btn_exec pressed do ( | |
lodSizes = #(spinner_lod1.value, spinner_lod2.value, spinner_lod3.value, spinner_lod4.value, spinner_lod5.value, spinner_lod6.value) | |
for obj in (selection as array) do ( | |
lodNodes = for idx in 1 to num_lods_spinner.value collect (copy obj) | |
idx = 1 | |
for lodNode in lodNodes do ( | |
select lodNode | |
modPanel.addModToSelection (ProOptimizer ()) | |
lodNode.modifiers[#ProOptimizer].VertexPercent = lodSizes[idx] | |
lodNode.modifiers[#ProOptimizer].KeepUV = on | |
lodNode.modifiers[#ProOptimizer].Calculate = on | |
lodNode.name = "$lod0" + idx as string | |
lodNode.parent = obj | |
idx = idx + 1 | |
deselect $ | |
) | |
) | |
) | |
) | |
createDialog EILodMaker | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment