Unity - Generate Custom Mipmap with Compute Shader

December 11

Mipmap has many wonderful uses in real-time rendering, such as high-performance blur, high-performance gradient blur, etc. Unity's Mipmap implementation is relatively simple, sometimes we need to use some special Downsample algorithm to generate Mipmap. In this case, we can use Compute Shader to implement this functionality.

Steps

1. Create / Import Image Texture

First, we need an image texture to generate Mipmap. You can use Unity's built-in image import feature to import the image. Next, create a Render Texture for the Compute Shader, and make the following modifications in the property panel:

  • Size - Change to the size of the original image
  • Color Format - Change to the same format as the original image
  • Depth Stencil - Off
  • Mipmap - On
  • Mipmap/Auto Generate - Off
  • Random Write - On
  • Filter Mode - Change to Point

© 2020 - 2026 Ruiyao Luo

26/03/04 15:15

PROD

#764ff88