Author Topic: What are you working on at the moment?  (Read 139282 times)

0 Members and 1 Guest are viewing this topic.

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1289
  • Karma: 466
    • View Profile
    • my stuff
Re: What are you working on at the moment?
« Reply #520 on: March 14, 2012 »
Just some lines of code to chill out after work.

(a marched cube with perturbed rays)
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: What are you working on at the moment?
« Reply #521 on: March 14, 2012 »
Wow!! :D
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Kirl

  • Senior Member
  • Pentium
  • ********
  • Posts: 1199
  • Karma: 229
    • View Profile
    • Homepage
Re: What are you working on at the moment?
« Reply #522 on: March 14, 2012 »
Awesome!  :updance:
www.kirl.nl
Challenge Trophies Won:

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1306
  • Karma: 96
    • View Profile
Re: What are you working on at the moment?
« Reply #523 on: March 14, 2012 »
Nice stuff.

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1150
  • Karma: 174
    • View Profile
    • Raizor's Dev Blog
Re: What are you working on at the moment?
« Reply #524 on: March 15, 2012 »
That looks great Hellfire, would love to see it in motion :)

How exactly do you perturb a ray? I've never heard of doing that before.
raizor

Challenge Trophies Won:

Offline jace_stknights

  • Amiga 1200
  • ****
  • Posts: 399
  • Karma: 32
  • PEEK & POKE are not MOVEM!
    • View Profile
    • ST Knights WebSite
Re: What are you working on at the moment?
« Reply #525 on: March 15, 2012 »
marvellous!
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: What are you working on at the moment?
« Reply #526 on: March 15, 2012 »
Quote
How exactly do you perturb a ray
Poke it with a stick.
Jim
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4380
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: What are you working on at the moment?
« Reply #527 on: March 15, 2012 »
Kewl screeny Hellfire ... need to see this in motion, too!
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline marlon

  • C= 64
  • **
  • Posts: 38
  • Karma: 15
    • View Profile
Re: What are you working on at the moment?
« Reply #528 on: March 15, 2012 »
HellFire..  WOW!    :clap:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1289
  • Karma: 466
    • View Profile
    • my stuff
Re: What are you working on at the moment?
« Reply #529 on: March 15, 2012 »
Kewl screeny Hellfire ... need to see this in motion, too!
Here you are:
[youtube]6lkHuxAwzhM[/youtube]

And another one using a torus instead of a cube:
[youtube]b8lvcd9KbTk[/youtube]
« Last Edit: March 16, 2012 by hellfire »
Challenge Trophies Won:

Offline Kirl

  • Senior Member
  • Pentium
  • ********
  • Posts: 1199
  • Karma: 229
    • View Profile
    • Homepage
Re: What are you working on at the moment?
« Reply #530 on: March 15, 2012 »
Youtube says video is private!  :protest:


[EDIT] Excellent stuff, would love to hear some theory on this one too. Is it done like your time challenge entry by rendering the cube at various timeframes?
« Last Edit: March 15, 2012 by Kirl »
www.kirl.nl
Challenge Trophies Won:

Offline Dr.Death

  • Senior Member
  • Amiga 1200
  • ********
  • Posts: 433
  • Karma: 8
    • View Profile
Re: What are you working on at the moment?
« Reply #531 on: March 15, 2012 »
Amazing hellfire  :updance:
Proud member of DAWN

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4380
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: What are you working on at the moment?
« Reply #532 on: March 15, 2012 »
K++ for sharing video.

Honestly, this kind of stuff attracts me a lot. Cannot stop looking at the video. True computer art! Do you plan to do anything with the FX yet?

Anyway, great work - as always!
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1306
  • Karma: 96
    • View Profile
Re: What are you working on at the moment?
« Reply #533 on: March 15, 2012 »
Cool stuff hellfire.

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1289
  • Karma: 466
    • View Profile
    • my stuff
Re: What are you working on at the moment?
« Reply #534 on: March 15, 2012 »
Quote from: benny!
Cannot stop looking at the video. True computer art!
Thanks :)

Quote from: benny!
Do you plan to do anything with the FX yet?
No, it was just for fun.
And most 4kb-intros are already full of this stuff since a couple of years :)

would love to hear some theory on this one too.
It's just raymarching a cube which twists around multiple axes.
Raymarching steps along a ray from the camera through each pixel of the screen and tries to find the intersection with the object.
In contrast to raytracing it doesn't compute the exact intersection point with any of those ray/something-intersection-formulars.
Instead it computes the minimum distance to the object at the current position and advances along the ray by this "safe" distance iteratively:
Code: [Select]
// the ray: pos + t * dir
vec3 pos= currentPixelOnScreen;
vec3 dir= normalize(pos - cameraPosition);
float t= 0.0;

vec3 curPos;
const float EPS = 0.01;
const float maxDistance= 10.0; // we certainly didn't hit a unit-cube when we are here.

for (int it=0; it < maximumIterations; it++)
{
    curPos= pos + dir * t;
    float dist= minimumDistanceToCube( curPos );

    // curPos is near enough to the cube?
    if ( abs( dist ) < EPS )
      break;

    // ray didn't hit anything?
    if ( t > maxDistance )
      break;

    // advance along ray
    t += dist;
}

if ( t < maxDistance )
  doSomeFancyShading( curPos );

And to find the minimum distance of a ray with an axis-aligned box at the center:
Code: [Select]
float minimumDistanceToCube( vec3 pos )
{
  // cube reaches from -1..+1 in all directions
  vec3 dist= abs( pos ) - vec3(1.0, 1.0, 1.0);

  // negative distances are inside the cube: clamp to 0
  dist= max( dist, 0.0 );

  // get maximum of dist.xyz
  return max( max(dist.x, dist.y), dist.z );
}
(so we're not rotating the cube but the camera)

To twist the cube around one axis you can simply rotate "pos".
"pos" always rotates around the cube's center (because it's at 0,0,0).
Code: [Select]
float minimumDistanceToTwistedCube(vec3 pos)
{
        // rotation angle according to "x"
        float rx= sin(pos.x + time)*scale;

        // 2d rotation matrix around x
vec3 tmp= pos;
float c = cos(rx);
float s = sin(rx);
        // pos.x keeps constant when rotating around the x axis
pos.y = c * tmp.y - s * tmp.z;
pos.z = s * tmp.y + c * tmp.z;

        // distance to center
vec3 dist= abs(pos) - vec3(1.0, 1.0, 1.0);

        // negative distances are inside the cube: clamp to 0
        dist= max( dist, 0.0 );

       // get euclidian distance to smooth distance at the edges
       // and use a much smaller step size to safely catch the twisted edges
       return length( dist ) * 0.2;
}

The version in the video just rotates around the x, y and z axis simultaneously.
« Last Edit: March 15, 2012 by hellfire »
Challenge Trophies Won:

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1150
  • Karma: 174
    • View Profile
    • Raizor's Dev Blog
Re: What are you working on at the moment?
« Reply #535 on: March 15, 2012 »
Looks great in motion Hellfire!
raizor

Challenge Trophies Won:

Offline Voltage

  • Professor
  • Pentium
  • *****
  • Posts: 857
  • Karma: 53
    • View Profile
Re: What are you working on at the moment?
« Reply #536 on: March 15, 2012 »
Nice colour selection.  The reflections really add a lot to the effect too.

Looks amazing as usual hellfire.  Have you tried adding "blending"?  http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm

This would look awesome blended with something.
Challenge Trophies Won:

Offline Kirl

  • Senior Member
  • Pentium
  • ********
  • Posts: 1199
  • Karma: 229
    • View Profile
    • Homepage
Re: What are you working on at the moment?
« Reply #537 on: March 16, 2012 »
Excellent, thanks for the mini-masterclass in awesomeness! 

2nd K+ from me today!  :buddies:
www.kirl.nl
Challenge Trophies Won:

Offline Pot Noodle

  • Sponsor
  • Amiga 1200
  • *******
  • Posts: 271
  • Karma: 15
  • Computers have lots of memory but no imagination
    • View Profile
Re: What are you working on at the moment?
« Reply #538 on: March 20, 2012 »
Looks good enough to eat  :clap:

Offline axon

  • ZX 81
  • *
  • Posts: 23
  • Karma: 4
  • "solve et coagula"
    • View Profile
    • blog...
Re: What are you working on at the moment?
« Reply #539 on: April 12, 2012 »

A current WIP for a certain party in Easter. Gonna be an invite so I'll actually have to finish it this time too :P

There will also be a huge-ass Displayhack article on it after it's done describing workflow/custom tools/effect implementations/why it's going to be open-source :)

looking forward to this...