**This is an old revision of the document!**

This component is provided by the Hologram Projector.
These can be used to create holographic projections in a resolution of 48x32x48, over a maximum area of 9x6x9 blocks. Holograms are defined via 48×48 32-bit bit masks, where each bit defines whether the voxel at that height should be on or off. Tier two holograms do not provide a higher resolution, instead they allow using up to three colors in the displayed hologram (as opposed to just one for the tier one hologram).

Component name: hologram.
Callbacks:

  • clear()
    Clears the hologram.
  • get(x:number, y:number, z:number):number
    Returns the value at the specified position.
  • set(x:number, y:number, z:number, value:number)
    Set the value for the specified position.
  • fill(x:number, z:number, height:number, value:number)
    Fills a column to the specified height with the specified value. All voxels below and including the specified height will be set, all voxels above will be unset.
  • copy(x:number, z:number, sx:number, sz:number, tx:number, tz:number)
    Copies an area of columns by the specified translation.
  • getScale():number
    Returns the current render scale of the hologram.
  • setScale(value:number)
    Set the render scale. A larger scale consumes more energy. The minimum scale is 0.33, where the hologram will fit in a single block space, the maximum scale is 3, where the hologram will take up a 9x6x9 block space.
  • maxDepth():number
    The color depth supported by the hologram.
  • getPaletteColor(index:number):number
    Get the color defined for the specified value.
  • setPaletteColor(index:number, value:number):number
    Set the color defined for the specified value.

Simple example program that allows setting individual voxels:

snippet.lua
local component = require("component")
local hologram = component.hologram
 
function setVoxel(x, y, z, value)
  local current = hologram.get(x, z)
  local positiveMask = bit32.lshift(1, y - 1)
  if value then
    hologram.set(x, z, bit32.bor(current, positiveMask))
  else
    local negativeMask = bit32.bnot(positiveMask)
    hologram.set(x, z, bit32.band(current, negativeMask))
  end
end
 
local args = {...}
setVoxel(tonumber(args[1]), tonumber(args[2]), tonumber(args[3]), args[4] == "true" or args[4] == "on")

Example use (assuming it's saved as holo-set.lua):
# holo-set 16 8 20 true

Further examples: - Holo Flow
This program generates a heightmap and 'moves' across it over time, creating the effect of a flowing terrain. - Holo Text
This program generates a random heightmap and displays scrolling text above it.

Note, the second example is quite a bit more advanced then the first. Important: both scripts also need the `noise.lua` script to be in the same folder.