The 2024 Developer Survey results are live! See the results

Tag Info

Hot answers tagged interpolation

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 ...
• 25.1k
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 ...
• 1,990

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 ...
• 1,611
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 ...
• 8,447
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 ...
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 ...
• 901

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}$,...
• 251
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 ...
• 1,353

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 ...
• 8,447
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 ...
• 25.1k
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 ...
• 1,283
Accepted

Normal Interpolation for Phong shading

Your first version was correct, except that alpha and 1-alpha should be swapped (the result should be ...
• 25.1k
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 ...
• 25.1k
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 ...
• 25.1k
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 ...
• 1,810

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-...
• 892
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$$ ...
• 25.1k
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 ...
• 146

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 ...

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 ...
• 1,810
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 ...

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 ...
• 2,402

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 ...
• 3,666
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 ...
• 25.1k

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 (...
• 481

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 ...
• 25.1k

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 ...
• 6,860

Texturing an "infinite" plane

 \def\mvec#1{\begin{pmatrix}#1\end{pmatrix}} \def\ivec#1{\left(\begin{smallmatrix}#1\end{smallmatrix}\right)} \def\mmat#1{\begin{bmatrix}#1\end{bmatrix}} \def\vec#1{\mathrm{\mathbf{#1}}} \def\mat#1{\...