Add image billboarding

Example Scenarios:

  • Making glare for lights
  • Making flat image of a tree or a bush that faces the camera

Why not existing solutions:

  • If to take the normal billboard guis it’s quite expensive cause each new billboard gui creates a drawcall and gui overhead
  • Particle emitters have size limit
  • Parts are laggy to do in large quantities and memory overhead

What should it be?:
Something light weight like Particle Emitter but

  • Have to manually create and remove billboards
    So one instance can be used to create a lot of images
  • Image should be static with no lifetime
  • Always on Top mode
  • Modes (Facing camera / facing camera world up / manual)

What will it give:

  • More optimized way to create billboards
  • Putting a lot of images that are handled by gpu
  • less memory usage

Code example:

local particle_manager: ParticleManager

particle_manager.ImageId= "rbxassetid://0"
particle_manager.DisplayMode = Enum.ParticleDisplayMode.FacingCameraWorldUp
particle_manager.AlwaysOnTop = true
particle_manager.MaxDisplayDistance = 400

-- udim allows to do some dynamic scaling based on the distance
particle_manager.Size = UDim2.new(15, 0, 32, 10)


local particle_id_1: number = particle_manager:CreateParticle(Vector3.new(15, 0, 15))
--by making ids, luau types can be directly converted to c++ types with no properties overhead
--and used by gpu
particle_manager:SetPosition(particle_id, Vector3.new(30, 0, 30)) 
-- in manual orientation mode
particle_manager:SetCFrame(particle_id, CFrame.Angles(math.random(), math.random(), math.random()))
particle_manager:RemoveParticle(particle_id_1)

9 Likes