Blitz3D+ Command Reference

BrushClearcoatNormalMap brush[,texture][,frame][,scale#]

Parameters

brush - brush handle

texture (optional) - tangent-space normal map for the coating, or 0 to remove it (default)

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

scale# (optional) - strength of the map's detail; 1.0 (default)

Description

Sets a normal map used only by a Standard material's clearcoat layer.

The coating added by BrushClearcoat normally follows the base surface. Giving it a normal map of its own lets the two layers disagree, which is how some classic looks work: smooth lacquer flowing over rough carved wood keeps the bumps in the base map only, while orange-peel car paint puts a subtle ripple in the coat map over a smooth base.

The texture is read as linear data, and the scale parameter strengthens or flattens its detail. The map is only visible while the clearcoat factor is above 0. Pass 0 as the texture to remove it. Calling this command attaches the Standard material to the brush automatically.

Requires Extended mode.

See also: BrushClearcoat, BrushNormalMap, BrushStandard.

Example

; BrushClearcoatNormalMap Example
; -------------------------------
; Requires Extended mode.

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

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

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

; Draw a bumpy tangent-space normal map: flat blue with random dents
SeedRnd MilliSecs()
normal=CreateTexture(64,64,1+8)
SetBuffer TextureBuffer(normal)
ClsColor 128,128,255
Cls
For i=1 To 40
    Color Rand(68,188),Rand(68,188),255
    Oval Rand(0,56),Rand(0,56),8,8,True
Next
SetBuffer BackBuffer()

; A glossy coating over a matte base shows the coat bumps clearly
brush=CreateStandardBrush(180,60,30)
BrushPBR brush,0,0.5
BrushClearcoat brush,1,0.05
sphere=CreateSphere(32)

scale#=0.8

While Not KeyDown(1)

    ; Press [ / ] to change the normal map scale
    If KeyDown(26) And scale>0 Then scale=scale-0.01
    If KeyDown(27) And scale<2 Then scale=scale+0.01

    ; Bump only the clear coating and repaint the sphere
    BrushClearcoatNormalMap brush,normal,0,scale
    PaintEntity sphere,brush

    TurnEntity sphere,0,0.3,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,"[ / ] : map scale   Arrow keys: move camera   Esc: exit"
    Text 0,20,"BrushClearcoatNormalMap brush,normal,0,"+scale

    Flip

Wend

FreeBrush brush
End

Index