22 votes
Accepted

How are mipmap levels computed in Metal?

Mip selection is pretty well standardized across devices today—with the exception of some of the nitty-gritty details of anisotropic filtering, which is still up to the individual GPU manufacturers to ...
Nathan Reed's user avatar
  • 24.7k
10 votes
Accepted

What is bilateral upsampling?

It seems like you're asking two things. I can't really speak technically about JBU, but I can give an overview of the necessary concepts and bilateral filtering generally. You'll probably need to ...
geometrian's user avatar
  • 1,920
8 votes

The mathematics of two dimensional interpolation on a quad

(It actually is easier to think (and compute) about this with triangles, but for the sake of the answer, let's first stick to your quad example.) For this you just have to define the point you're ...
Christian Rau's user avatar
8 votes
Accepted

Is a cubic Lagrange interpolation tensor product the same as bicubic interpolation?

It turns out that no, while you can use bicubic Lagrange interpolation for bicubic texture sampling, it isn't the highest quality option, and probably not actually likely to be used. Cubic hermite ...
Alan Wolfe's user avatar
  • 7,721
6 votes
Accepted

Is there a way to interpolate color across the line with only integer calculation ?`

Yes, it is possible to use only integer calculations. I will describe how, but bear in mind that the difference in speed between integer arithmetic and floating point arithmetic is not as great as it ...
trichoplax is on Codidact now's user avatar
6 votes
Accepted

How do I use barycentric coordinates to interpolate vertex normal?

Thats the way your defining the vectors. See your defining vectors $V_1$ and $V_2$ as pointing outwards from the point $P_2$. Now then $denom$ is the square of the area of the parallelogram of formed ...
joojaa's user avatar
  • 8,377
6 votes
Accepted

Determining Rational Quadratic Bezier Curve Weights for Circle

Check out the section on Circular Arcs and Circles, from Ching-Kuang Shene's excellent computational geometry course notes: [G]iven three control points P0, P1 and P2 such that P0P1 = P1P2 holds, if ...
gilgamec's user avatar
  • 881
6 votes

What causes blobby edges with alpha testing?

Let's consider the simplest case, where our texture is 2x2, with alpha values $a_{0,0}, a_{1,0}, a_{0,1}, a_{1,1}$. With bilinear filtering, the alpha at $uv$ coordinate $(x,y)$ is lerp(lerp($a_{0,0}$,...
TomKern's user avatar
  • 251
5 votes
Accepted

Image rescaling algorithm

Explanation With a non-linear scale, you apply different weights for each pixel (or whatever unit you are using). You can use Euclidean distance towards the closest pixels in both directions to ...
aces's user avatar
  • 1,353
5 votes
Accepted

Interpolating vectors on a grid

I did some research and found the answer I was looking for. The three most common ways to interpolate vectors are: Slerp - short for "spherical interpolation", this is the most correct way, but is ...
Alan Wolfe's user avatar
  • 7,721
4 votes

How to use Monotone cubic interpolation in 3D?

Ok, monotonic interpolation depends on what you are monotonic about. For a simple 1D function interpolation monotonicity is easy to define. But for a 2D and 3D dataset its not so self evident what the ...
joojaa's user avatar
  • 8,377
4 votes
Accepted

Perspective correct interpolation z-buffer

Yes, that's correct. Perspective-correct interpolation works by (for some quantity $u$ to be interpolated) calculating $u/z$ and $1/z$ at each vertex, linearly interpolating those values in screen ...
Nathan Reed's user avatar
  • 24.7k
3 votes
Accepted

Creating a gently moving 2D fog effect

Animated noise can be created by using time as an extra dimension. So instead of 2D noise, you'd use 3D noise with time as the z-axis position, like ...
Nathan Reed's user avatar
  • 24.7k
3 votes
Accepted

Perlin Noise with Smooth function vs Lerp

It looks like the way you're using smoothstep isn't quite right. With lerp, the first two parameters are the endpoints of the output range, and the third is a 0–1 value specifying how far to ...
Nathan Reed's user avatar
  • 24.7k
3 votes
Accepted

How to obtain generalized barycentric coordinates for n-sided polygon?

Quadrilateral basis functions can be calculated using an outer product of the basis of two linear functions (1-r, r) and (1-s, s). The same thing does not apply for arbitrary $n$-sided domains. For ...
Reynolds's user avatar
  • 1,089
3 votes
Accepted

Normal Interpolation for Phong shading

Your first version was correct, except that alpha and 1-alpha should be swapped (the result should be ...
Nathan Reed's user avatar
  • 24.7k
3 votes
Accepted

How can you interpolate over an array of say 5 colors?

Say you have colors $[c_1, c_2, c_3, c_4, c_5]$ And $t$ values at which each color should be purely displayed. $[t_1, t_2, t_3, t_4, t_5]$ Now your problem is given $t$ which color do I have to ...
Dragonseel's user avatar
  • 1,800
3 votes

What is bilateral upsampling?

This probably does not explore the full depth of the term, but the first thing that comes to my mind when I hear "bilateral upsampling" is depth-aware blending of low-resolution images onto high-...
IneQuation's user avatar
3 votes
Accepted

Interpolate vertex attributes with $z$ AFTER homogeneous divide

The $Z$ of NDC space is related to $1/Z_\text{view}$ but not the same. With a typical projection matrix, they're related by an affine remapping, $$ Z_\text{NDC} = a \, \frac{1}{Z_\text{view}} + b $$ ...
Nathan Reed's user avatar
  • 24.7k
3 votes
Accepted

Smooth triangular mesh interpolation

You may be able to eliminate the triangular artifacts by using Natural Neighbor Interpolation. You can find a description of the technique and an associated description of the algorithm at An ...
Gary Lucas's user avatar
3 votes

Correct way to interpolate 1/z?

You are right. In the examples you provided you only seem to render "pre-transformed" triangles which is why I think you were missing the point made in the article. Which depth testing is ...
Michele M.'s user avatar
2 votes
Accepted

Perspective correct interpolation of normal values

Perspective correct interpolation of normals works just as it does any color or coordinate or other linearly varying attribute. Each component of each varying vector is interpolated independently as ...
GroverManheim's user avatar
2 votes

Linear interpolation on Plane (Marching Cubes)

P1 and P2 in this case represent the actual coordinates of the vertices of the cube in your output mesh. These might be the same as the input coordinates of the function you're using, or they might ...
russ's user avatar
  • 2,342
2 votes

Does the blending matrix change between calculating various curve segments in a uniform cubic B-splines approximation?

No, $B$ is constant for given type of cubic spline, e.g. B-spline, Bezier, Hermite or Catmull-Rom cubic splines have different $B$ matrix. To make B-spline continuous, you need to copy 3 control ...
JarkkoL's user avatar
  • 3,596
2 votes
Accepted

Does the blending matrix change between calculating various curve segments in a uniform cubic B-splines approximation?

No, the $B$ matrix (basis coefficient matrix) does not change from one segment to the next. It is a property of the type of spline you're using, in this case cubic B-splines. If you used Bézier ...
Nathan Reed's user avatar
  • 24.7k
2 votes

Find closest point on surface interpolated by 2d matrix of points

This is only a rough idea, though I hope it may inspire better answers. The closest point on a surface is as far as I know always forms together with the red point a line that is orthogonal to the ...
Dragonseel's user avatar
  • 1,800
2 votes

How do I use barycentric coordinates to interpolate vertex normal?

You can find which coefficient belongs to which vertex empirically by changing t to be one of the points on the triangle (...
Bla...'s user avatar
  • 461
2 votes

Screen coordinates, barycentric coordinates and global coordinateas

It sounds like you're rasterizing a line segment between two endpoints. The points on the line are obtained by linearly interpolating between the endpoints (whether in world space, screen space, or ...
Nathan Reed's user avatar
  • 24.7k
2 votes

Bilinear Interpolation

I think the formula at the top only makes sense if $n$ and $m$ are pixel indices, i.e. row and column numbers from 0 to $H - 1$ and 0 to $W - 1$. This way, for the four surrounding pixels, the weight ...
Dan Hulme's user avatar
  • 6,680
2 votes

Geometric interpretation of this bilinear interpolation equation?

If we look at the two terms with only x or only y they fully describe what happens when you go right or up from the starting point. The xy-terms does not come into play at all. When you want to go "...
anders's user avatar
  • 41

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