I have done a couple of jobs using ribbons but never got to make something i’ve always found pleasing to me eyes. I’ve seen over the web some guys creating interesting applications for this kind of generative “art”, its pretty used these days and it should, and just like i said a while ago, its beautiful; its very beautiful; things grow. I love to see things grow, and what kind of things grow? how do they grow? i don’t know, but its in my todo-list to find out and use that to upgrade this piece. I want it to have variations, different growing rates, different species and mix it all together and bring something good looking, good enough for realtime and appealing. Hopefully i won’t get bored before i achieve all this. Anyway here’s something i just did. awkward part: i’ve taken a 3d effect and converted it to 2d. uhmm i wonder why?
( this is the updated version of the effect. new scene with more growing things )
After the creation of [We.are.in.Helsinki,3D] i came across a problemwhen using GL_SELECT opengl mode for intersections and picking. I got few complains that when picking a generator the application freezed. I had two options: 1. Make a simplified version of the generator’s spheres to render on the GL_SELECT mode. 2. Create a function that would tell me which object i clicked on using ray-sphere intersections.
I took option 2 and made an example in processing. It uses my own library, Vitamin. Its in the zipfile, make sure it is in the right place.
Explanation:
First i already had my mouse position in 3D. Just had to convert it to world-space and put it in the magic function that would tell me if the ray has hit anything, in this case a sphere. Magic function below:
// This function is part of the VRay class.// Takes a point and a radius and returns number of hitsint intersectRaySphereHits( Vector3 center, float radius ){// Solve quadratic equationfloat a = _direction.lengthSqr();if(a ==0.0)return0;float b = 2.0f *(_point.dot(_direction)- _direction.dot(center));
Vector3 tempDiff = Vector3.sub( center, _point );float c = tempDiff.lengthSqr()-(radius*radius);float disc = b * b -4* a * c;if( disc < 0.0f )return0;int numIntersections;if(disc == 0.0f)
numIntersections =1;else
numIntersections =2;return numIntersections;}
I’ve noticed people have been looking for a obj file importer for processing/java.
Many thanks to Fabien Sanglard for his original code. I’ve added few more things i found to be important to me and added support for JOGL and processing. It runs over part of my framework called Vitamin, so if you are a pure processing user you might want to check the objscene.pde and change the rendering code. I wanted to keep the obj importer independent of any API/Bind, so it can be easily used by different API/frameworks/whatever. Hopefully it will work that way.