Anyone know of a way to make spikes? I mean deforming say a sphere to have some nasty spikes to have the "bacteria" look.
Like these pics:
http://www.blackpawn.com/blog/?p=65
I was thinking of using an exponential function though you may have a better alternative.:*)
Thanks!
What about finding the midpoint of the faces then extruding them out then subdivide the faces while making sure that the "point" stays at a fixed initial location. This would be kind of hellish to code though. If I remember correctly most subdivision routines will degrade the length of the 'spikes" over time so you will want to keep resetting the initial point vertex with each iteration.
So it comes down to
select face to extrude
find center and extrude the face into a square or triangluar pyramid
remove the original face
/ the recursive part
subdivide pyramids with attention to connecting polygons at their bases
reset the initial point vertex (stretch it back into place)
The image with the "knobs" looks like the faces were extruded as prisms rather than pyramids. After the prisms were extruded their extruded face was scaled up a bit (bending the connecting sides outward) then the thing appears as if it was subdivided again.
You are one hell of a better programmer and code than me rel, just chipping in my 2 cents from my "I'm going to do 3D art!!!" days.
Mabye something like, 2 spheres, both have the same center, and at some choosen points/cricles while drawing, you jump from one to the another one. This one would give you the example 1 column 2 row.
If you wanted 'real' spikes you might just use more spheres ( many near the smallest ones, few near the biggest ). That shouldn't be hell to code, but i don't know what the visual effects would be.
Quote from: relsoft on January 11, 2008
Anyone know of a way to make spikes? I mean deforming say a sphere to have some nasty spikes to have the "bacteria" look.
Like these pics:
http://www.blackpawn.com/blog/?p=65
I was thinking of using an exponential function though you may have a better alternative.:*)
Thanks!
I cant be sure relsoft, but it looks to me like the spikes are created by periodic tan functions displacing the vertices (they have the shape of tan curves). Twists could be done in any number of ways. Just pop an email to blackpawn (Jim) and ask him.
Aagh I have a better guess. lol. Blackpawn likes d3d, not OGL so maybe hes doing something *very* simple.
He gets a primitive from d3d (sphere, cylinder etc), then displaces some points (say every 4th point). Then he passes the resulting shape into d3dx subdivision routines which would result in curvy spikes. <- this is a very cool size coding idea :-) I may try it.
Taj
very nice pictures...looks like he's pulling the vertices out of a standard sphere, after first tesselating each face to have lots of polygons. Takes a little imaginaton to come up with those things, but it doesn't look like rocket science. For instance the spiky sphere - as taj says, move every vertex in the tesselated sphere out along its radius based on tan of the distance it is away from the original vertices (before tesselation).
Jim
Quote
For instance the spiky sphere - as taj says, move every vertex in the tesselated sphere out along its radius based on tan of the distance it is away from the original vertices (before tesselation).
If I use a tangent function to do the spikes, I would need to limit my parameters to like 0 to 90 or 180-270 degrees since the slope of the an angle is only positive on the 1st and 3rd quadrants. Do you mean that I interpolate my distance(since that would be my parameter to tan) so that it has a value of just 0 to 90?
EDIT: I don't even need to interpolate or limit my angles at all. All I have to do is to limit my Y - axis' values to only positive values. Yay!
On second thought, I believe y = exp(x) would never work as I would only get one spike. So taj and Jim has the right idea here. I'll try this in 2d first when I get home to the boondocks.
Frea: Thanks, though I seem to have problems visualizing it.
PO. Not really. Right now you're probably better than me. :*)
Guy's I haven't coded anything since Marvelous twilight so treat me as a noob. :*)
Yep, It works.
const PI as single = atn(1) * 4
cls
'' 640 x 480 screen
screen 18
pset(0,400)
for x as integer = 0 to 640
dim as single y = tan(x*PI/180)*5
line -(x,400+-abs(y)), 15
next x
sleep
Though the spikes look too skinny for my tastes.
Thanks guys!