# Tag Info

## Hot answers tagged clipping

### Why do GPUs divide clip space Z by W, for position?

If you are doing a perspective image and your model has implicit intersections then, if you use "linear Z", those intersections will appear in the wrong places. For example, consider a simple ground ...
• 4,241
Accepted

### How can I check if a polygon can completely contain a circle of a certain radius?

This is likely more complicated than you would prefer, but: Compute the medial axis, which immediately yields the largest disks that fit inside the polygon: their centers are vertices (degree $\ge 3$) ...
Accepted

### Why does opengl perform clipping in clip coordinates?

The space after clip space is normalized device coordinate space, which is obtained by dividing clip.xyz by clip.w. If W is zero....
• 9,792
Accepted

### Maximum number of vertices after clipping a triangle against an AABB

Funnily enough, I asked this exact question on Math.SE a couple years ago: Maximum number of vertices in intersection of triangle with box. The answer is 9 vertices, because each of the 6 planes of ...
• 25k

### Why do GPUs divide clip space Z by W, for position?

Using Z/W for the depth buffer goes deeper than just clipping against the near and far planes. As Simon alluded to, this has to do with interpolation between the vertices of a triangle, during ...
• 25k

### Could we dispense the near clipping plane?

The near clipping plane in rasterizing setups with perspective projection is there to avoid a divide by 0 and bound the possible depths for orthogonal projection. With a bit of extra math you can ...
• 5,950

### Alternatives to Clipping in avoiding display problem

"Go not to the CG Elves for counsel for they will say both no and yes". Yes and No. As noted in another post, these issues don't exist with ray tracing but I'll assume you are interested in ...
• 4,241
Accepted

### Could we dispense the near clipping plane?

The near clipping plane is a fundamental feature of projective rasterization. To borrow a diagram from Eric Lengyel's Projection Matrix Tricks presentation: The displayed region of clip space (that ...
• 3,972
Accepted

### OpenGL layered rendering with multiple additional clip planes per view

The GS is responsible for assigning a particular primitive to a particular layer. The GS is also responsible for writing values for gl_ClipDistance for a particular ...
• 9,792
Accepted

### Maximal and minimal no. of angles obtained from clipping a convex polygon with n angles

Since this is a homework question, I'll give hints rather than a numerical answer. Clipping a convex polygon Think about how many times the polygon can cross each edge of the rectangle. In general, ...

### Worst Case Scenario for Cohen-Sutherland Line Clipping Algorithm

Maybe it helps to draw out the steps of the algorithm. Here is an example for TBLR The red is the worst case: clip top, clip bottom, clip left, clip right. Four steps! The green is the best case: ...
• 131
Accepted

### Why should you do homogenization after clipping?

One good reason to do clipping in homogeneous space is that the perspective division loses the distinction between regions behind the camera and in front of the camera. Points in front of the camera ...
• 25k
Accepted

### Meaning of the parameter in a line-plane intersection in the space

The $t$ parameter represents the distance from the ray's origin point to the intersection point, as a multiple of the ray's direction vector. It is positive for intersections "in front" of the origin, ...
• 25k

### Clipping for perspective projection

3D clipping is usually done in clipspace coordinates, that means the perspective matrix is used for sending the primitives to clipspace before doing the actual perspective projection. You can ...

### 3D coordinates of intersection point in clipping for a rasterizer

I think it depends on what your goal is and what kind of initial data you are provided with. I don't think that dividing by the forth coordinate solves a clipping task. What it does is switching of ...
• 211
Accepted

### What are the outcodes that would be assigned to these points?

The diagram on the Wikipedia entry for Cohen-Sutherland Clipping explains it pretty well: ...
• 3,411

### How to interpolate vertices when clipping?

Points in front of the camera have $w > 0$ strictly, by definition. I would say that if clipping is giving you points with $w = 0$ then something is going wrong. Consider the left/right/top/bottom ...
• 25k
1 vote
Accepted

### Rendering a volume that might be completely clipped in OpenGL

First, regarding the specific problem of bits of the geometry being lost to the near and far planes, this can be solved by using depth clamping instead of depth clipping. This disables clipping ...
• 25k
1 vote

### Using original vertices coordinates after clipping

A vertex consists of not just the position, but all of the values passed from the vertex processing stage to the rasterizer. So if a vertex gets clipped, the new vertices generated in that process ...
• 9,792
1 vote
Accepted

### Fast clipping without clearing stencil buffer

It sounds like what you need is a scissor test. It's specifically designed for clipping against an unrotated rectangle, and should be faster than messing about with the stencil buffer.
• 2,392
1 vote

### Clipping circle and polygon and generate a CAD drawing

I don't know how the clipping library you are using returns the clipped objects, but if I understand your question, you want a way to represent your circles that does not use much memory? If you are ...
• 296
1 vote
Accepted

### Finding vertices of the outer contour of intersecting polygons

Sounds like you’re looking for a way to do a Boolean union operation. There’s a couple of algorithms linked from that article that should do the trick.
• 2,212
1 vote

### Why does opengl perform clipping in clip coordinates?

Clipping could be done in normalised device coordinates as all primitives with z-coordinates outside -1 to 1 are outside the clipping planes. However, there is no reason not to do it in clip ...
• 1,238
1 vote

### How to clip multiple tiled textures to polygon in Webgl / opengl

Quick idea: render platforms color to screen quad render mesh and platforms to screen quad, but as a mask. For example mesh is white, rest is black. in another pass sample these textures and if mask ...
• 2,169
1 vote

### Cohen-Sutherland Clipping

Taken from Wikipedia's article on Cohen-Sutherland: Both endpoints are in different regions: in case of this nontrivial situation the algorithm finds one of the two points that is outside the ...
• 1,566
1 vote

### Data structure and algorithm for clipping triangulation with leaf nodes of an octree

Rather than making one spatial subdivision structure do double duty in representing both the voxels and the triangles, I would suggest creating a separate BVH for the mesh. You can find many articles ...
• 25k

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