pouët.net

Looking for a tunnel

category: general [glöplog]
Do you remember any 256b intro with a curved tunnel? I'm looking for inspiration on how to make a screen spaced curved tunnel.
added on the 2009-02-25 23:26:06 by xernobyl xernobyl
*space
added on the 2009-02-25 23:26:53 by xernobyl xernobyl
a what now sir?
added on the 2009-02-25 23:31:47 by superplek superplek
Tube ?
xernobyl: maybe it's not exactly what you're looking for, but still, may be some help. check it.
added on the 2009-02-25 23:55:43 by unic0rn unic0rn
Actually on a first look it is.
added on the 2009-02-26 00:05:49 by xernobyl xernobyl
And on a second look it isn't... in a way it is. But I already have that. That's just simple raytracing vector math.
added on the 2009-02-26 00:29:50 by xernobyl xernobyl
I always asked myself how the real-time shape-changing wormhole in this one worked... o_o
added on the 2009-02-26 01:07:36 by bdk bdk
(I guess the effect itself could maybe be below 256B...)
added on the 2009-02-26 01:08:33 by bdk bdk
Do you mean the tunnels which center doesn't go straight to the horizon but curves so that you never see the end. A bit like travelling inside a torus in loops, not an endless cylinder. If you mean these tunnels, I do also wonder how they are done with raytracing maths or something. Except if most people do them with polygons.
added on the 2009-02-26 01:19:27 by Optimus Optimus
the 256B is not really a requisite. but it's easier to get to the effect and look at it and think about it ;)
added on the 2009-02-26 02:17:20 by xernobyl xernobyl
Optimus: yes, like traveling inside a torus. "raytracing" (faking) a straigth tube is easy.
added on the 2009-02-26 02:18:58 by xernobyl xernobyl
that code by for the raytraced free directional tunnel is not very optimized btw. For example, you don't need to normalize your ray. Second, you know the nearest intersection, that's the one with the minus sign. Also, you don't need the "2" factor in "b" if you also remove the "4" in delta and the "2" in t2. The abs() in v is making the texture mirror, that's a pity. The delta<0 condition block is useless too unless you are outside the tunnel (but then it's not a tunnel anymore). You also don't need to do the ray rotation per pixel, it's better rotate the corner rays and then interpolate. The c factor is constant for the frame, no need to recompute it per pixel. I guess it was easier for tutorial purposes not to do these last two optimizations.
added on the 2009-02-26 10:58:06 by iq iq
xernobyl: like a doughnut tunnel?
added on the 2009-02-26 13:05:19 by rudi rudi
if anyone come up with a freedirectional doughnut tunnel, please gimme the formulas. :P im to tired to look at the maths behind it, and im too busy .. hah!
added on the 2009-02-26 14:28:48 by rudi rudi
Well, the equation of a torus is (sqrt(x^2+z^2)-r1)^2+y^2 = r2^2. As usual in raytracing, substitute (x0+t*xd,y0+t*yd,z0+t*zd) to (x,y,z) and solve for t.
This results in a quartic equation that can be solved pretty straightforwardly by rewriting it into a product of two quadrics. This is left as an exercise.
added on the 2009-02-26 14:46:43 by 216 216
thx
added on the 2009-02-26 14:50:04 by rudi rudi
i did a torus tunnel once (long ago though)... and I just did it that way, painted a (poly) torus with front face culling and put a camera inside it :-)

Never done any curved tunnel with raytracing (done it for free directional, but straight tunnel), but it should not be all that difficult
added on the 2009-02-26 16:26:54 by Jcl Jcl
I wonder if it wouldn't be easier to perturb the rays and render a normal tunnel. This won't give you an exact torus shape, but it will look curved.
added on the 2009-02-26 16:57:52 by torus torus
torus: I did that in The Cure for Cancer, in the scene from the screen-shot. It was a lot of fun playing around with that :)
added on the 2009-02-26 17:03:12 by kusma kusma
Hehe - nice tunnel. All these beat syncronized distortion effects and jittering overlays make the demo exhausting to view these days.. Now I need something to calm down :-)

added on the 2009-02-26 17:14:40 by torus torus
The tunnel in Humus is more or less what I wanted to start with.
added on the 2009-02-26 17:31:39 by xernobyl xernobyl
I like the ray perturbation idea. Haven't thought that before..
added on the 2009-02-26 19:22:57 by Optimus Optimus

login