Skip to content

Instantly share code, notes, and snippets.

@csprance
Last active August 23, 2023 13:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save csprance/ed21190a1b29f8ac71fd81a67209dc80 to your computer and use it in GitHub Desktop.
Save csprance/ed21190a1b29f8ac71fd81a67209dc80 to your computer and use it in GitHub Desktop.
Lod Tool for CRYENGINE using 3ds max Maxscript and proOptimizer

Create Lods

Cryengine LOD creation script in 3ds max

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 Install

Usage

  • Select the mesh to create lods for
  • Open the LOD tool
  • Adjust the settings
  • Click execute
  • Tadah LODS! Usage
-- 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