CRYENGINE Lods Maxscript
During my work on Miscreated it was a common task to have to create LOD's for most props/weapons/characters. So I found a way to automate this in 3dsMax using the standard toolset provided with Max.
I present to you an automated Cryengine LOD creation script in 3ds max using maxscript and ProOptimizer.
Installation
- Open up the MaxScript Editor from within 3ds max
- Paste in the CreateLODS.ms code
- Select all the code in the MaxScript Editor
- Drag and Drop the code into the toolbar
- Adjust button to needs
Usage
- Select the mesh to create lods for
- Open the LOD tool
- Adjust the settings
- Click execute
- Tadah LODS!
CreateLODS.ms
-- 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