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?
yaw movement
9 posts
...learn to raytrace? 😛
I don't know what that is...
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.
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.
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.
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?
yeah, but that just simple stuff.
Raytracing uses mostly the simple functions, just more of them - Take it piece by piece, you'll understand it.
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.
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.