Archive for the '3-D' Category

3D Grid, for loop Demo

Saturday, May 7th, 2011

run the sketch—view the code

How do you use it?
Demo to explain nesting for() loops and the pushMatrix() and popMatrix() functions.

What is it?
Mouse around to rotate the cube. Up and Down arrow keys zoom in and out.

Martian Terrain

Sunday, May 25th, 2008

_20080525_MOLA_a1
run the sketch—view the code

How do you use it?
Move the mouse up and down or hit the UP and DOWN arrows to zoom in and out.
What is it?
NASA’s Phoenix probe is landing on Mars tonight! Using some laser altimetry data I created this 3-D model of the Martian terrain.

Kaleidoscope

Tuesday, May 20th, 2008

_20080520_kaleidascope
run the sketch(P3D) (OpenGL)—view the code (OpenGL)—download (OpenGL)

How do you use it?
Follow the on-screen instructions.

What is it?
This is based on the Rudolph helix series from Nov 2007. I’ve been tinkering with it off-and-on for a while so I decided it was time to show off the latest version. This one has an optional GUI layer built into it. This time I’m using the OpenGL renderer instead of P3D (both are posted for comparison). The weird thing is, with OpenGL the transparent pixels in the image are only transparent in one direction. With P3D, the transparency works both ways, but it doesn’t handle z-translations entirely right…

In the P3D version you’ll notice the small “farther away in space” images remain at a reduced size even when they are rotated to the front. I understand why this happens* but I’m not sure how to correct for it. Perhaps I should rotate the camera instead of rotating the coordinate space. Any thoughts?

*P3D is reducing the size of the images that are positioned on the negative z-axis. Similarly, an image with a positive z-coordinate is made bigger. This is done absolutely, without regard for the POV of the viewer; negative z = smaller, positive z = bigger. When you move the mouse left or right, you are spinning the entire coordinate matrix about the y-axis, This eventually brings the negative z-axis to the front and with it come the scaled-down images.

Still More Radar

Saturday, May 10th, 2008

A) _20080510_radar_c
run the sketch—view the code

B) _20080510_radar_3d
run the sketch—view the code

How do you use it?
A) Just move the mouse around, the animation follows it.
B) Move the mouse up and down to rotate the spiral about the x-axis. Hit the spacebar to start or stop rotation about the y-axis.

What is it?
I was tinkering with the parameters of A, and it occurred to me that it should be pretty easy to push it into 3D.

Simple Spiral

Friday, April 25th, 2008

_20080425_spiral_a.png
run the sketch—view the code

_20080425_spiral_b.png
run the sketch—view the code

How do you use it?
Move the mouse up and down to change the tightness of the spiral. In version b, moving the mouse left and right also affects the spacing. Clicking the mouse rotates the whole thing in 3-D space.

What is it?
A quick way to render a spiral.

Why is it cool?
When I had the idea to code a spiral, I assumed it would take days and involve all sorts of calculus and stuff. It took 3 lines of code, a for() loop, and 10 minutes start to finish.

Banner Ad

Friday, April 18th, 2008

_20080417_bannerType.png
run the sketch—view the code

How do you use it?
Move the mouse left and right to spin the informational text.

What is it?
This is an interactive banner ad I created to promote a Processing workshop I am teaching for graphic design students. It uses nested for loops to make the grid and the random() function to keep the colors changing. Actually, I created a grid() function that takes values for X-position and width, so the two chunks of grid seen here are the result of two different calls to grid(). The what, where, and when info spins around in P3D space.

Why is it cool?
The aforementioned grid() is a good example of user-defined functions. Also, I just love playing with type in 3-D space.

pictureTube // actual tube version

Saturday, March 15th, 2008

pictureTube_e2 pictureTube_e1
run the sketch—view the code

How do you use it?
Move the mouse left and right to spin the cylinder. Move the mouse up and down to adjust the pitch. Zoom in and out with “z” and “x”.

What is it?
This is what I was trying to do yesterday. It reconstructs the image by drawing small squares filled with the color of each pixel. Nested for loops parse the 1-D pixel array into rows and columns.

Why is it cool?
It’s nice to have solved the problem I set out for myself, but I’m more intrigued by the “failures” than this one.