# Tag Info

## Hot answers tagged frustum

### How do you make a camera look at a box and ensure all of it is visible?

Take every point (vertex), project them into screen space (basically multiply them with the projection * view * model matrix). After you got this, take every point ...
• 14.5k
Accepted

### Why are clipping planes... plane?

They're planar because that's how the math works out. Classic OpenGL and Direct3D use projection matrices to transform the scene between "world space" and "screen space". "...
• 335
Accepted

### Is Frustum culling still needed today?

Yes. There are times when it is needed still. Its really situational and depends on the details of your game and the other data structures you have in place. (And resolution of your Octtree and such) ...
• 2,353

### Finding the normals of the planes of a View Frustum

Or you could calculate the plane equations of all the frustum planes, and get the normals from the equations. A plane equation has the form: Ax + By + Cz + D = 0 (A, B, C) represents the plane ...
• 507
Accepted

### What dimensions should you use for a perspective projection frustum?

zNear and zFar are measured in world space, not in anything to do with pixels. Their scale will depend on the scale of the ...
• 33.2k
Accepted

### Finding the normals of the planes of a View Frustum

It becomes much clearer if you draw it from a top-down perspective: The normal on the right is simply the direction vector of the camera rotated by -90°-fovX/2 around the y axis and the one of the ...
• 14.5k

### What is the near plane equation in NDC?

In NDC, the clipping planes are a box that goes from -1 to 1. Near plane equation is therefore $Z+1=0$ and far plane $Z-1=0$
• 161

### What dimensions should you use for a perspective projection frustum?

zNear is not really related to field of view. FOV specifies the angle of the frustrum, while zNear describes the distance to the nearest clipping plane. As an example, here are two frustrums with the ...
• 111

### How to set "near" value properly?

If you need to go nuts you can render the scene twice with two cameras, first with a camera set to near=100.0f far=10000.0f and then use a different depth buffer and render on top of the color buffer ...
• 11.7k

### Rendering a mesh in image viewport

The term you're looking for is Frustum Culling. The problem is this doesn't work too well on individual vertices, because a vertex may be required for a face that is inside the frustum even if the ...
• 1,237
Accepted

### Clip shadow frustum to scene bounds

This is how I'd do it: Generate convex hull from all planes Note: this includes both light frustum and scene AABB planes, so there should be a total of 12 planes Note: make sure all planes have ...
• 3,578
Accepted

### Drawn frustum does not match with glm::perspective

Looks like that by luck I found the solution to the problem. I really don't like the glm documentation, was my understanding that glm doc was intentionally skinny since it matches corresponding glsl ...
• 151

### Unity how to make raycaster test only against collider in frustum

Unity definitely has some spatial partitions of their own under the hood of all their physics and raycasting systems, it's very unlikely Unity's actually doing a collision check with every single ...
• 733
Accepted

### Can I get world-space z-near-plane vertices from projection matrix + z-near distance?

Thanks @DMGregory for the pointer in the comments. I'm constructing a fullscreen quad at (x, y, -1, 1) in NDC. Notice z = -1 is ...
• 1,935
Accepted

### Having some trouble with my frustum checking code

Assuming the "inside" of a plane is the opposite side of the plane.normal, the function IsSphereInsidePlane correctly determines if the sphere is completely inside ...
• 388
Accepted

### OpenGL frustum extraction

In openTK you need to transpose matrices to make it work. Green lines are frustum in world space. ...
• 108

### How do you handle large triangles with frustum?

Elimination of large triangles isn't as simple as the vertices aren't on screen then the triangle can't be seen. For an accurate frustum cull, the only valid elimination scenario for your data (...
• 1,100
Accepted

### Frustum Culling: How to calculate if an angle is between another two angles

The best way to solve this is not with trigonometry, but with vector math! I'm going to write some quick pseudocode of what you need to check for difference in angles, if you want the juicy details of ...
• 601
1 vote

### Cubic Voxel Game, Calculate What Chunks are in the Player's View, using 3D chunks?

I later looked up an implementation of this algorithm so I could do it on another thread, I didn't even know it existed and it is actually fairly simple! My implementation still uses a Unity function <...
1 vote
Accepted

### Frustum Culling bug in program

I solved this problem. I added an extra sphere - test. Although the method has errors, but it solves my problem completely. Since this is an editor, it is appropriate here. But there will be a ...
• 127
1 vote

### How to get a camera's frustum information?

One way would be to construct the projection matrix from your info, invert it, and send the 8 device-normalized coordinates of the corners through it. In OpenGL (and I assume Vulkan), those would be: ...
• 2,592
1 vote

### How to clip cut-off using different frustrum than that of original camera? How to cut plane by pyramid shape?

For a simple way of doing it, you’ll need two things: First, you’re looking for the Sutherland-Hodgman Clipping algorithm, or some other type of clipping algorithm. Sutherland-Hodgman is very easy to ...
• 514
1 vote

### Frustum culling takes ages c++

Main ways to speed up frustum culling (and collision in general): simplified bounding: you have AABBs (check) fast collision functions: looks like you are doing this (in progress) spatial ...
• 69
1 vote

### Which three points to use to calculate a frustum plane?

It's not that you can't point the normals randomly inward/outward, as long as you test them appropriately. It's easier to point them either all-in, or all-out so that the dot products of a contained ...
• 3,624
1 vote

### Clip shadow frustum to scene bounds

Here's the approach I ended up implementing: Generate the regular shadow camera frustum (the green box from my question) and only extract the four side planes (up, down, left, right). I only use the ...
• 501
1 vote

### OpenGL: How to map point inside frustrum to normal device coordinates (NDC)?

I think I found answer. I inattentively read article. "Next, we map xp and yp to xn and yn of NDC with linear relationship." So, xn is linear function from xp. (http://www.mathsisfun.com/algebra/...
• 151
1 vote

### How do I construct the planes for my camera's frustum?

Field of View and Aspect Ratio define how much the frustum planes diverge, so a little math should let you define the 4 planes of the viewport... but then you are stuck with plane/plane intersection ...
• 444
1 vote

### How to set "near" value properly?

The artifacts are happening because the resolution of your depth buffer. The near and far values are not only clipping values but also set the resolution of the depth buffer. Think of the depth ...
• 1,891
1 vote

### What library for octrees or kd-trees?

After unsuccessfully trying a couple of the packages mentioned above I found RTree, which is a wrapper around libspatialindex.
• 111

Only top scored, non community-wiki answers of a minimum length are eligible