Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

texture.from_raster (procNode)

A texture of a raster's layers: up to four layers become the red, green, blue and alpha of one texel per cell, and the texels stay on the device. Use it to look at a terrain's height or mask layers as an image, or to hand them to a material.

The texture is the raster's cellsX texels across and cellsZ down, one texel per cell. A channel no layer fills is 0, and alpha 1. Each layer is read as it stands, so a value outside 0-1 stays outside it in the texel.

Inputs

  • raster (Raster): the raster whose layers the texture holds.
  • red (String, default ""): the layer the red channel holds. Empty leaves red at 0.
  • green (String, default ""): the layer the green channel holds. Empty leaves green at 0.
  • blue (String, default ""): the layer the blue channel holds. Empty leaves blue at 0.
  • alpha (String, default ""): the layer the alpha channel holds. Empty leaves alpha at 1.

Outputs

  • texture (Texture): { width, height, format = "rgba32f", texels }.

Example

local land = g.core.raster.new({ size = { x = 64, z = 32 }, resolution = 1, layers = { "height" } })
local texture = g.texture.from_raster({ raster = land, red = "height", green = "height", blue = "height" })

The texture is 64 by 32 texels, one per cell of the raster.