3DWin and Wavefront Obj


3DWin and Wavefront Obj
#1
Can anyone tell me why 3DWin fails to properly convert this file to LDR?

http://www.mediafire.com/?vko1a15alrurxzp

It shows up fine in meshlab.


Mike
Reply
Re: 3DWin and Wavefront Obj
#2
The only 3D converter that worked reliably for me is Marc Klein's stl2dat. This converter is also available in Mikeheide's LETGUI package, with a nice GUI shell and a bunch of other LDraw tools. Attached your converted mesh. What I did:
- open .obj in meshlab and converted to stl ASCII mode (uncheck "binary")
- convert to .dat using stl2dat with default options. Notice that stl2dat made a mess with conditional lines because the mesh is tiny (1 unit wide -> converted to 1 ldu). So, convert again using "raw" option.
- Upscale the result in MLCad (I used a 25x scaling), this is the raw mesh as attached.
- Processed through Edger2 (included in LETGUI) to create conditional lines
- processed through rectifier to convert planar triangle pairs to quads (look better).


Attached Files
.txt   mesh_lab.zip.txt (Size: 234.88 KB / Downloads: 0)
Reply
Re: 3DWin and Wavefront Obj
#3
How do you scale objects in MLCAD?

And I need the height coordinates to be integers, not decimals. How do I accomplish this?
Reply
Re: 3DWin and Wavefront Obj
#4
Quote:How do you scale objects in MLCAD?
Select everything, then hit the "Enter position orientation" icon (keyboard looking one).
Check "use rotation matrix value", and change matrix 1 0 0 0 1 0 0 0 1 to <scalex> 0 0 0 <scaley> 0 0 0 <scalez>

Quote:And I need the height coordinates to be integers, not decimals. How do I accomplish this?
After scaling, you need to round everything to integers. I think the simplest is to open the file in LDDP. Change decimal accuracy to 0 (tools -> options -> configurations values tab -> editor behavior subtab -> position decimal accuracy = 0). Then select all (ctrl A) and round everything (ctrl D).

Edit: this changes to integers height AND x-z coordinates. I have to simple way to do that only on y.
Reply
Re: 3DWin and Wavefront Obj
#5
Philippe Hurbain Wrote:Check "use rotation matrix value", and change matrix 1 0 0 0 1 0 0 0 1 to <scalex> 0 0 0 <scaley> 0 0 0 <scalez>
Note: that MLCad 3.40 has a bug, where the checkbox for the rotation matrix is not clickable. Use MLCad 3.30 instead.

/Max
Reply
Re: 3DWin and Wavefront Obj
#6
Quote:Note: that MLCad 3.40 has a bug, where the checkbox for the rotation matrix is not clickable. Use MLCad 3.30 instead.
No, this one does work in 3.4. Only the "use rotation vector values" checkbox is disabled in 3.4 (and if I remember well, the feature is buggy in 3.3, works only in 3.2).
Reply
Re: 3DWin and Wavefront Obj
#14
Oh, yes indeed, you are completely right. Sorry, my fault.
Reply
Re: 3DWin and Wavefront Obj
#7
I meant, how do I get integer values simply by scaling? The heightmap is 8 bits, so I should simply be able to scale by 255, right? (The mesh I'm working on now is normalized within a 1 unit cube.)
Reply
Re: 3DWin and Wavefront Obj
#9
Indeed... actually you don't seem to use all values, and vertically scaling by 64 gives only Y integer values.
Reply
Re: 3DWin and Wavefront Obj
#10
Hey,

when you scale by 64 you will get integer values. I do not know why, but the smalest delta in the .obj file is 0.015625 --> 1/64.

Rolf


Attached Files
.dat   mesh_lab64.dat (Size: 346.6 KB / Downloads: 0)
Reply
Re: 3DWin and Wavefront Obj
#12
You guys forgot to rotate the model before scaling, LOL. The model is supposed to be a piece of terrain, so you need to scale the bumpy side.

And I'll answer my own question: no I can't simply scale by 255 to get integer values because the height data is not 8 bit like I thought. It is more. I will need to us LDDP like Philippe suggested.

Sorry if I've confused anyone.
Reply
Re: 3DWin and Wavefront Obj
#8
Hey,

in the .obj file there are only quads. If you convert then 1:1 the file will not be ldraw compatible (893 quad(s) above 3 degrees).

Fits the attached file (scaled by 100) to your ideas?

Rolf


Attached Files
.dat   mesh_lab100.dat (Size: 329.19 KB / Downloads: 0)
Reply
Re: 3DWin and Wavefront Obj
#11
Quote:in the .obj file there are only quads. If you convert then 1:1 the file will not be ldraw compatible (893 quad(s) above 3 degrees).
Looks like stl2dat automatically split to triangles...
Reply
Re: 3DWin and Wavefront Obj
#13
Let me start over.

I've attached the mesh once again, this time normalized to fit within a 1 unit cube.

I want to scale the x and z coordinates by 40960 so that 1 quad = 1 baseplate.

Then I want to scale the y axis by somewhere around ~12000, but then rounded to the nearest 24 units so that the minimum height difference is equal to 1 stud.

It's this last part that is giving me trouble. I haven't found a tool that can do it yet.


Attached Files
.txt   terrain.zip.txt (Size: 128.09 KB / Downloads: 0)
Reply
Re: 3DWin and Wavefront Obj
#15
Hey,

I gave it a try. The z-coordinate is not the best.

Rolf


Attached Files
.dat   wings3d_output.dat (Size: 643.49 KB / Downloads: 0)
Reply
Re: 3DWin and Wavefront Obj
#16
OK, I got the mesh scaled the way I want. (It's attached to this post.)

What settings do I use for Edger2 and Rectifier?

I tried the default settings but there are still conditional lines missing, and there don't seem to be as many rects as the ouput you guys showed me.

[edit]

Also, is there a way to convert an LDR file to OBJ without using 3DWin? I want to eliminate this tool from my workflow.


Attached Files
.txt   terrain_stepped_01.zip.txt (Size: 110.71 KB / Downloads: 0)
Reply
Re: 3DWin and Wavefront Obj
#17
By the way here is a list of programs I had to juggle with over the last few days before finalizing my workflow. Very irritating!

World Machine
Wilbur
3DWin
Wings3D
MeshLab
Blender
MLCAD
LDDP
LETGUI
LDView
stl2dat
MS-DOS
edger2
rectifier

All this simply to create one model!! My head is still spinning from having to learn how they all do (and don't) work!


Mike
Reply
Re: 3DWin and Wavefront Obj
#18
Here's the workflow I used to get to the final state by the way.

FOR NON-STEPPED TERRAIN:

1. Open "worldmachine_project.tmd" in World Machine.
2. Tweak the heightfield if you want. Then export from World Machine as "worldmachine_output.obj".
3. Open "worldmachine_output.obj" in MeshLab.
4. In MeshLab select "Filters" > "Normals, Curvatures and Orientation" > "Transform: Move, Translate, Center". Check the "translate center of bbox to the origin" box and click "Apply" then "Close".
5. In MeshLab select "Filters" > "Normals, Curvatures and Orientation" > "Transform: Rotate". Set the Rotation angle to 270 and click "Apply" then "Close".
6. In MeshLab select "Filters" > "Normals, Curvatures and Orientation" > "Transform: Scale". Uncheck the "Uniform Scaling" box. Then set the X Axis value to 40960, the Y Axis value to 15360, and the Z Axis value to 40960. Click "Apply" then "Close". This dialog is a bit buggy so you will have trouble entering the scaling values.
7. In MeshLab select "File" > "Export Mesh As...". Export the file as "meshlab_output_nosteps.stl".
8. 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_nosteps.stl -ldr -raw
9. Open the model in MLCAD. The model may be upside-down, so rotate 180 degrees around the x-axis if needed.
10. You're basically done. You can do any post-processing you want in LETGUI, such as adding conditional lines using Edger2 or converting triangles to rectangles using rectifier.


FOR STEPPED TERRAIN:

1. Open "worldmachine_project.tmd" in World Machine.
2. Tweak the heightfield if you want. Then export from World Machine as "worldmachine_output.obj".
3. Open "worldmachine_output.obj" in MeshLab.
4. In MeshLab select "Filters" > "Normals, Curvatures and Orientation" > "Transform: Move, Translate, Center". Check the "translate center of bbox to the origin" box and click "Apply" then "Close".
5. In MeshLab select "Filters" > "Normals, Curvatures and Orientation" > "Transform: Rotate". Set the Rotation angle to 270 and click "Apply" then "Close".
6. In MeshLab select "Filters" > "Normals, Curvatures and Orientation" > "Transform: Scale". Uncheck the "Uniform Scaling" box. Then set the X Axis value to 40960, the Y Axis value to 640, and the Z Axis value to 40960. Click "Apply" then "Close". This dialog is a bit buggy so you will have trouble entering the scaling values.
7. In MeshLab select "File" > "Export Mesh As...". Export the file as "meshlab_output_stepped.stl".
8. 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_stepped.stl -ldr -raw
9. Open the LDR file in LDDP.
10. Change decimal accuracy to 0 by going to "Tools" > "Options" > "Configuration Values" tab > "Editor Behavior" subtab and setting "Position Decimal Accuracy" to zero. Then select all (ctrl A) and round everything (ctrl D).
11. Save the LDR file in LDDP.

12. Convert the LDR file to Wavefront OBJ using 3DWin. Export as "3DWin_output.obj".
......3DWin rotates the model again!!!! Stop using 3DWin!!!!......

13. Open "3DWin_output.obj" in MeshLab.
14. In MeshLab rotate the model again if needed because 3DWin changes the rotation when exporting for some reason. Then scale the height by 24 along the y-axis.
15. In MeshLab select "File" > "Export Mesh As...". Export the file as "meshlab_output_stepped.stl".
16. 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_stepped.stl -ldr -raw
17. Open the LDR model in MLCAD. The model may be upside-down, so rotate 180 degrees around the x-axis if needed.
18. You're basically done. You can do any post-processing you want in LETGUI, such as adding conditional lines using Edger2 or converting triangles to rectangles using rectifier.
Reply
« Next Oldest | Next Newest »



Forum Jump:


Users browsing this thread: 1 Guest(s)
Forum Jump:


Users browsing this thread: 1 Guest(s)