Mesh terrain experimentation


Re: Mesh terrain experimentation
#4
Here's my workflow right now. The scale is increased to baseplate sizes instead of bricks.

Quote:#summary Current steps on how I create heightmaps using World Machine and import them into LDraw.


= FOR NON-STEPPED TERRAIN =

# Open "worldmachine_project.tmd" in World Machine or create a new project.
# In World Machine select "World Commands" > "Project World Parameters...".
# In the "Render Extents and Normal Build Resolution" tab make sure that the "Resolution" setting is set to 128x128 and that the "+1" box is checked. Checking the "+1" box will change the resolution to 129x129. This is OK.
# Also make sure that the "Lower Left Coordinate" setting is set to 0.000000 and 0.000000 and that the "Upper Right Coordinate" setting is set to 1.000000 and 1.000000.
# In the "General Setup" tab make sure that the "Maximum Elevation" setting is set to 0.375000 and that the "Base Elevation" setting is set to 0.000000.
# Also make sure that the "Dimensionality" setting is set to "World Machine Units".
# Continue to tweak the other heightfield parameters if you want. Then export from World Machine as "worldmachine_output.obj". Make sure the "Allow common-edge flip" setting is checked when exporting.
# Open "worldmachine_output.obj" in MeshLab.
# In MeshLab select "Filters" > "Normals, Curvatures and Orientation" > "Transform: Move, Translate, Center". Set the X and Y axes to -0.5. Click "Apply" then "Close". You may have trouble with the text input fields as they are buggy.
# In MeshLab select "Filters" > "Normals, Curvatures and Orientation" > "Transform: Rotate". Set the Rotation angle to 90 degrees around the x-axis and click "Apply" then "Close". The terrain should be pointing "down" at this point.
# In MeshLab select "Filters" > "Normals, Curvatures and Orientation" > "Transform: Scale". Make sure the "Uniform Scaling" box is checked. Then set the scaling factor to 128 for all three axes. Click "Apply" then "Close". This dialog is a bit buggy so you will have trouble entering the scaling values.
# Perform the same step again, except set the scaling factor to 640.
# In MeshLab select "File" > "Export Mesh As...". Export the file as "meshlab_output.stl".
# Using the command prompt or a batch file convert the STL file to LDR using "stl2dat.exe". An example of the command line looks like this: {{{stl2dat meshlab_output.stl -ldr -raw}}}
# Open the model in MLCAD. The model may be upside-down, so rotate 180 degrees around the x-axis if needed.


= FOR STEPPED TERRAIN =

# Run the LDR file through my program "terrain_stepper.js". An example of the command line looks like this: {{{cscript terrain_stepper.js meshlab_output.ldr -n 240}}}
# Open the LDR model in MLCAD. The model may be upside-down, so rotate 180 degrees around the x-axis if needed.
# All triangle vertex coordinates should be integer multiples of 8 at this stage. If you see any decimal values, then you may need to round the numbers using LDDP.


== TO CREATE A "STAND-IN" VERSION OF THE MESH ==

# Use "terrain_splitter.js" to split the mesh into 16 pieces. It is located in the "helper_scripts" folder. There should be some batch files in the same folder or in the parent folder that can be edited to do this job.
# Use "terrain_colorer.js" on the sixteen pieces to alternately color each triangle. It is located in the "helper_scripts" folder. There should be some batch files in the same folder or in the parent folder that can be edited to do this job.
# Use "Edger2.exe" to add edge lines around contiguous areas. There should be some batch files in the "helper_scripts" folder or in the parent folder that can be edited to do this job.

"Stepped" just means that height coordinates have been rounded to integer multiples of 24LDU, or the height of a LDraw brick. I wrote three tools "terrain_stepper.js", "terrain_splitter.js" and "terrain_colorer.js" to process the heightmaps after they have been imported into LDraw. They are available in the Datsville code on Source Forge.

LSculpt doesn't work at baseplate scales, unfortunately. I haven't worked out what to do about that yet.
Reply
« Next Oldest | Next Newest »



Messages In This Thread
Re: Mesh terrain experimentation - by Michael Horvath - 2015-08-23, 4:30

Forum Jump:


Users browsing this thread: 1 Guest(s)