roavatar-renderer
    Preparing search index...

    Function generateModelThumbnail

    • Generates a 2d or 3d thumbnail of a model/similar instance

      Parameters

      • auth: Authentication

        Authentication

      • renderScene: RBXRendererScene

        Scene to render inside, do note the scene appearance is not populated automatically, use setupThumbnailScene()

      • model: Instance

        Model to render

      • size: Vec2 = ...

        Size of the resulting image, ignored for 3d thumbnails

      • type: ThumbnailType = "png"

        Type of thumbnail, "png" | "webp" | "gltf"

      • quality: number = 1

        Quality of image, with 1 being max-

      • gltfAutoDownload: boolean = false

        Automatically download gltf file

      • includeAnimations: boolean = false

      Returns Promise<ThumbnailResult>

      ThumbnailResult, always a string for 2d thumbnails, 3d can be ArrayBuffer (glb, binary) or {[key: string]: unknown} (gltf, json)

      Use new Thumbnails category instead

      Example of generating thumbnail of accessory

      //config
      const ASSETID = 1039433

      //code
      FLAGS.ANIMATE_SKELETON = false
      FLAGS.UPDATE_SKELETON = true

      const rScene = RBXRenderer.addScene()
      setupThumbnailScene(rScene)

      const accessoryrbx = await API.Asset.GetRBX(`rbxassetid://${ASSETID}`, {"Roblox-AssetFormat":"avatar_meshpart_accessory"})
      const accessory = accessoryrbx.generateTree().GetChildren()[0]
      const handle = accessory.FindFirstChildOfClass("MeshPart")
      const cf = handle.Prop("CFrame")
      if (!accessory.FindFirstChildOfClass("Camera")) cf.Position = [0,0,0]

      const result = await generateModelThumbnail(new Authentication(), rScene, accessory, [1000,1000], "webp", 0.99)
      console.log(result)
      console.log(result.length)