# Tag Info

## Hot answers tagged interpolation

21

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 define (and its precise details are generally not publicly documented). A good place to read about mip selection in detail is in the OpenGL spec, section 8....

9

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 find more details yourself, but this should give a coherent structure to start from. Fixing "Image"s Many image-processing people view filtering as ...

8

(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 interested in in terms of the quad's (or whatever primitive's) vertices. This is called a barycentric coordinate system. More practically-speaking, you basically ...

8

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 splines are a better tool for the job. Lagrange interpolation will make a curve that passes through the data points, thus preserving C0 continuity, but hermite ...

6

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 was historically. If you want your code to run faster, it is best to profile and identify which parts of the code are taking up most time, before considering ...

5

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 by completing the triangle with a duplicate of itself. Another way to look at this is that its the 2 tines the square of the are of the triangle. Now then the ...

5

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 determine the weights. Example Normalization For example, in the image below, the red image is the downsampled image (3x3) and the black image is the original image (...

5

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 also the costliest. In practice you likely do not need the precision. lerp - short for "linear interpolation", you just do a regular linear interpolation ...

5

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 we choose w, the weight for P1, to be sin(a), where a is the half angle at control point P1, the resulting rational Bézier curve is a circle. The second ...

4

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 situation would be. First you could interpolate along a independent variable t in which case your monotonicity is most probably in relation to t. This is the ...

4

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$$ where $a, b$ are some constants related to the near and far planes. So, in general you wouldn't be able to substitute $Z_\text{NDC}$ for $1/Z_\text{view}$ in ...

3

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 ofNoise(x, y, time). To control the level of detail, you'd use octaves of noise: multiple noise layers with different scales and amplitudes, mixed together. The basic Perlin routines just generate a single ...

3

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 interpolate. It looks like you're trying to use smoothstep the same way, but it doesn't work like that: the first two parameters to smoothstep are endpoints of the ...

3

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 this we use generalised barycentric coordinates. Wachspress coordinates are arguably the simplest generalised barycentric coordinates available, are fast to ...

3

Your first version was correct, except that alpha and 1-alpha should be swapped (the result should be a when alpha == 0 and b when alpha == 1). For Phong shading, you do want to keep the normalize on the end; that's the key thing that makes Phong different from Gouraud shading. But also, normalize isn't part of the usual definition of "lerp" (linear ...

3

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 display? Find the t-values $t_i$ and $t_{(i+1)}$ between which $t$ lies. Calculate a 0 to 1 ratio where $t$ lies between them $param = (t - t_i) / (t_{(i+1)} - ... 3 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-resolution ones; for instance, when you render alpha-blended geometry to a half-resolution buffer (for performance savings) and then composite it back onto the main ... 2 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 if they were scalars, using exactly the same equation. 2 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 not be, it's entirely up to you how you output them. A simple way to map them would be to just use integer coords, biased by half the resolution of your sample ... 2 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 points from the previous spline segment$a$to the control points of spline segment$b$and add a new point as the last control point of$b$such that:$Pb_{i-3}=...

2

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 splines or Hermite splines instead, you'd have a different $B$ matrix.

2

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 surface. If you know which yellow vertices form the surface that the green point lies on, this is easy. You could just formulate the normal form of the surface (...

2

You can find which coefficient belongs to which vertex empirically by changing t to be one of the points on the triangle (p1, p2, p3). Then one of the coefficients will be 1 and others are 0. Based on that you know which coefficient belongs to which vertex. Then, interpolating the normal is trivial: interpolatedNormal = bary[0] * p1_normal + bary[2] * ...

2

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 any other coordinate system). The barycentric coordinates identify points on the line segment. It's defined this way to make range of $\lambda$ be [0, 1]. (When $\... 2 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 varies from 0 to 1. As a representation of the algorithm it's unnecessarily opaque, because you don't actually want to look at every pixel of the image and ... 2 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 "into the square" or along the upper or the right edge then the xy-term comes into play. It cancels out the x/y-terms and introduce the P11-value that it should ... 2 $$\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{\mathrm{\mathbf{#1}}}$$ If you have the screen-space x and y coordinates as well as the depth of your fragment, you can directly compute the coordinates of the ... 2 The rasterizer determines, which pixel is rendered depending on vertex positions that come out of the vertex shader. For each rasterized pixel, the rasterizer knows where it lies inside the triangle formed by its three positions. With the known position inside the triangle, the rasterizer can also interpolate the vertex values for each pixel. So it also ... 2 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 space, then calculating$u = (u/z) / (1/z)$at each sample point. This is done by the GPU hardware behind the scenes. 2 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 clip planes. There is no way that a triangle can span from part of the visible frustum, to the$w = 0\$ camera plane or behind it, without also crossing outside ...

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