Blitz3D+ Command Reference

BrushEmissiveMap brush[,texture][,frame]

Parameters

brush - brush handle

texture (optional) - emissive colour texture, or 0 to remove the map (default)

frame (optional) - frame of an animated texture; 0 (default)

Description

Sets a texture that marks the glowing areas of a Standard material.

Where BrushEmissive makes a whole surface glow, the emissive map picks out which pixels do: the lit windows of a night-time building, a screen's pixels, glowing runes on a sword. The map is read as sRGB colour and multiplies the BrushEmissive colour and strength.

Watch out: a new Standard brush's emissive colour is black, and black times anything is black - so a freshly attached emissive map shows nothing until you also call BrushEmissive (white at strength 1 is the usual starting point).

Pass 0 as the texture to remove the map. Calling this command attaches the Standard material to the brush automatically.

For the full map set, see Standard material maps in the shader guide.

Requires Extended mode.

See also: BrushEmissive, BrushBaseColorMap, HDRRendering.

Example

; BrushEmissiveMap Example
; ------------------------
; Requires Extended mode.

Graphics3D 640,480,0,2
SetBuffer BackBuffer()

camera=CreateCamera()
PositionEntity camera,0,0,-5

; A dark scene so the glowing stripe stands out
CameraClsColor camera,5,5,15

light=CreateLight()
RotateEntity light,35,-30,0

; Draw the glow mask: a white stripe on black
glow=CreateTexture(64,64,1+8)
SetBuffer TextureBuffer(glow)
ClsColor 0,0,0
Cls
Color 255,255,255
Rect 20,0,24,64,True
SetBuffer BackBuffer()

; The map multiplies the colour set by BrushEmissive
brush=CreateStandardBrush(25,25,25)
BrushEmissive brush,30,180,255,2
cube=CreateCube()

mapped=True

While Not KeyDown(1)

    ; Press Space to attach or remove the emissive map
    If KeyHit(57) Then mapped=Not mapped

    ; Set the map (texture zero removes it) and repaint the cube
    If mapped Then BrushEmissiveMap brush,glow Else BrushEmissiveMap brush,0
    PaintEntity cube,brush

    TurnEntity cube,0.2,0.4,0

    ; Arrow keys move the camera
    If KeyDown(200) Then MoveEntity camera,0,0,0.1
    If KeyDown(208) Then MoveEntity camera,0,0,-0.1
    If KeyDown(203) Then TurnEntity camera,0,1,0
    If KeyDown(205) Then TurnEntity camera,0,-1,0

    RenderWorld

    Color 255,255,255
    Text 0,0,"Space: toggle map   Arrow keys: move camera   Esc: exit"
    If mapped Then Text 0,20,"BrushEmissiveMap brush,glow (stripe glows)" Else Text 0,20,"BrushEmissiveMap brush,0 (whole cube glows evenly)"

    Flip

Wend

FreeBrush brush
End

Index