   Extracting frustum planes without matrices
  Hello everyone,I'm making a raytracer with a bunch of friends and I'm currently in the process of implementing a view frustum so we can cull objects for the primary ray. The thing is that we are not working with matrices at all, so we are only using the right, up and look vector for all our calculation.I would like to know how to extract the 6 frustum planes with only those 3 vectors and the screen ratio, camera position, etc. but without any view*projection matrix.Thanks in advance for your answer.   
Hello everyone,I'm making a raytracer with a bunch of friends and I'm currently in the process of implementing a view frustum so we can cull objects for the primary ray. The thing is that we are not working with matrices at all, so we are only using the right, up and look vector for all our calculation.I would like to know how to extract the 6 frustum planes with only those 3 vectors and the screen ratio, camera position, etc. but without any view*projection matrix.Thanks in advance for your answer.First off. if you have 3 vectors denoting an orientation, and a positiion, you already have all you need to create the view transform.Matrix4 camera, view;// Camera World Matrixcamera[0] = Vec4(right,0);camera[1] = Vec4(up,0)camera[2] = Vec4(forward, 0);camera[3] = Vec4(position,1);// Inverse Camera World Matrix  AKA View Transformview = camera;view.Invert();Without a projection matrix, however, or at least an FOV angle, near, and far plane depths, you will not be able to. If you do have a FOV, near and far values, you can use some trig to create the planes. You just need to see how they relate to those planes.Plane farplane(forward, -depth) // Hessian normal form where ax+by+cz + d = 0;If you can get the other 4, or 5 if you need to clip against the near plane, then you only need transform these to world space via the camera transform above.   ;  The alternative is not using frustum planes for clipping in the first place. You still need near and far planes (you could technically skip them, use 0 for near and just have the frustum go into infinity by skipping the tests). Also without a FoV and aspectRatio (or a vert and horz. FoV) you don't have a frustum, so you always need those. The method below also assumes a symmetrical view frustum, but so far I never encountered anything else. Only time I wanted that was rendering the same scene to two viewports with and without effects (each viewport showing half the scene).You can calculate the width and height for your frustum for any given distance. Transform your point to camera space (if it's more than one or a few, transform your view matrix to object space) and simply doconst xLimit = xFac*z;if (x < -xLimit) //outside left...if (x > xLimit) //outside right...if (z < near) //too close...Getting those factors:yFac = tanf(FoV * 3.141592f/360.0f);xFac = yFac * aspectRatio;For spheres (vs. points or corners of a box) you need to consider their radius:xSphereFac = 1.0f / cosf(atanf(xFac*2.0f));ySphereFac = 1.0f / cosf(atanf(yFac*2.0f));Your test then needs to calculate xAdjust = radius*xSphereFac;yAdjust = radius*ySphereFac;and testif (x + xAdjust < -xLimit) ...if (x - xAdjust > xLimit)...It's somewhat losing it's elegance for spheres. You could also adjust z by the radius, but then you technically wouldn't cull a sphere but a cube around the sphere (which I guess is perfectly valid since culling isn't pixel perfect anyway).   ;The thing is that we are not working with matrices at all, so we are only using the right, up and look vector for all our calculation.BTW, those 3 vectors actually do describe a 3x3 rotation matrix  so you're using unrolled matrix math without realising it   