- AVS Presets
- Glass Cubes
Archive: Glass Cubes
Raz
30th March 2003 02:35 UTC
Glass Cubes
Well this had the potential for greatness but that collapsed when i realised the major problem. I was originally making a glass rubix cube with 27 separate cubes out of translucent sides using the bnot function but after making 5 i realised it had a tremendouslylow FPS. This is what i stuck with eventually but the FPS is utter shite. I might just scrap it on the grounds that FPS is greatly important. What do you think?
edit: just did this at 2am, realised some wstupid things i did, will change attatchment/repost it very soon.
UnConeD
30th March 2003 02:45 UTC
You could calculate the 'n' value of the scopes dynamically so only the minimum points required is used... oh and why are you using all those effect lists? They are a source of slowdown too.
Oh and use the correct aspect ratio! Your scopes all look squashed in a rectangular window.
anubis2003
30th March 2003 03:00 UTC
I think it looks nice, but it is extremely slow.
Raz
30th March 2003 03:12 UTC
I managed to drag up the FPS quite a bit and made it look even better. I've yet to optimise the code don't worry it will get done. It has that awful "monster" for the 3d rotation in x and y and i've yet to fix aspect ratio. The effect is there though. Fix the code tomorrow need sleep now.
anubis2003
30th March 2003 03:22 UTC
Yeah, the code could definitely use some optimizations. Take out the effect lists and all but one of the render modes(at the beginning). Also, I would try doing the "lighting" a bit better.
Zevensoft
30th March 2003 06:49 UTC
This may be of help.
dirkdeftly
30th March 2003 08:26 UTC
unconed...please...please...please...please...stop bitching about aspect ratios. if it's not fixed by the time the pack is released, then you can bitch. otherwise STFU N00B
shreyas_potnis
30th March 2003 10:36 UTC
raz..what kinda pc do you have, a SUPER COMPUTER?
i dont get even 4 fps on my pc!
please remove all those effect lists with the input/output both set to replace
Zevensoft
30th March 2003 13:44 UTC
Atero, did you even LOOK at my sexy 3x3x3 glass cube?
UnConeD
30th March 2003 14:25 UTC
Atero: here's the deal... I fire up the preset, notice the squashed rotation immediately and it looks ugly to me. I didn't even look at the code.
It takes 5 seconds to fix this and it ruins a preset for me. Just like bouncy camera movement or scopes that are unnecessarily repetitive and or restricted (like using sin(t) and cos(t) for two rotation angles).
Maybe I'll do a grep 'Atero getosc rand %' and see how much comes up?
UnConeD
30th March 2003 14:43 UTC
I suppose this is an error?
z3=z2*(cos(xx))-y2*(sin(xx));
y3=y2*(cos(xx))+z2*(sin(xz));
UnConeD
30th March 2003 14:49 UTC
Used a hexeditor to remove some inefficiencies (fixed the x/y calculation and cached the cosines/sine). Et voilà: the preset goes from 13.4 FPS to 18.4 here.
Raz is lucky all the scopes are nearly the same, so he could simply optimize one and duplicate it around the place, but still it's best to optimize a bunch of nearly-identical scopes from the beginning.
(ignore the £---;, it's there to preserve the length of the code)
Raz
30th March 2003 15:42 UTC
Wow, thanks man. I just finished doing near enough the exact same thing though with the sin's and cos's, jesus i've even used the same variable names for them. maybe ive been staring at your code in wonder too long. You've done the x and y thing differently though and i'm going to presume your way is better so i'll probably combine some things from my way and yours. Thanks a lot though, great optimisations.
this is what i did:
anubis2003
30th March 2003 16:11 UTC
I thought one of you would do this, but yyy and zzz aren't used and they can be removed. Don't know how big of a difference it will make FPS-wise, but it could help
Raz
30th March 2003 17:31 UTC
Now this, i love. It brings the FPS down again a little but it also turns it into a preset and not an idea. I've done a shit-ton of optimising and here it is:
anubis2003
30th March 2003 17:41 UTC
That's nice, but it is a tad slower.
mikm
30th March 2003 19:39 UTC
I like it, but it looks a little to chaotic and fast at times. To me, the silvery ones look better. The glassy one looks wierd at times.
dirkdeftly
30th March 2003 19:57 UTC
no i didn't, cos i was on my uberuberubershitty computer, and seeing as how slow everybody said it was, i wasn't even going to fuck with it.
but i'll look at it now...
as for the look: i think you should be rendering each scope w/maxblend, but adding them to the rest of the picture:
EL (ignore, additive)
.render mode: maxblend
.superscope
EL (ignore, additive)
...
haven't tested it yet, but it's worth a try. the cubes should also change color. lastly: don't use straight up getosc for syncing! use something like (getosc(...)*bignumber)%returns as a replacement for rand(returns).
UnConeD
30th March 2003 21:09 UTC
Hate to sound nasty, but it's still inefficient... divisions are slower than multiplications. So:
iz=(1+(5+z3)*0.3);
x=x3/iz;
y=y3/iz*(w/h);
can be changed into:
iz=0.3/(8+z3);
x=x3*iz;
y=y3*iz*(w/h);
Oh and you should store w/h into some variable onframe, so you lose that division too. Remember that this stuff is being executed for every point (a couple hundred times), so small optimizations in per-point can make a huge difference!
About your 3D scope code... I wonder why you divide z3 by 3. This has the effect of zooming in on the picture (reducing the camera angle) and makes everything looks flatter. Check out the attachment (note: I'm editing, attachment will be in next post), where I quickly modified your preset so it has a normal, 90° field-of-view. Notice how there is much more depth-perception. Anyway you might've done this on purpose, I don't know.
As for the preset, I like the looks, but you should play with it some more. How about you make every cube-surface light on/off onbeat, perhaps in a certain color? Because the cubes are glass, the incorrect depth occlusion won't matter much.
The edges are a nice touch, but the color changes are hardly noticable.
Oh and if you have really loud music, the movement goes pretty nuts: try playing with it some more so it moves at a more constant speed. You can use getspec(0,0,0) as a volume indicator, especially when averaged over time (vol=vol*.9 + getspec(0,0,0)*.1 or something)
I ridiculed Atero's nagging a bit, but it's valuable nevertheless. Using a regular getosc for responsiveness makes you preset respond to only one sample of sound. This is good if all you want is a random-ish number, but not for variables such as rotation and speed, because they'll be too chaotic.
The best way to learn this kind of stuff is to make a moving-particle-like scope. Try making a dot that moves around at constant speed towards a random point, or one that accelerates and slows down in accordance with the beat.
Sometimes, the most important dimension in a preset is time: if a preset doesn't 'flow' nicely, it won't matter how it looks.
UnConeD
30th March 2003 21:24 UTC
(Attachment for post above)
Pixelcraft
30th March 2003 21:34 UTC
Looks great. I like how the central cube that faces the screen is brighter than the cubes on the other sides. Good job Raz,UnConeD and other "remixers.":up:
Raz
30th March 2003 22:02 UTC
Hmm, i'd forgotten about that thanks. I originally did it because i thought it would look too much like my electric cube preset because i started with the same rotations and then modified them so that the z axis was smaller. I divided it by something smaller and additive blended things. Here's what i got now
btw thanks for all your help and comments everyone. You're all great :up:
Pixelcraft
30th March 2003 23:44 UTC
Wow, even better.
Phaze1987
31st March 2003 09:30 UTC
Hah! Sweet preset(s) ! Raz I WANT YOUR PACK !
shape
31st March 2003 17:58 UTC
I optimize some there, get 60fps in docked...
optimized points num,
optimized rotation algorithm.
But my answer is late...
Raz
31st March 2003 18:14 UTC
thanks man, great optimisations. I'd already done the cos and the sin thing but i hadn't done the n optimisations. Thanks :up:
unripeLemon
31st March 2003 19:38 UTC
:eek: God, it is slow. On my computer it's 1 frame per second
Raz
31st March 2003 19:46 UTC
I have the tossest of computers and it runs at 13 with all the optimisations that i've done but not posted.
unripeLemon
31st March 2003 19:53 UTC
I think that this post has had the most exchange of presets I have ever seen!