Skip to main content
Participant
Apr 4, 2025 10:49 PM UTC

How to enable / disable mipmaps when creating a SceneTexture from a Bitmap?

I don't see a SceneTexture constructor that takes a bitmap as an argument AND disables or enables mipmapping.

val samplerConfig = SamplerConfig(
   mipmapMode = Filter.NEAREST,
   minFilter = Filter.NEAREST,
   magFilter = Filter.NEAREST,
   addressModeU = AddressMode.CLAMP_TO_EDGE,
   addressModeV = AddressMode.CLAMP_TO_EDGE,
   lodBias = 0.0f
)
val myTexture = SceneTexture(myBitmap, samplerConfig)

Are mipmaps auto always generated here? Is there anyway to control this (e.g., what if I don't want mipmapping)?
Other SceneTexture constructors have a `numberOfMips` argument, but none of those take a Bitmap as an argument. Perhaps this is controlled at the SceneMaterial level, but I don't see anything concerning mipmaps there.

    This topic has been closed for replies.

    1 reply

    Meta Employee
    Apr 7, 2025 11:00 PM UTC

    Hi!

    Right now when creating a SceneTexture, there are roughly log2 levels of mipmaps generated for any bitmap created and there is no current way to customize that.

    The lodBias in the sampler should let you customize which levels are used for sampling but loading from the Bitmap will currently always generate the levels.