Blitz3D+ Command Reference

BrushClearcoat brush,factor#,roughness#

Parameters

brush - brush handle

factor# - strength of the coating from 0 (none) to 1 (full)

roughness# - roughness of the coating from 0 to 1

Description

Adds a clear lacquer coating on top of a Standard material.

A clearcoat is a second, transparent glossy layer over the base material - think car paint, lacquered wood, varnished guitars, phone screens. It adds its own highlight and environment reflection without replacing the layer underneath, so the base keeps its own colour and roughness.

That separation is the point: rough matte paint under a polished coat is BrushPBR with high roughness plus BrushClearcoat with low roughness. Set factor 0 to remove the coating. The coating can bend independently of the base using BrushClearcoatNormalMap.

Imported glTF models with the KHR_materials_clearcoat extension arrive with this layer already set. Calling this command attaches the Standard material to the brush automatically.

Requires Extended mode.

See also: BrushClearcoatNormalMap, BrushPBR, BrushSheen, BrushStandard.

Example

; BrushClearcoat 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

; A matte red base layer, like car paint before its lacquer
brush=CreateStandardBrush(180,45,25)
BrushPBR brush,0,0.45
sphere=CreateSphere(32)

factor#=1.0
coat_roughness#=0.08

While Not KeyDown(1)

    ; Press [ / ] to change the clearcoat factor
    If KeyDown(26) And factor>0 Then factor=factor-0.01
    If KeyDown(27) And factor<1 Then factor=factor+0.01

    ; Press Z / X to change the coating roughness
    If KeyDown(44) And coat_roughness>0 Then coat_roughness=coat_roughness-0.01
    If KeyDown(45) And coat_roughness<1 Then coat_roughness=coat_roughness+0.01

    ; Add the lacquer layer and repaint the sphere
    BrushClearcoat brush,factor,coat_roughness
    PaintEntity sphere,brush

    ; 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,"[ / ] : factor   Z / X : coat roughness   Arrow keys: move camera   Esc: exit"
    Text 0,20,"BrushClearcoat brush,"+factor+","+coat_roughness

    Flip

Wend

FreeBrush brush
End

Index