Akuso
31st July 2003 19:54 UTC
yaw movement
I know this has probably been asked before, but I searched for it and since I didn't know what to call it I didn't get anything.
So here's the problem, in a DM I currently have a 3d plane with the formula
z=1.2+y;
x=x/z;
y=y/z;y=y+t; (t=t+.02)
What I want to do is be able to pivot the plane left and right, like your moving forward and turn your head to the side.
Any suggestions?
Akuso
31st July 2003 21:40 UTC
I don't know what that is...
anubis2003
31st July 2003 21:53 UTC
search the forums and the internet. In the website thread(it's prob'ly on the second page) 32849235 posted a good beginner raytracing tutorial - it may help. Also, unconed had a nice post that explained it.
Akuso
1st August 2003 00:09 UTC
DAMN! what kind of math is that?! well I halfway understand it...
but if anyone has nothing better to do, it'd be very helpful if I could see the code doing just the task I'm trying to do. It seemed like alot of the examples were doing complex shapes.
anubis2003
1st August 2003 00:24 UTC
If anybody gave you some code then you would have to give them full credit for it, you know. By the way, did you code what you already have?
Akuso
1st August 2003 00:27 UTC
yeah, but that just simple stuff.
Nic01
1st August 2003 02:02 UTC
Raytracing uses mostly the simple functions, just more of them - Take it piece by piece, you'll understand it.
jheriko
7th August 2003 20:53 UTC
Firstly do the rotations you want on x1=x;y1=y*h/w;z1=1;
Take the plane equation ax+by+cz+d=0 for a general plane and substitute ox+x1*k, oy+y1*k and oz+z1*k respectively and solve for k. k is the 'distance' along the ray which must be traveled to reach the intersection point of the ray and the plane.
ox,oy,oz represent the position of the camera and the rotation angles represent the direction that it faces.
If you want the plane z=0 for instance:
k=oz/z1;
Next you do x=x1*k+ox;y=y1*k+oy; this deforms the texture so that it is smaller for bigger values of k and larger for small values.. giving the illusion of 3D. Adding the camera positions moves the texture to make it look like the camera is moving, the texture is already rotated correctly from the calculations of x1,y1,z1. If you were to render a plane perpendicular to the y axis.. e.g. y=1 then x=x1*k+ox;y=z1*k+oz; would be a better projection to use. Figure it out and play with it.