FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Topics & Contributions
   Responsive Form, Games
(Moderator: REAS)
   bubbleTexture
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: bubbleTexture  (Read 2111 times)
mKoser

WWW Email
bubbleTexture
« on: Nov 17th, 2003, 10:57am »

i have been playing around with the wonders of texture-mapping lately, and ended up doing a magnifying-glass-like example:
 
http://www.beyondthree.com?chapter=code&project=bubbletexture
 
mikkel
 

mikkel crone koser | www.beyondthree.com | http://processing.beyondthree.com
toxi

WWW
Re: bubbleTexture
« Reply #1 on: Nov 17th, 2003, 3:34pm »

hey mikkel, very cool! but why such complicated code using an "avoider" class? you can achieve the same effect without actually displacing vertices and only altering their Z coordinate. the equation for a unit sphere is x*x+y*y+z*z=r, starting from there you just evaluate each grid point's distance from the lens center and adjust the Z coord. have a look here:
 
http://www.toxi.co.uk/p5/lens/
 
you can change the behaviour of the lens by changing the "curvature" variable in the code. also try negative values (less than -1) to create a pinch effect...
 
hth!
 

http://toxi.co.uk/
Jerronimo

WWW
Re: bubbleTexture
« Reply #2 on: Nov 17th, 2003, 4:48pm »

A displacement lens would work as well.
 
flight404

WWW Email
Re: bubbleTexture
« Reply #3 on: Nov 17th, 2003, 7:35pm »

Toxi is our leader.  Yay Toxi!!!
 
 
mKoser

WWW Email
Re: bubbleTexture
« Reply #4 on: Nov 18th, 2003, 1:00pm »

toxi... you rock, i think we will have to make t-shirts with your name, to honour you
 
but,
 
Quote:
but why such complicated code using an "avoider" class?

When i started fiddling with P5 on sunday, i never intended to make the magifying glass ... i am still priviliged enough to not always know what I am programming (as opposed to setting out a task, and then working to achieve it!) ... the result ended up looking like one of the classical tasks done in java-classes (the magnifying glass), however, the process of fiddling and then suddenly realizing that it looks like a bad breed of the magnifying-glass was enough to make me happy on a sunday!
 
The experience of "ahhh... THAT's how you do it" by looking at the simplicity of your code, could not have been achieved if I hadn't spent time on it myself first!  
 
... so thanks for spending time on showing the programmers approach towards the same result
 
- - - -
 
but sure, i guess i have a tendency of over-complicating things.
 
+ mikkel
 

mikkel crone koser | www.beyondthree.com | http://processing.beyondthree.com
Pages: 1 

« Previous topic | Next topic »