Archive: Trouble with 3D superscopes...


14th September 2002 22:58 UTC

Trouble with 3D superscopes...
I have a tiny (well gargantuan actually) little problem with an avs preset i'm working on at the moment, it uses 3d superscopes to draw a dodecahedron by using 12 cycling superscopes to draw the specific vertices. anyway, getting to the point, whenever one of the polygons cross the viewing plane to 'behind' the view i get these skatchy looking lines all over the place from the perspective calculation (i assume).

Does anyone know how I can remedy this with out sacrificing the ability to look from the inside of the polyhedron out. I'm gonna keep playing with this myself but if anyone has any ideas please tell me or even better find me a solution.

If you want to look at the preset it is attached, also if you want to see some other stuff i've done with the dodecahedron (stuff that works) look at my avatar and here.

Thanks in advance.


15th September 2002 02:06 UTC

Not to be cynical or sarcastic, but think about it: The lines in the back are always being drawn. If you go INSIDE the dodecahedron, will you be able to see the lines behind you?

You'd probably have to sacrifice the ability to look at them from inside, because the alternative (turning the color off when a point goes behind you) would be pretty ugly at the edges when entering the dodecahedron.


15th September 2002 08:14 UTC

Shouldn't be a problem. Just make so that if point is behind the viewing plane make it black, otherwise, it's white. A simple if statement on your z value should do the trick. Set render mode to max blend though, or you'll end up with parts of your white lines being overwritten with black ones.


15th September 2002 10:57 UTC

firstly, it isn't drawing the lines for the back surfaces as if they were really close and turning the color off and using maxblend is quite buggy too, I was just kinda hoping that there was some glaringly obvious solution that I had missed.


15th September 2002 11:24 UTC

Sorry: I really should have put this in the last post but my edit time has probably expired (it is 3 minutes isn't it) :(

I did do a spherical ssc before in one of my packs which worked almost flawlessly without any of these cacky bugs and was viewed from the inside, i didn't even need to make a work around, it just worked.

Anyway, I forgot to attach these almost fixes (one of which is pretty close and the other one does practically nothing)


15th September 2002 22:57 UTC

I assume that your superscopes are 6 point pentagons, correct? (I haven't seen it, my computer is being kinda buggy at the moment). If so, the reason it'd be buggy when you go through it is because those lines will distort when they go behind the camera. In the sphere they still distort, but very little because they are so short.

And it's 3 hrs, not 3 mins.


15th September 2002 23:07 UTC

thanx for that, i'll remember the edit thing lasts longer in future. If anyone cares enough I wouldn't mind losing one to my post count for that.

In answer to your 'kind of' question my pentagons use six points (otherwise i would only be able to define 4 lines) but they don't use the circle method, instead i used a variable that increments 'per pixel' and is set to -1 at the beginning of every frame and if statements to say where the points should be so that I could define each vertex exactly. This way I could make the vertices line up perfectly and make use of some nice mathematical shortcuts to ensure that everything was calculated as swiftly as possible. For instance, rather than using a unit dodecahedron or something similar I used a dodecahedron with side lenght sqrt(5)-1 which greatly simplifies all of the expressions for the coordinates so it was quicker to type them out and easier to read the code since all of the coordinates are in terms of 1, -1, 0 phi, -phi, 1/phi and -1/phi where phi is the golden ratio (1+sqrt(5))/2. Anyway, I'm waffling, I know far too much about maths (and not enough about programming) for my own good. Thank you for the feedback.


17th September 2002 01:04 UTC

Interesting... beats my dodecahedron with complicated coordinates, but mine does have filled in pentagons :).

This is still just a prototype, it's not optimized or interesting to watch.


17th September 2002 02:05 UTC

i'm not a big fan of coding things like filled pentagons, the only way i've figured of doing them seems just to boring to do. i alwys like to make my presets quickly. its seems you've used the method for your dodeca that i have tried to find an alternative to.

also, is there an easy way to make filled triangles since i have some nice easy co-ords for an icosahedron too:
(+/-1,0,+/-phi)
(0,+/-phi,+/-1)
(+/-phi,+/-1,0)
where phi is the golden ratio 0.5*(sqrt(5)+1) and +/- is read + or -

the reason why these co-ordinates are quite simple is because the icosahedron is the dual of the dodecahedron (you take points in the centre of each pentagon to get the vertices of an icosahedron), this isn't the dual of the dodecahedron i used tho. the relationship is important because pentagons have a relationship to the golden ratio, if you make a five pointed star and put the pentagon in the middle you find that the triangles are golden. do that on the faces of a dodecahedron and you get a stellated polyhedron with the golden ratio pretty much built into it, you can then use this shape to get those nice dodecahedron co-ords.

anyway, i'm gonna work on some more polyhedra and maybe make a polyhedron minipack or something :)

if you want to see what I ended up doing with the dodecahedron go here


18th September 2002 13:29 UTC

Filling them is shouldn't be too hard... just split up your polygon and render it as a triangle strip. The only bugger is getting an equal spread of lines across the shape.

As you can see in my preset, one 'triangle' of the pentagons is brighter, because it gets half of the points. I can fix that easily because all pentagons are regular and I know the ratio between upper and lower part, but for more random shapes it'll be tricky.


20th September 2002 02:56 UTC

here is an icosahedron made using the co-ordinates above with some cheap clipping code and filled triangles. took me about an hour to make this, thats a long time for me to spend in a preset.

now that i've made it i am really unsure as to what i should do with it...

is there anyway i can make this render faster??