Forum Discussion

waynecochran's avatar
waynecochran
Explorer
4 months ago

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.

1 Reply

  • dav-s's avatar
    dav-s
    Meta Employee

    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.