Blitz3D+ Command Reference

BrushAnisotropy brush,strength#[,rotation#]

Parameters

brush - brush handle

strength# - highlight stretch from 0 (round highlight) to 1 (fully stretched)

rotation# (optional) - stretch direction in degrees; 0 (default)

Description

Stretches a Standard material's highlight, for brushed metal and similar surfaces.

On brushed aluminium, hair, vinyl records and turned metal, thousands of parallel micro-grooves smear the highlight into a long streak instead of a round dot. That is anisotropy. Strength stretches the specular lobe along the surface tangent, and rotation turns the stretch direction - 90 degrees swaps a horizontal streak for a vertical one.

The layer works on top of the base BrushPBR factors; a metallic base with mid roughness shows it best. Set strength 0 to return to an ordinary round highlight.

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

Requires Extended mode.

See also: BrushPBR, BrushIridescence, BrushSheen, BrushStandard.

Example

; BrushAnisotropy 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 polished metal sphere shows the stretched highlight clearly
brush=CreateStandardBrush(180,125,45)
BrushPBR brush,1,0.25
sphere=CreateSphere(32)

strength#=0.9
rotation#=30

While Not KeyDown(1)

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

    ; Press Z / X to rotate the stretch direction
    If KeyDown(44) Then rotation=rotation-1
    If KeyDown(45) Then rotation=rotation+1

    ; Stretch the specular lobe and repaint the sphere
    BrushAnisotropy brush,strength,rotation
    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,"[ / ] : strength   Z / X : rotation   Arrow keys: move camera   Esc: exit"
    Text 0,20,"BrushAnisotropy brush,"+strength+","+rotation

    Flip

Wend

FreeBrush brush
End

Index