pouët.net

Go to bottom

help with 3d projection/dots bug

category: code [glöplog]
 
hi,
i'm having a really hard time figuring out why this isn't working the way I want it to.
http://nerve.untergrund.net/files/notworking.7z
the problem :
I'm trying to make a 2d dot logo in 3d space which spins about the y-axis (only x and z coords are changing), but the problem is that the dots are moving to the extremities of the screen, disappearing, and reappearing on the other end of the screen.

the function which is the problem :

initvectorballs/drawvectorballs()
at the end of demofx.h
added on the 2013-07-18 12:33:54 by zorke zorke
Check for "dotvectorpos[i][j].z > 0", otherwise you'll end up rendering the dots that are behind you.
added on the 2013-07-18 12:39:58 by Gargaj Gargaj
Are you trying to have the text rotated around it center axis or around the camera?

also, I would advise not to rotate points incrementally, it would be better if you have two sets of points, one fixed and one rotated.


added on the 2013-07-18 19:01:54 by TLM TLM
It helps to multiply x,y by a factor before dividing by z. This has to do with the distance of eye from the screen I think.

for example:
float factor = 128.0f;
tempx=((dotvectorpos[i][j].x * factor) / (dotvectorpos[i][j].z + 128)) + (centerx);
tempy=((dotvectorpos[i][j].y * factor) / (dotvectorpos[i][j].z + 128)) + (centery);

I also did a + 128 to translate z a bit far away. It's just a dirty test to see that it works. You could do this in the place of the code where you have your transformation if you prefer.
added on the 2013-07-18 23:43:19 by Optimus Optimus

login

Go to top