Thingiverse
Texture Mapping in OpenScad! by WilliamAAdams
by Thingiverse
Last crawled date: 3 years ago
Recently on the OpenScad discussion alias, I was trying to explain how I could do my own lighting calculations if given half a chance. Altough it's not really a possibility for the current OpenScad renderer, I got to thinking. Even though I can't print in multiple colors (yet), I can certainly liven up my OpenScad renderings a bit.
This thing is a set of imaging routines for OpenScad.
The general principle is fairly straight forward. First you need an image to be converted to a format that OpenScad can understand. In the included .zip file, there is such an executable. Just run:
ImageConverter.exe imagename > name.scad
This will generate something that looks like:
imagename_triplets_array = [0,0,0, 1,2,3, 255,255,255];
imagename = image(width, height, imagename_triplets_array)
There is a new function here: image() which takes parameters necessary to just package up some stuff for later usage in functions.
The crux of the routines is actually: image_getpixel(img, x,y)
This will return a color value at that point in the image. Nice and handy.
But, when you're using images of varying sizes, you don't use pixel coordinates directly, you use normalized values (between 0..1)
So, there is another routine: image_gettexel(image, u, v)
In this case, the 'u' and 'v' values range from 0..1
That's handy when you're displaying on a bezier surface for example, or a sphere, or anything else that's parametrically defined. You just need to supply the parametric values, and when you go to draw a particular facet, change the color for that facet, and voila!! You've got texture mapping.
Just for kicks, there is a luminance() function. What good is that? Well, that allows you to turn an rgb value into a single grayscale value. If you can do that, then you can't be that far away from having a height map generated out of an image.
Put it all together and you can take a picture of yourself, convert to OpenScad form, generate a height map, create a mesh that matches the height field (need to do some work for that one), and print out a 3D relief of your face!! Poor man's scan/print if you will.
At any rate, it's not complete, and you'll find that you use images of any significant size, your machine will crawl for literally hours.
But, if you go back and look at the various font libraries, where you're typically generating 'images' that are 16x12 or something small like that, then suddenly life becomes way easy.
If I were into actually contributing to the codebase of OpenScad, rather than just commenting on it, I would suggest that making the array lookups really fast to enable stuff like this without making the machine crawl, would be a very good investment.
UPDATE: 21092011
Added blog entry: http://williamaadams.wordpress.com/2011/09/21/openscad-texture-mapping/
This thing is a set of imaging routines for OpenScad.
The general principle is fairly straight forward. First you need an image to be converted to a format that OpenScad can understand. In the included .zip file, there is such an executable. Just run:
ImageConverter.exe imagename > name.scad
This will generate something that looks like:
imagename_triplets_array = [0,0,0, 1,2,3, 255,255,255];
imagename = image(width, height, imagename_triplets_array)
There is a new function here: image() which takes parameters necessary to just package up some stuff for later usage in functions.
The crux of the routines is actually: image_getpixel(img, x,y)
This will return a color value at that point in the image. Nice and handy.
But, when you're using images of varying sizes, you don't use pixel coordinates directly, you use normalized values (between 0..1)
So, there is another routine: image_gettexel(image, u, v)
In this case, the 'u' and 'v' values range from 0..1
That's handy when you're displaying on a bezier surface for example, or a sphere, or anything else that's parametrically defined. You just need to supply the parametric values, and when you go to draw a particular facet, change the color for that facet, and voila!! You've got texture mapping.
Just for kicks, there is a luminance() function. What good is that? Well, that allows you to turn an rgb value into a single grayscale value. If you can do that, then you can't be that far away from having a height map generated out of an image.
Put it all together and you can take a picture of yourself, convert to OpenScad form, generate a height map, create a mesh that matches the height field (need to do some work for that one), and print out a 3D relief of your face!! Poor man's scan/print if you will.
At any rate, it's not complete, and you'll find that you use images of any significant size, your machine will crawl for literally hours.
But, if you go back and look at the various font libraries, where you're typically generating 'images' that are 16x12 or something small like that, then suddenly life becomes way easy.
If I were into actually contributing to the codebase of OpenScad, rather than just commenting on it, I would suggest that making the array lookups really fast to enable stuff like this without making the machine crawl, would be a very good investment.
UPDATE: 21092011
Added blog entry: http://williamaadams.wordpress.com/2011/09/21/openscad-texture-mapping/
Similar models
thingiverse
free
OpenScad Height Maps v0.5 by WilliamAAdams
...ifold. i plan to improve the general text handling aspects later. but, the basic height mapping technique will remain the same.
thingiverse
free
Height Mapped Polyhedra in OpenScad by WilliamAAdams
...date:
ok, i got unlazy, and actually included the proper mesh renderer, so you can in fact make solid things from your bump maps.
thingiverse
free
3D Cosine Wave With Nifty Colors by AudreyTheAwesome
...s you can do with the function for the colors, and i didn't want to upload code for each one, so i took a lot of screenshots.
thingiverse
free
Height Maps in Banate CAD by WilliamAAdams
...b. meshlab was kind enough to remove the duplicate vertices for me. i'll have to do that within banate cad itself some day.
3dwarehouse
free
RAT
...rk and say ' uh oh it seem that you're not connected to the internet.' when i just googled it and i do have internet.
thingiverse
free
Generic Slotted Base by WilliamAAdams
... curves that aren't simply carved out by cyclinders.
the default gap on this thing will accomodate 1/4" plywood (6.5mm).
thingiverse
free
Impossible Sphere High Res OpenSCAD by GregFrost
...l, so i made a higher resolution openscad version. the scad allows you to parametrically specify the tolerance between the parts.
thingiverse
free
Candle Stick Adapter (Parametric) by CodeCreations
...out twice the size of the hole. you'll probably want to tweak the parameters in the openscad file for your particular needs.)
thingiverse
free
small parts bins parametric by jn1
...ht, otherwise the curved section will go above the wall height. i did not include code to keep the raduis below the wall height.
thingiverse
free
parametric cable clip by tecdroid
... diameter, length and height of the clip, distance between clip and wave, number of revolutions on the wave.. just try and print.
Williamaadams
thingiverse
free
Toy Panel by WilliamAAdams
... most basic pieces of the klikko math system. it is a builder system where you can click panels together to form various shapes.
thingiverse
free
Yazzo by WilliamAAdams
...the connectors. the openscad file allows you to parameterize these connectors, and create any sizes you might want to play with.
thingiverse
free
Gandhi Lithophane by WilliamAAdams
...a lithophane of gandhi on a stamp.
any number of lithophane prints can be made by simply changing a file name in the .fab script.
thingiverse
free
Yazzo Servo Linkage by WilliamAAdams
...elative sizing of things. by default the arm is 1/2" thick to match the size of the sleeve bearing that's at the joint.
thingiverse
free
Faceted Drinking Cup by WilliamAAdams
...se for quite some years, but i was getting thirsty, so i designed this simple cup to test out printing with translucent filaments
thingiverse
free
Yazzo UClip Keyed by WilliamAAdams
...tandard key on the edge of it, so that you can attach something, or a number of things to it by sliding the key into their notch.
thingiverse
free
Cobra Chair by WilliamAAdams
... curves, and see how the curve reacts. it would probably be much easier to model with a different type of curve, but here it is.
thingiverse
free
Coaster Blob by WilliamAAdams
...s a convenient blobby cup holder. put some sticky rubber feet pads on the bottom, and it will make a nice addition to your desk.
thingiverse
free
Yazzo Female Clevis by WilliamAAdams
...mm plastic filament probably. good enough for prototyping. printing on its side would probably be best for structural strength.
thingiverse
free
Simple Tetrahedron by WilliamAAdams
....
this thing is a simple vertex constructed from vinyl tubing. there are no actual files, only pictures that show the technique.
Openscad
thingiverse
free
OpenSCAD sphere
...openscad sphere
thingiverse
basic project for openscad.
thingiverse
free
Openscad Football by KySyth
...openscad football by kysyth
thingiverse
openscad not tested
thingiverse
free
Openscad Apple by KySyth
...openscad apple by kysyth
thingiverse
openscad apple = not tested
thingiverse
free
Plugs with openscad by benengel
...plugs with openscad by benengel
thingiverse
plugs with openscad and fontawesome
thingiverse
free
Openscad spirals by mafmuf
...openscad spirals by mafmuf
thingiverse
just fooling around with openscad.
thingiverse
free
Practice on OpenScad by ajensen906
...practice on openscad by ajensen906
thingiverse
a very crude practice on openscad
thingiverse
free
Batteries in OpenSCAD by roman_hegglin
...batteries in openscad by roman_hegglin
thingiverse
common batteries as modules for openscad.
thingiverse
free
OpenScad Propeller by KySyth
...se
trying to make a propeller with openscad = not tested
this is some of the results
added the openscad file but still need work
thingiverse
free
Openscad Cloud by Twanne
...openscad cloud by twanne
thingiverse
openscad cloud.
size can be adjusted
thingiverse
free
Geomag for OpenScad by vicnet
...geomag for openscad by vicnet
thingiverse
openscad file to design geomag things.
Mapping
3d_ocean
$5
Map
...map
3docean
geography map ocean travel world world map
a world map
3d_ocean
$5
Old Map
...old map
3docean
dirty map ocean old map paper pirates rotten travel world map
an old map
turbosquid
$3
Map
... available on turbo squid, the world's leading provider of digital 3d models for visualization, films, television, and games.
3d_ocean
$3
Map of Iran
...map of iran
3docean
flag iran map outline
an outline map of iran
3d_ocean
$2
Map of the USA
...map of the usa
3docean
america flag globe map united states usa
an outline map of the usa
3ddd
$1
Abstract Maps
... город , picture
abstract maps by artist jazzberry blue
3d_ocean
$5
Honduras Map
...honduras map
3docean
3d cinema4d honduras map mapa
honduras map designed in cinema 4d r17
3d_ocean
$2
Map of Germany
...map of germany
3docean
black country europe germany gold map outline red yellow
a simple outline map of germany
3d_ocean
$2
Map of Australia
...map of australia
3docean
australia banner country down under earth flag globe map ocean south
an outline map of australia
3d_ocean
$2
Map of Russia
...of russia
3docean
asia banner earth europe flag globe map russia russian federation siberia sovjet union
an outline map of russia
Texture
3d_ocean
$5
Textured Plaster Seamless Texture
...fect for gaming and animation. created from photographs. texture, bump, normal jpg maps are all included in this download! enjoy!
3d_ocean
$6
Texture Bundle
...s i have and will make these six textures were made in photoshop and may requier photoshop or programs like photoshop to edit ...
3d_ocean
$4
Tile Textures
...le dark easy green grungy mosaic mosaic textures mosaica pattern texture tileable tiled tiles
8 colored tileable mosaic textures.
3d_ocean
$5
Textured Ceiling Plaster Seamless Texture
...tion. created from photographs. texture, displacement, normal jpg maps are all included in this download! displacement map can...
3ddd
$1
texture wood
...texture wood
3ddd
texture wood
3ddd
free
Wood texture
...wood texture
3ddd
wood texture
3d_ocean
$3
Wool texture
...wool texture
3docean
seamless wool texture
3ddd
$1
classic texture
...classic texture
3ddd
high resolution texture
3ddd
$1
Concrete texture.
...concrete texture.
3ddd
бетон
concrete texture.
3d_ocean
$12
Granite texture
... (each in separate png file, 2400×1500 px) and one large tileable texture with bump/displacement and specular map (6000×6000 p...