The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Tag Info

Hot answers tagged interpolation

16

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

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

7

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

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

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

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

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

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

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

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

You're actually already doing color interpolation in the code you posted, in these expressions: qRgb( 255-I, 255, 255-I ) qRgb( I, 255, I ) The first one is interpolating from white to green by I, and the second one from green to white by I. In both cases I is acting as an integer form of the variable $\alpha$ from the equation. I note that you ...

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 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 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 ... 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 $$\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 ... 1 As a rule, SDFs do much better under interpolation than regular images do—it’s why you can mostly get away with using tiny textures for e.g. font data. You should be fine interpolating neighboring voxels. 1 First, (1/2) I didn't understand how the hash table is actually used. The workflow I think I understood is the following : For an input (coordinate), we find the both nearest pre-defined coordinates (i.e. : those present as indices in A). It's a multiple of 255. The lower one is used to lookup in B We get a number between [0;255] that we use to ... 1 I've also spent a good amount of time thinking about a solution for this problem. It seems like one those fundamental mismatches of taking a sparser, lower frequency structure (probe mesh, even if augmented with depth map) and lighting surfaces per pixel which themselves are occluders. If you look at the SIGGRAPH'17 Precomputed lighting in CoD:IW (http://... 1 An answer was provided to me via twitter by two people independently. https://twitter.com/nothings/status/987797966789341184 https://twitter.com/DarrenMoo/status/987796950274764802 The intuition is that without the xy term, that equation describes a plane defined by the 3 points involved (all points except$P_{11}\$). The xy term is there to correct it to ...

1

I don't have enough rep to add a comment so... You could use a post process based anti-aliasing technique like FXAA or SMAA. Also, if performance is not a priority, you could go for SSAA. Another option could be to write to a multi sampled texture (I'm not 100% sure if that is possible in your case).

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