Mesh terrain experimentation - Michael Horvath - 2015-08-21
[updated]
I've been experimenting with terrain again for Datsville. The idea is that if the slope of the terrain is lower than a certain value, studs should be applied (currently, 1x1 plates). If the slope of the terrain is greater than that value, the mesh remains smooth and un-studded. The results are interesting, but don't look all that great. I could make better use of World Machine's terracing feature.
You can download the files here:
https://www.mediafire.com/?9j8xdyn8ex8qa94
The file "mesh_wrapper.ldr" is the one to look at in LDView.
[edit]
The project is on GitHub now.
https://github.com/mjhorvath/Datsville
And I wrote a wiki article.
https://github.com/mjhorvath/Datsville/wiki/Heightfields-with-World-Machine
Still a very complicated process however.
Re: Mesh terrain experimentation - Ben Supnik - 2015-08-22
Interesting - was that produced algorithmically or by hand? I've had an idea to try something like this someday - maybe with some kind of rule to randomize the plate and color used on the top surface to create texture.
Re: Mesh terrain experimentation - Michael Horvath - 2015-08-22
I used a program called World Machine to generate the heightfield, and LSculpt to place the bricks.
Re: Mesh terrain experimentation - Michael Horvath - 2015-08-23
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.
RE: Mesh terrain experimentation - Jaco van der Molen - 2021-01-27
(2015-08-23, 4:30)Michael Horvath Wrote: Here's my workflow right now. The scale is increased to baseplate sizes instead of bricks.
"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.
Hi Michael, and others,
Old post, new reply:
Does anyone have a simple landscape (hill) generator for LDraw?
I have been working in LDCad in the past with heightmap generators and Roland once provided a landscape lua script, but none have undergone further development, like this one. Which looks most promising.
I currently have a project that needs some simple hills and I was looking for a way to generate them.
Any ideas?
RE: Mesh terrain experimentation - Gerald Lasser - 2021-01-27
(2021-01-27, 19:49)Jaco van der Molen Wrote: Hi Michael, and others,
Old post, new reply:
Does anyone have a simple landscape (hill) generator for LDraw?
I have been working in LDCad in the past with heightmap generators and Roland once provided a landscape lua script, but none have undergone further development, like this one. Which looks most promising.
I currently have a project that needs some simple hills and I was looking for a way to generate them.
Any ideas?
What size do you need? And what height difference?
RE: Mesh terrain experimentation - Jaco van der Molen - 2021-01-27
(2021-01-27, 20:25)Gerald Lasser Wrote: What size do you need? And what height difference?
I will send you a PM
RE: Mesh terrain experimentation - Michael Horvath - 2021-01-30
(2021-01-27, 19:49)Jaco van der Molen Wrote: Hi Michael, and others,
Old post, new reply:
Does anyone have a simple landscape (hill) generator for LDraw?
I have been working in LDCad in the past with heightmap generators and Roland once provided a landscape lua script, but none have undergone further development, like this one. Which looks most promising.
I currently have a project that needs some simple hills and I was looking for a way to generate them.
Any ideas?
The project is on GitHub now.
https://github.com/mjhorvath/Datsville
And I wrote a wiki article.
https://github.com/mjhorvath/Datsville/wiki/Heightfields-with-World-Machine
Still a very complicated process however.
RE: Mesh terrain experimentation - Jaco van der Molen - 2021-01-30
(2021-01-30, 9:35)Michael Horvath Wrote: The project is on GitHub now.
https://github.com/mjhorvath/Datsville
And I wrote a wiki article.
https://github.com/mjhorvath/Datsville/wiki/Heightfields-with-World-Machine
Still a very complicated process however.
OK, I see. I took a look at World Machine, which is complicated, but for what I can see very interesting.
I'll take a look too at your project.
For now, I will just design my hills by hand, since my model is due delivery.
Thanks!
RE: Mesh terrain experimentation - Michael Horvath - 2021-02-01
(2021-01-30, 12:18)Jaco van der Molen Wrote: OK, I see. I took a look at World Machine, which is complicated, but for what I can see very interesting.
I'll take a look too at your project.
For now, I will just design my hills by hand, since my model is due delivery.
Thanks!
I'm not sure how scriptable all these tools are [ed. from the command line/shell]. IIRC MeshLab can be run using a script from the command line. I don't think World Machine can be.
|