BrushMetallicRoughnessMap brush[,texture][,frame]
Parameters
|
brush - brush handle texture (optional) - packed metallic/roughness texture, or 0 to remove the map (default) frame (optional) - frame of an animated texture; 0 (default) |
Description
|
Sets a texture that varies metallic and roughness across a Standard surface. A flat BrushPBR value makes the whole surface equally shiny. This map varies it per pixel, which is what sells worn materials: scratched paint showing metal, fingerprints on chrome, polished edges on rough stone. The texture uses the glTF channel layout: the green channel is roughness and the blue channel is metallic. The channels multiply the BrushPBR factors, and since both factors default to 1 a fresh brush lets the map take full control. The texture is read as linear data, not sRGB colour. Art tools that export a packed ORM texture put ambient occlusion in the red channel - hand the same texture to BrushOcclusionMap, which reads red, and one image does both jobs. 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: BrushPBR, BrushOcclusionMap, BrushBaseColorMap, BrushNormalMap. |
Example
; BrushMetallicRoughnessMap 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 packed map in glTF layout: green=roughness, blue=metallic. ; Four quadrants: smooth metal, rough metal, smooth paint, rough paint. packed=CreateTexture(64,64,1+8) SetBuffer TextureBuffer(packed) Color 0,20,255 Rect 0,0,32,32,True Color 0,255,255 Rect 32,0,32,32,True Color 0,20,0 Rect 0,32,32,32,True Color 0,255,0 Rect 32,32,32,32,True SetBuffer BackBuffer() ; The map multiplies the factors set by BrushPBR, so use 1,1 brush=CreateStandardBrush(210,160,80) BrushPBR brush,1,1 sphere=CreateSphere(32) mapped=True While Not KeyDown(1) ; Press Space to attach or remove the packed map If KeyHit(57) Then mapped=Not mapped ; Set the map (texture zero removes it) and repaint the sphere If mapped Then BrushMetallicRoughnessMap brush,packed Else BrushMetallicRoughnessMap brush,0 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,"Space: toggle map Arrow keys: move camera Esc: exit" If mapped Then Text 0,20,"BrushMetallicRoughnessMap brush,packed" Else Text 0,20,"BrushMetallicRoughnessMap brush,0 (map removed)" Flip Wend FreeBrush brush End
Index