14
votes
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 ...
10
votes
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$) ...
9
votes
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 ...
9
votes
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....
7
votes
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 ...
5
votes
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 ...
4
votes
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
votes
Parametric line intersection test
Hint:
The three coordinates can be handled independently.
For instance in $x$, you need to solve
$$x_0 + t (x_1-x_0) = 0$$
and
$$x_0 + t (x_1-x_0) = x_{max}$$
4
votes
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
votes
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 ...
3
votes
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: ...
3
votes
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 ...
3
votes
Outcodes in Cohen-Sutherland Clipping Algorithm
The outcodes just represent four boolean flags as a bitfield. Codewise it is easier to move a bitfield around than four booleans. Functionality-wise it becomes very easy to check if any bits are set (...
3
votes
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, ...
2
votes
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, ...
2
votes
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 ...
2
votes
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 ...
2
votes
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:
...
2
votes
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 ...
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 ...
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 ...
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
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.
1
vote
Clipping circle and polygon and generate a CAD drawing
If Clipper has the capability of working with tagged edges (i.e. such that you can associate some label to every edge of the input polygons and retrieve these labels after clipping), then you can tag ...
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 ...
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.
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 ...
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
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
clipping × 32opengl × 7
polygon × 5
3d × 4
geometry × 4
rendering × 3
rasterizer × 3
algorithm × 2
mathematics × 2
computational-geometry × 2
projections × 2
data-structure × 2
raytracing × 1
c++ × 1
gpu × 1
webgl × 1
performance × 1
perspective × 1
interpolation × 1
triangulation × 1
directx × 1
pixel-shader × 1
cad × 1
stencil-buffer × 1
legacy-opengl × 1