Getting Started
...
Glossary
#-G Terms

Bilinear Filltering

2min

In computer graphics, bilinear filtering is a texture filtering technique that can be used to improve the quality of textures that are viewed at an oblique angle. This is done by averaging the colors of four texels (texture elements) that are nearest to the pixel being rendered.

Bilinear filtering is a simple but effective technique that can be used to improve the quality of textures in 3D scenes. By understanding how bilinear filtering works, you can create 3D scenes that have sharper, more detailed textures.

Here is an example of how bilinear filtering is used in computer graphics:

// Get the texture var texture = this.material.texture; // Get the texels that are nearest to the pixel being rendered var texels = texture.getTexels(x, y); // Average the colors of the texels var color = texels.reduce((a, b) => { return (a.r + b.r) / 2, (a.g + b.g) / 2, (a.b + b.b) / 2 }); // Set the color of the pixel this.color = color;

In this example, we first get the texture that is being used to render the pixel. We then get the texels that are nearest to the pixel being rendered. Finally, we average the colors of the texels and set the color of the pixel.

Here are some tips for using bilinear filtering:

  • Only use bilinear filtering for textures that are viewed at an oblique angle:  
  • If the texture is viewed straight on, bilinear filtering will not have a significant impact on the quality of the texture.
  • Use bilinear filtering in conjunction with other texture filtering techniques, such as trilinear filtering: By using multiple texture filtering techniques together, you can further improve the quality of your textures.
  • Test your scenes to make sure that bilinear filtering is working correctly: Sometimes, bilinear filtering can cause problems with the appearance of your scenes. By testing your scenes, you can make sure that bilinear filtering is working correctly and that it is not causing any problems.

Feedback

Please be sure to submit issues or feature requests through the embedded feedback form. In the event it is a major issue please contact us directly through Discord.

Updated 03 Apr 2024
Doc contributor
Did this page help you?