[Plugin] Bitmap To Mesh
-
@dave r said:
I wonder if it would be possible to have a control to somehow limit the range in the gray scale. Perhaps any RGB value less than, say, 250,250,250 gets read as 0,0,0? Or perhaps no height is assigned? Perhaps it isn't possible but I wonder.
It's technical possible to read values lower than 250 as 0, but I don't quite get why?
Though you can do it in PS (or similar) by adjusting the Levels.)I have an idea of how to make the mesh less spiky though, but it needs some experimenting.
-
I was just thinking that setting some limit so that everything is either black or white and not shades of gray would get rid of the spikes.
Would it be possible to work things so that a face is created only if the value is less than some set point (250,250,250?) and the face is always at Z=0? Delete coplanar edges between faces and you'd have a raster to SKP converter.
-
I like that idea
Kind of Footprint or Ink Stamp tool, lots of uses for it too!
-
@dave r said:
I was just thinking that setting some limit so that everything is either black or white and not shades of gray would get rid of the spikes.
The spikes you see if much due to the extreme height of the mesh, and part due to the current triangulation. I'm not sure if making the contrast bigger will reduce then - in either case, Ruby isn't efficient for image manipulation - you'd be just as well off just preparing the image before in an proper image editor.
@dave r said:
Would it be possible to work things so that a face is created only if the value is less than some set point (250,250,250?) and the face is always at Z=0? Delete coplanar edges between faces and you'd have a raster to SKP converter.
It'd be an interesting new tool, but I still think it's best if the image is prepared by the user in an editor and made into complete Black and White (not grey scale).
Then the tool could read all the white or black and generate a mesh - where it could then afterwards trace the outline and remove the interior lines. After running an curve simplification, like the Douglas-Peucker algorithm, and you could end up with a decent vectorized shape from your raster mask.
This would have been so much better if I could read the alpha channel of PNG files. I was a looking at this some time ago, but existing too many third party libraries for my comfort which makes redistribution more complex. The alternative, making a pure standalone ruby PNG interpreter wasn't so easy either, the decompression algorithm wasn't the easiest.
-
Well, it's all voodoo to me so I am glad we have folks like you.
-
Version 0.2.0b
- Made into a tool so the user can easily position the mesh
- Moved menu to
Draw > Mesh From Bitmap
- Keeps aspect ratio of image or
Image
element - Right click and
Image
element to generate a mesh. (Does not need to be BMP image - butDraw > Mesh From Bitmap
still require BMP imput) - Colour BMP images will convert the RGB value to optical greyscale.
- VCB support
-
Test using sample maps from: http://www.mtgrafix.com/programs/terrain.html
Also tried this: http://www.twisteddirt.com/TutorialStuff/dem_02.php Nice terrain shape - but the diffuse texture wasn't so good.
-
-
308px × 1 047px - that would make the mesh ~500-600K faces?
And the issue with that bitmap is that despite it being a greyscale, it's still not a height map - which is why the mesh doesn't come out looking as what the image illustrate.
-
Yes, true. I just wanted to test it - the file is 105 MB
-
Yea - the last texture I tested was 512x512 - heavy mesh. And I'd forgotten that Autosave was on - every 5 mins. x_X
-
-
-
Why don't I get the Curve Simplification to work?
-
hm... possibly you have a version where it failed on closed loops. I might not have uploaded a corrected version...
-
So I notice these wonderful meshes created. How is one controlling the height of the extrusion?
-
The pieces on the roof (above the pediment) are made with your plugin
Reconstrucción del Templo de Artemis Agrotera 4 by Egocentrico, on FlickrClick here to see it in bigger size (1024 px):
http://www.flickr.com/photos/28798115@N00/5053994977/sizes/l/in/photostream/
-
So I read the posts and then thought nothing of trying a 2048x2048 heightmap produced by L3DT (terrain generating program.) Maybe I should try a bit smaller at first. Then I won't just freeze sketchup and make my patience run out...
I will try with a smaller (much smaller) one first and post the results.
Bryan
-
@unknownuser said:
So I notice these wonderful meshes created. How is one controlling the height of the extrusion?
Color, the darker the black and brighter the white will produce the greatest crests and troughs.
-
After letting a 384x384 (meters) heightmap simmer:
Advertisement