Skip to content

Commit

Permalink
add linear interpolation explainer
Browse files Browse the repository at this point in the history
  • Loading branch information
parbenc committed Aug 14, 2024
1 parent 4e274eb commit 2ac7795
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/understand/texture_fetching.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ This image is the example texture stretched out to a 4x4 pixel quad, but still i
Linear filtering
-------------------------------------------------------------------------------

The linear filtering method simply does a linear interpolation between values.
The linear filtering method simply does a linear interpolation between values. Linear interpolation is used to create a linear transition between two values. The formula used is ``(1-t)P1 + tP2`` where ``P1`` and ``P2`` are the values and ``t`` is within the [0..1] range.

In the case of texture sampling the following formulas are used:

* For one dimensional textures it is ``tex(x) = (1-α)T[i] + αT[i+1]``
* For two dimensional textures it is ``tex(x,y) = (1-α)(1-β)T[i,j] + α(1-β)T[i+1,j] + (1-α)βT[i,j+1] + αβT[i+1,j+1]``
Expand Down

0 comments on commit 2ac7795

Please sign in to comment.