Blitz3D+ Command Reference

BrushPBR brush,metallic#,roughness#

Parameters

brush - brush handle

metallic# - how metallic the surface is, from 0 to 1

roughness# - how rough the surface is, from 0 to 1

Description

Sets how metallic and how rough a Standard material's surface is.

These two numbers do most of the work in a physically based material. Metallic is nearly always 0 or 1: use 0 for paint, plastic, stone, wood, cloth and skin, and 1 for bare metal. Values in between only make sense for transitions, such as rust creeping over steel. Metals take their reflection colour from the base colour, so a yellow metallic brush reads as gold.

Roughness is the dial you will tweak the most. Near 0 the surface is polished - a small, sharp highlight and mirror-like reflections. Near 1 it is completely matte and chalky. Some quick recipes: polished gold 1, 0.15; worn iron 1, 0.6; glossy plastic 0, 0.2; rubber 0, 0.9.

A fresh Standard brush starts at metallic 1, roughness 1 (the glTF default), which looks like dark unpolished metal - so BrushPBR is usually the first command you call after creating one. Both values are clamped to 0..1, and a metallic/roughness map multiplies them per pixel. Calling this command attaches the Standard material to the brush automatically.

For the full story, see the Standard material in the shader guide.

Requires Extended mode.

See also: BrushMetallicRoughnessMap, BrushStandard, CreateStandardBrush, BrushEnvironmentMap.

Example

; BrushPBR Example
; ----------------
; Requires Extended mode.

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

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

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

; A comparison row: metallic rises 0..1 from left to right
Dim brush(4)
Dim sphere(4)
For column=0 To 4
    brush(column)=CreateStandardBrush(210,150,70)
    sphere(column)=CreateSphere(24)
    PositionEntity sphere(column),(column-2)*1.15,0,2
Next

roughness#=0.2

While Not KeyDown(1)

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

    ; Set each column's physical factors and repaint it
    For column=0 To 4
        BrushPBR brush(column),column/4.0,roughness
        PaintEntity sphere(column),brush(column)
    Next

    ; 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,"[ / ] : roughness   Arrow keys: move camera   Esc: exit"
    Text 0,20,"Metallic 0 .. 1 left to right   BrushPBR brush,metallic,"+roughness

    Flip

Wend

For column=0 To 4
    FreeBrush brush(column)
Next
End

Index