about 4k-procedural-gfx compo back

(L) [2007/04/10] [tbp] [about 4k-procedural-gfx compo] Wayback!

Because of toxie yet again pointing at buenzli gfx compo, and even if i know i won't attend, i got dragged into this silly size optmization business [wave fist]


If i got the rules right, one has 4 (uncompressed) Kbyte and 30s to fill 800x600 pixels.

~3K and 2s later, cross compiling to linux 32 + SDL, i'm at

[IMG #1 ]


I've watched previous entries (toxie's Menger sponge included) and i know it's not enough by far. But i'm quite clueless on the procedural texturing side... so please feel free to tell me how to waste 1K and 28s to make that thing worth looking at
_________________
May you live in interesting times.

[LINK https://gna.org/projects/radius/ radius] | [LINK http://ompf.org/ ompf] | [LINK http://ompf.org/wiki/ WompfKi]
[IMG #1]:Not scraped: https://web.archive.org/web/20071202105208im_/http://ompf.org/gallery/wip/20070410-01-sf4k.jpg
(L) [2007/04/10] [toxie] [about 4k-procedural-gfx compo] Wayback!

pretty cool result!!


but without wanting to disappoint you: SDL is a no-no in the demoscene. So if you should really consider making some prod for the buenzli party you should contact the organisers first to hear if it's okay.


about the texture-stuff: you might want to check my old texture-tool for inspiration: [LINK http://ainc.de/Texture.htm]

otherwise you can already do lots of cool stuff with perlin-noise and some distortion. for "real-life" look you need at least some layers plus fancy combiners.
_________________
The standards are being lowered, not just on the Internet, but in all of news and media.
(L) [2007/04/11] [trh] [about 4k-procedural-gfx compo] Wayback!

<delurk>


I was very much into the demoscene back in my youth, in the DOS days.  All this talk of 4k demos and parties is making me warm and fuzzy inside.  This morning I even downloaded the avi of the winning demo from BP and was impressed.


Although I coded up a few effects I never released anything except for a 256-byte fire competition--I came second, perhaps because I used the FPU which wasn't present on everyone's machines back then. [SMILEY Smile]  Recently I searched the 'net for those little fire demos and although I found references (it was org'd by gaffer of #coders,) I couldn't find the binaries nor source.  Sigh.
_________________
You can't see California without Marlon Brando's eyes.
(L) [2007/04/11] [tbp] [about 4k-procedural-gfx compo] Wayback!

Well, the difference between that procgfx compo and demos is that you don't need game studio grade animators, graphists, composers and tools (ultra specialized and refined crunched included) to jump in, even if it's a bit silly in these days and age to have to limit yourself to one core and an asinine fpu.
_________________
May you live in interesting times.

[LINK https://gna.org/projects/radius/ radius] | [LINK http://ompf.org/ ompf] | [LINK http://ompf.org/wiki/ WompfKi]
(L) [2007/04/11] [greenhybrid] [about 4k-procedural-gfx compo] Wayback!

a bit off-topic, but how you get the binary downto 4k without shrinking/compressing in gcc?

smallest thing i get is something like 30-40 afair...


EDIT: fine render, tbp  [SMILEY Very Happy]
_________________
[LINK http://greenhybrid.net/ greenhybrid.net]

Real Men code Software Graphics.
(L) [2007/04/11] [beason] [about 4k-procedural-gfx compo] Wayback!

Maybe add instancing and have a universe of sphereflakes in bg? Or motion blur? Or glare? (Or lens flare? j/k.) Nice image [SMILEY Smile] I like the normalmapping or bumpmapping... what is it?


Also, this produces a 7k binary when I do "gcc hello.c":
(L) [2007/04/11] [MooZ] [about 4k-procedural-gfx compo] Wayback!

beason : All the links are [LINK http://pouet.net/prod.php?which=30244 here]
(L) [2007/04/11] [toxie] [about 4k-procedural-gfx compo] Wayback!

i also recommend this one: [LINK http://pouet.net/prod.php?which=30284]
_________________
The standards are being lowered, not just on the Internet, but in all of news and media.
(L) [2007/04/12] [beason] [about 4k-procedural-gfx compo] Wayback!

Another idea: since you are doing ray tracing, you could pick a slightly more complex shader such as a mirror or glass (but get ready for some aliasing!)i
(L) [2007/04/12] [fpsunflower] [about 4k-procedural-gfx compo] Wayback!

My 2 cents:


Some perlin noise based procedural would look nice I think (there's a compact snippet on ken perlin's website).



I would love to see an ambient occlusion version of this. With only 28 seconds to spare it would need to be pretty coarse, but then again those rays could be short which should trace faster. You might also be able to get away with skipping the bottom one or two levels of the sphere flake for your probe rays. Those tiny spheres hardly contribute much occlusion.




And finally, perhaps this is a harder than I think, but have you considered the possibility of using some kind of implicit hierarchy? ie: not creating any spheres or acceleration structure - just taking advantage of the regularity of the scene? I did this for the menger cube case and it works quite well. For the spherflake case I could see some sort of recursive spherical BVH with a branching factor > 2 (however many spheres are added per level).
(L) [2007/04/12] [tbp] [about 4k-procedural-gfx compo] Wayback!

[IMG #1 ]


32 samples,  ~16s (with that silly msvc). Should fit the bill size wise even with a bit of blurage.

My distribution is horrific^H^H^Hshort, now the question is does this look - somehow - right for 32 samples?


I'd really like to add some kind of glowy mist/haze/smoke, but a) my first try was a total failure b) everything in the literature sounds expensive (either code wise and/or cycle wise). If you know how to cheat around...
_________________
May you live in interesting times.

[LINK https://gna.org/projects/radius/ radius] | [LINK http://ompf.org/ ompf] | [LINK http://ompf.org/wiki/ WompfKi]
[IMG #1]:Not scraped: https://web.archive.org/web/20071202105208im_/http://ompf.org/ray/wip/pix/20070412-01-sf4k.png
(L) [2007/04/12] [fpsunflower] [about 4k-procedural-gfx compo] Wayback!

Nice! Now you just need the texture back [SMILEY Smile]



For smoke there's a siggraph 2005 paper about doing analytic single scatter fog IIRC. I'm not sure if it can fit your size constraints though. There's a similar tech report that talks about the non-homogeneous case. I haven't really studied the details but this supposedly runs on the gpu in realtime.


[LINK http://www1.cs.columbia.edu/~bosun/sig05.htm]


[LINK http://research.microsoft.com/users/kunzhou/publications/MSR-TR-2007-37.pdf]



I guess you could also do some kind of bloom/glow filter as a post process to achieve something similar?
(L) [2007/04/12] [lycium] [about 4k-procedural-gfx compo] Wayback!

that's quite ok for 32 samples, since your distribution


1. isn't quite diffuse, so doesn't need as many samples for a smooth result (kinda specular, bunched around the normal)

2. seems quasi-random; any more infos?


neat pix ;) 16s is also quite alright for monocore :P


ps. as a final tweak, if you've got a bit of space + seconds left, is to accumulate some aa samples (whole frames) until 30s is out ;) hmm but you're at 32 samples atmo, and there's the cost of accumulation + scaling...


edit:  post-coagulation:
(L) [2007/04/12] [greenhybrid] [about 4k-procedural-gfx compo] Wayback!

tbp: msvc?


tbp with no gcc... I don't understand...
_________________
[LINK http://greenhybrid.net/ greenhybrid.net]

Real Men code Software Graphics.
(L) [2007/04/12] [greenhybrid] [about 4k-procedural-gfx compo] Wayback!

stay in gpl-land with [LINK http://codeblocks.org/] and minGW, old warrior [SMILEY Wink]
_________________
[LINK http://greenhybrid.net/ greenhybrid.net]

Real Men code Software Graphics.
(L) [2007/04/12] [toxie] [about 4k-procedural-gfx compo] Wayback!

really liking the picture now! you thought of putting the thingie into some space-environment? so kinda like a giant abstract spacestation or borg-ship?
_________________
The standards are being lowered, not just on the Internet, but in all of news and media.
(L) [2007/04/12] [lycium] [about 4k-procedural-gfx compo] Wayback!

it should be possible to compute some skylight in a few lines. that'd be a bit more expensive though, and the precompute+bilerp route needs quite some LOC... better check the bit budget first, not that i have any idea how many bytes some snip of code would produce ;)


gotta say, once you get the size compiling thing going it looks like a lot of fun; currently lacking time tho :/
(L) [2007/04/12] [tbp] [about 4k-procedural-gfx compo] Wayback!

Ah! Well @800x600 i think i have 15-20s to waste (need to check what it's supposed to run on tho, doh), and if that's just for filling the missing pixels around the flake, that should be possible.

Got links?


I'll clean it up, but not today, to be sure about the budget. And i'll push the source out while i'm at it (there's no way i'm going to that now, i'm too ashamed).
_________________
May you live in interesting times.

[LINK https://gna.org/projects/radius/ radius] | [LINK http://ompf.org/ ompf] | [LINK http://ompf.org/wiki/ WompfKi]
(L) [2007/04/12] [tbp] [about 4k-procedural-gfx compo] Wayback!

Right. A bit like your sponge compo. Was it done with layers for stars/clouds/moon?

I could cover the screen with anything spherical but i have no idea how you could cheaply generate a nebula tho [SMILEY Wink]


EDIT: Silly me. Tons of little swirling spheres. Hmm...
_________________
May you live in interesting times.

[LINK https://gna.org/projects/radius/ radius] | [LINK http://ompf.org/ ompf] | [LINK http://ompf.org/wiki/ WompfKi]
(L) [2007/04/12] [toxie] [about 4k-procedural-gfx compo] Wayback!

No, not like the sponge. The BG for the sponge was what was possible to do with some few bytes (=stars plus a fake moon plus a gradient).


I'm thinking bigger here: Some real cool nebula maybe? I remember that Frenetic used some pimped Mandelbrot (called Buddha-Brot by Melinda Green) for the nebulas in his 4k Parsec.


With some additional camera work/faking (fisheye-cam?) the sphere-thingie could really look like some cool spaceship i think.
_________________
The standards are being lowered, not just on the Internet, but in all of news and media.
(L) [2007/04/12] [toxie] [about 4k-procedural-gfx compo] Wayback!

and some additional idea/implementation done by frenetic for his 4k:
(L) [2007/04/12] [tbp] [about 4k-procedural-gfx compo] Wayback!

Gniii... I wasn't aware of that Buddha-Brot. Really intriguing (i should have said fascinating to remain on topic).

Well, i can't say i haven't asked for it [SMILEY Smile]

Thanks a lot, i'll ruminate it a bit.


Note to self: check that 4k by Frenetic.
_________________
May you live in interesting times.

[LINK https://gna.org/projects/radius/ radius] | [LINK http://ompf.org/ ompf] | [LINK http://ompf.org/wiki/ WompfKi]
(L) [2007/04/12] [Phantom] [about 4k-procedural-gfx compo] Wayback!

I guess so. Still, I think you should spread them out a bit more; it almost looks like you send 90% straight up.
_________________
--------------------------------------------------------------

Whatever
(L) [2007/04/12] [fpsunflower] [about 4k-procedural-gfx compo] Wayback!

I got a memory free version up and running (in place procedural generation). I will post some images as soon as I think of something pretty to do with it. Level 16 (!) runs at ~1.25fps @ 512x512 on the crappy dual xeon I have here at work. This is in Java, with tons of overhead (running inside Sunflow), one ray per pixel and one shadow ray. With optimizations + a barebones c++ version I think it could be made to run in much much faster. My version cannot assume normalized ray directions for example.


tbp: I used your code from [LINK http://ompf.org/ray/sphereflake/] as a base. It seems the distribution of the spheres isn't totally regular. Its ok for some camera angles but it doesn't look even as you rotate around. Does anyone have the right numbers for the even case ?


Also, using a sphere of 2*r as a bound is a tad conservative. An exact bound makes a fairly large difference (~30%) as you get close to the leaves. I haven't measured the exact impact yet though.
(L) [2007/04/12] [beason] [about 4k-procedural-gfx compo] Wayback!

This will generate the correct cosine weighted direction for AO.

(this is from an in-dev project of mine but is pretty standard). First it

derives U,V,W orthonormal basis pointing along normal (isect.nl), then uses some equations from Shirley's RRT to compute

a sample direction from a cosine weighted pdf:


[code]

   Vec w=isect.nl.norm(), u=w%Vec(1,0,0);

    if (u.dot(u)<01> 1.


...or you can adjust the sampling equations in the code I gave, but I'd have to think more to say exactly how

(maybe skip the sqrt's?).
(L) [2007/04/12] [beason] [about 4k-procedural-gfx compo] Wayback!

This will generate the correct cosine weighted direction for AO.

(this is from an in-dev project of mine but is pretty standard). First it

derives U,V,W orthonormal basis pointing along normal (isect.nl), then uses some equations from Shirley's RRT to compute

a sample direction from a cosine weighted pdf:
(L) [2007/04/12] [beason] [about 4k-procedural-gfx compo] Wayback!

This will generate the correct cosine weighted direction for AO.

(this is from an in-dev project of mine but is pretty standard). First it

derives U,V,W orthonormal basis pointing along normal (isect.nl), then uses some equations from Shirley's RRT to compute

a sample direction from a cosine weighted pdf:


[LINK http://rafb.net/p/MEG7pd49.html]


(sorry to use nopaste, but the code refused to display properly in this forum. sorry for reposts!

edit: percent operator means cross product).


Maybe your shuffling-coordinates technique is better for finding a orthonormal direction than my code,

but you get the idea I hope.


Alternatively you can get a uniform distribution by rejection sampling:


1) pick point in cube (side length of 2) centered at point.

2) reject point (goto step 1) if a) direction is down or b) distance to center > 1.


...or you can adjust the sampling equations in the code I gave, but I'd have to think more to say exactly how

(maybe skip the sqrt's?).
(L) [2007/04/13] [toxie] [about 4k-procedural-gfx compo] Wayback!

There were some articles about 4k intro creation in Hugi-Diskmag (but can't remember which issues).
_________________
The standards are being lowered, not just on the Internet, but in all of news and media.
(L) [2007/04/13] [MooZ] [about 4k-procedural-gfx compo] Wayback!

There was a presentation at asm 2006 about [LINK http://ftp.kameli.net/pub/fit/misc/presis_asm06.pdf Linux 4k intro coding].
(L) [2007/04/13] [greenhybrid] [about 4k-procedural-gfx compo] Wayback!

Outrageous [SMILEY Very Happy]

Thanks boys!


greenhybrid: You gotta check tbp's code above and MooZ's fine pdf, which really looks trés usefull.


EDIT: btw, (before falling into my bed last night) a simple "int main(){  return 0; }" and an "gcc tmp.c" brings a >6k binary with gcc 5.1 and no options
_________________
[LINK http://greenhybrid.net/ greenhybrid.net]

Real Men code Software Graphics.
(L) [2007/04/13] [tbp] [about 4k-procedural-gfx compo] Wayback!

@fpsunflower: My thingy really doesn't ought to be called a sphereflake, it barely looks like one for a given set of views; that's how it evolved out of LOC constraints & empirical tinkering (read: it's crap). On the other hand your results are extremely interesting (and i'm a bit puzzled).


@beason: check the 'Disable HTML in this post' box to cure code mangling. My shuffling isn't better by any means (it's wrong in may cases) but it's shorter. But i'll check if i can afford a more canonical method (or adjustment in distribution). Thanks.
(L) [2007/04/13] [greenhybrid] [about 4k-procedural-gfx compo] Wayback!

hoorah.
_________________
[LINK http://greenhybrid.net/ greenhybrid.net]

Real Men code Software Graphics.
(L) [2007/04/13] [greenhybrid] [about 4k-procedural-gfx compo] Wayback!

that sstrip, does it what the "-s" option also does? (stripping symbols)


EDIT: argh, Windows so evil, it never minds if I use the above parameters or not on an older minGW (afair 3.1) version, "int main() {}" is always 5632 bytes, and for the "void _start()" thingy I might not have the proper tools or knowledge here. Gonna check tbp's sooner post at home (I really don't wanna abuse our db-servers here, my boss is a frequent "history" user^^,..., quick note to myself: install virtual linux machine when school starts again next week^^ HARHARHAR )


Back to xor ax,ax \n div (aka job-affairs)



EDIT II:  finally, 304 [SMILEY Smile]

back