Art, Design , Science , Music, Crazy , and most of all ramblings
Take a blanket. Fold like that. It’s nice. Shame it falls off when you start jumping around.
Here is the set! (vame is my alter ego)
Neil Quigley – Illusion (Jalabee Cartel Remix)
Fatboy Slim vs. Fedde Le Grand – Praise You (Fatboy Slim vs. Fedde Le Grand Remix)
Digital Mess – Miss The Reason
Richard Grey & Maboo Inc. vs. Todd Terry – Somethings Going on 2010 (Antranig Remix)
Melleefresh, Deadmau5 – Sex Slave (Original Mix)
Distance – Night Vision
Infusion – Dogtown (Bass Kleph Steamed Up Extended Remix)
Alex Gopher With Demon – Wuz
Digital Freq – Disco Falls (Original Mix)
Frederik Olufsen-Basement Insomnia
Extrude effecs. Everyone loves them, right?
I am going to divide this up into three parts. The first part is explaining what I want to create. I want to create a mesh on the xy plane that has its geometry aligned to a spline. If you look at the picture, you can see the geometry generated.
Now, we kinda need a technique for doing this. First of all, we need a spline. There is different spline techniques out there. I choose to go for a spline technique called “catmull-rom splines”(cat-spline for shorts). The nice thing about cat-splines, is that the spline(read curve), will go through all the control points.
I also had the code for cat-splines laying around. The cat-spline works like this, it takes in four points and a value t, it then spits out a point that is laying on the curve that goes through all of these points.
To support more than four points in a cat-spline, we need some hacks. Let’s say we have 50 points, and we want to access this spline with a t ranging from 0 to 1. When t = 0 , we want the first point to be returned, when t = 1.0 we want the last point to be returned, and when t = 0.5 we want the 25th point to be returned. We also want all points returned from this, to be on a continious line, touching all our points in the spline.
With me so far? Allright. The way I’m doing this, is to generate four indices into the array of control points on the spline. These indices is calculated based on the t value, and the length of the control point array. I then calculate a new t value, that I’ll call localT. localT is a value that goes from 0 to 1 for only these four control points that we’ve chosen. I then plot that in to the cat-spline function, and get my result.
If this makes no sense, don’t worry. The code for it is in the example.
Okey. We’ve got a spline that can chug out points. We need to create geometry to go along this spline. By geometry, I mean a bunch of quads aligned along the spline, just like in the picture. I’ve gone for an approuch that keeps the extrude in the xy plane. Basically, I generate a vector that goes from the current point on the spline, to the previous one. Let’s call this the tangent. What we really need, is a vector that is pointing 90 deg away from the tangent, i.e normal to the tangent.
This vector, I’ll call sideVector, because it will be used to define the sides of the current quad we are making. After we have a technique to get the sideVector, all we need to generate points to make a quad, is to generate p1 = pointOnSpline + sideVector*width , and p2 = pointOnSpline – sideVector*width.
Well, that’s just two points, we need four. Say we got p1 and p2 at t = 0.0 . Our next set of points p3 and p4 is then calculated further ahead on the spline, say t=0.001 . We connect p1 and p2 with the p3 and p4, and we have four points that make a quad.
The code for doing this can look a bit iffy, but if you work through it on pen and paper, you’ll se it makes sense.
Now, the final part. the extrude part!
The extrude effect is really just a shader effect. What I have done, is to use the color channel to store the t value of the vertex. That is, in the red of the color channel, there is values ranging from 0 to 1 depending on where on the spline this vertex is.
The fragment shader reads this color, and also reads a value seed, which describes how much of the spline to be rendered. By adjusting/animating this seed value, one gets the extrude effect.
My shader also has the option of adjusting the length of the extrude. This can turn it into a snake like effect.
The important part of the shader code looks like this:
float4 original = tex2D(_MainTex, uv);
float lightIntensityR = step(i.color.r,_Seed) * (1.0f -step(i.color.r, _Seed – _FlowLength));
_Seed decides how much of the spline to fill, flowlength enables the snake effect and opas is if one whishes to make everything a bit transperant.
If one is worried about too much alpha blending, one coud do this effect with discard instead of alpha blending. I did it with discard when I first tried out the technique in OpenGL and glsl.
so here is the project ready for download. Open up example scene. It should be simple enough to get your head around. Just ignore all the assets not in use. To get a look at the effect in action, the gamblingExample scene is your friend. the gamblingExample scene is the same one that I linked to up at the top.
If you have any questions or feedback, drop me a comment! Peace out, make cool stuff, have fun!
Let me tell you a story about a little magical device I once came across. It could do wonders, it could … oh , well fuck it, I’m not in the mood for writing a “fairytale intro”, I got tired of that idea after writing the first sentence.
Yeah, the device in question is a mobile phone, an Android mobile phone. I hate it with passion.
Android in itself is great. The phone is supposed to be great. It is great on paper, it is also great when it behaves, but it behaves like a 5 year old crackhead throwing out tantrums in the same speed that speedmetal drummers smash drumskin.
I get “android.core.lolololol” is not responding at least once a day. Opening up contacts takes about 30 seconds 70% of the times. All in all, it’s just very very unresponsive. It’s like someone daterape-drugged it.
I’ll have to get samsung support to fix this. Or become rich. If I become rich, I’ll take pleasure in throwing the phone hard hard into the asphalt and smash it repeatedly! Just thinking about it gives me a warm fuzzy feeling.
Sample this awesome song.
Post song in comment.
Winner as decided by me will win a yo-yo that can be claimed by coming on a visit.
There is nothing serious about this at all, just a little excuse to get your music programs up and cracking.
For lazy people, I have sampled this from youtube and made it into a wav. Might clip a bit, cause I was lazy when recording. oops:
If someone is tired of their trash can, then we know what to do with it!
Make the hobo’s portable party kit!
What would you do with a trash can?
I’ve also enabled a new way of posting comments to the blog, in theory, you should be able to post comments with ease as long as you slide the button to prove that you’re not a machine high on viagra. Try it!
Alright, you’ve read about swype? there was a way to get swype on androids, but it’s not on the market or anything. I’ve been thinking that the core idea in swype sounds brilliant. I’ve found SlideIT on the market, and it is an alternative to swype. If you want to test out how to type with sliding, give it a go. I’m liking it so far. Quite nice technology. This was of course written on my android phone with SlideIT
*Add; link to someones youtube video of using SlideIT, looking at it, you’ll understand what the heck I’m talking about: