Tuesday, November 4, 2014

Graphics: Marching Squares - Rendering with Blender



In the previous post, we wrote a Javascript program to compute the contour lines of an object of interest and save the results - a set of (X,Y) coordinates - in a Wavefront OBJ file.
The last step is to render this geometry in Blender [Link] - a very powerful and popular 3D software...

1. ImageJ

Run the Marching Squares script (see previous posts for details [Link]) with this test image (Fig. 1).

Fig. 1: Input test image
For this image, I choose a threshold value of 128 and a square size of 2.0.

2. Blender [Link]


Then, run Blender (I expect you are using a recent version of Blender something like v2.69 or later).

Go to File > Import > Wavefront (.obj) and select your file.

Now, the main steps to correctly display your contour lines consist of:
- Center your object (Mesh > Transform > Geometry to Origin)
- Clean up your geometry (remove doubles) and recalculate normals.
- Add a material.
- Set all the parameters of your scene (Camera, Light,etc.).
- Render and save the output image

Fig.2: Blender and the isocontoured lines of Fig.1. In this view, the camera and light are visible.
Here is a small video explaining how to render your isocontoured lines in Blender...

+++ Movie: Tutorial +++
[TODO]
+++ End of Movie +++

In Fig.3, an example of what you can do with Blender...

Fig.3: Output contour lines rendered with Blender


<<  Previous: the script Next: Wireframe object >>

3. Other crazybiocomputing posts

Further readings are available in ...
  • Computer Graphics Series  [Link]
  • Image Processing TOC [Link]

No comments:

Post a Comment