Thursday 20 February 2014

Spherical

I've been playing around with meshes in oF and I found a cool algorithm to create a 3d sphere of points using segments and a radius here. I also found a way to scramble the points from the set segment line by changing a variable.

I used the product of the points position relative to the centre of the sphere and an array (see C++ vector) of scaled noise values to change the position of the points.

Once I had the positions moving and changing to noise I added the other drawing modes like applying a subsection of the noise array to entire rows of the sphere.

Then I applied a mesh to the points in the sphere and drew the mesh to screen

I also added a simple UI for control of the object, along with lighting, and colour between the vertices.

At this point it looked a bit like this:



Also I used this method of getting normals for the faces of the object:
for all the vertices in the mesh except the first and last, add a normal at the normalized vector of the perpendicular between the previous and the next vertices.
Then I tweaked the lights a bit and considered the project finished, however I kept having problems with the addon I used to do the UI (ofxSimpleGuiToo) not saving the settings sometimes and not loading them from the XML file correctly (for some unknown reason, I think because its not compatible with oF 0.8.0)

I also wanted to implement some post processing fx. I hunted around for a bit and found ofxPostProcessing, and then implemented it.

By this point ofxSimpleGuiToo was having a conniption and wouldn't do anything that I asked of it and so I decided to upgrade to the elegant but slightly more complex, ofxUI, which is by far the superior technology.

Here are some screenshots of the finished product, along with a demo video:












Spherical Demo from Gareth Dunstone on Vimeo.