perjantai 27. toukokuuta 2011

mTerrain v1.0 (3DS Max to Unity plugin/script)

Intro
- 3DS Maxscript that exports 3DS Max mesh to Unity terrain
- Whats nice, you a have full control of the terrain mesh in 3DS Max
(edit as much as you like, stack modifiers, edit few/single vertices etc..) & then easy export to Unity)

- This plugin/script doesnt generate any terrains, use 3DS Max or external software for that


Requirements
- 3ds Max 2008+



Download
- (link coming soon..)


Donation

- Feel free to donate and suggest ideas : ) --> Paypal Donation button on the side -->

Licence

Creative Commons License
- mTerrain is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License

Installation

3ds Max Script Installation- Copy mTerrainMaxV10.mse to your 3ds Max scripts-folder (usually c:/program files/autodesk/3ds max 20xx/scripts/)
- Run the script from 3DSMax menu: Maxscript / Run script... browse for the script, select it and run.
- Now go to menu:
 - Customize / Customise user interface
 - Go to "Toolbars" tab
 - Group: Main UI, Category: mTerrain
 - Drag the script from the cction list named "mTerrain" to your toolbar (existing or create new)

3ds Max Script Setup - First Run
- Click the mTerrain button without any objects selected
- This will open mTerrain Setup Window, fill in the values (You can see the values in Unity, from menu: Terrain / Set resolution )
 - Unity Heightmap resolution: ___
 - Unity Terrain height: ___
 - Unity project asset folder: ____ (this is the folder where your mterrain-textdata-asset will be saved)
 - Click "Save settings"
- Done

Unity Script Installation

- Import mTerrainV1.package
- Inside the pacgate you get 2 scripts:
 - mTerrainObject.js (can be anywhere in the project tree)
 - mTerrainEditor.js (its in editor/ folder)


Usage / Tutorial #1


3ds Max : Creating terrain
- Select the plane
- Press "mTerrain" button
- Wait...(progressbar is shown)
- Done, go to Unity..
Unity : Getting 3DS Max terrain
- Select your terrain (which has "mTerrain.js" attached)
- Drag mTerrainAsset to mTerrainAsset in inspector window (under mTerrain script, its the terrain height values)
 - Note. You can rename "mTerrainAsset" to keep it, new imports are saved again as "mTerrainAsset"
- Press "Update mTerrain"
- Wait...
- Done (your terrain should look like the one in 3DS Max)

- Create plane
- 2000x2000 (same size as your Unity terrain)
- 512x512 segs (Important. 512 in Max is 513 in Unity, so its minus 1, if you use different resolutions)
- Modify your plane to make terrain (for example, add a wave modifier)
- Or use included sample displacement map with displacement modifier

Unity
- Start new project or use your old one
- Add unity terrain to your scene
- Check Terrain / Set resolution.. settings (they must match the values you have used in 3DS Max)
- Add mTerrainObject.js script to your terrain (drag & drop the script to terrain)

 

After those you can keep modifying the 3ds Max plane and update it in Unity when needed
Go back to 3ds Max
- Modify your plane
- For example: add noise modifier
- Press "mTerrain" button (1 object must be selected when exporting, if nothing is selected, setup window is shown)


Go back to Unity
- Select your terrain
- Press "Update mTerrain" in the inspector
- Note. You need to click "apply materials" in TerrainTools, to get the correct textures in slopes etc.


Feedback

- Feel free to send ideas and bug reports

-----------------------------------------------------------------------------------
Images

Setup screenshot



sample mesh in 3DS Max (using displacement modifier with heightmap)
Same in Unity