OpenScad Texture Mapping – 2

It has been a fun journey to look at all the 3D graphics programming books on my shelf and think about how the various techniques can be applied to creating 3D models.  Texture mapping is an interesting technique, but on its own it does not do much for 3D models that you’re going to print.  What you really need are bump maps.  That is, you need to be able to raise and lower vertices based on some value.

This image is a bumpmap created from a simple checker pattern.


Repeated for 8 rows.  Basically a checkerboard pattern.  The imaging library makes it fairly straightforward to get at the values.

What I really want to do is use the checkerboard pattern as a bump map.  For each value in the pattern that is a ‘1’ I want a quad of the mesh to be raised up an amount.  For a ‘0’, I want it to be lower.  The values can be anything, but 0..1 makes it convenient to scale.

At any rate, it’s easy enough to specify a ‘bitmap’ that can be used to alter the vertices in a mesh.  That makes it easy to do something like height maps for terrain.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s