Contents

init(semantic:compression:mipmapsMode:)

Creates a texture creation options structure.

Declaration

init(semantic: TextureResource.Semantic?, compression: TextureResource.Compression, mipmapsMode: TextureResource.MipmapsMode = .allocateAndGenerateAll)

Parameters

  • semantic:

    The intended use of the texture resource.

  • compression:

    Compression to be applied to the texture.

  • mipmapsMode:

    Whether to automatically allocate or generate mipmaps.

Discussion

The semantic value you pass tells RealityKit how you plan to use the texture data from this resource. For example, passing TextureResource.Semantic.color lets RealityKit know you’re using the texture to pass perceptual color information to the shaders, such as for providing a UV-mapped base color for physically based rendering materials. Passing TextureResource.Semantic.raw tells RealityKit to pass the pixel values with as little processing as possible.

If semantic is nil, RealityKit tries to infer a semantic from the texture’s source data. If it’s unable to determine a semantic from the texture source data, it will infer a semantic from the texture’s usage. Providing a value for semantic ensures that RealityKit passes the texture resource exactly as you intend.