An ORM texture packs three maps into one: ambient occlusion in red, roughness in green, metallic in blue. A StandardMaterial3D reads every map slot from the red channel unless you change it, and multiplies the map by the slot's value. In our Godot 4.7 test a smooth plastic ORM in the roughness slot gave no highlight at all, because the slot read the white AO channel as fully rough. A metal ORM with the channels set right still looked like plastic, because metallic was left at 0, and 0 times the map is 0. The script below sets the three channels and both values to 1: the ball matched a material with the same roughness and metallic typed in, to the pixel. ORMMaterial3D also got it right with no changes.
The code
Save it as orm_maps.gd and load it with const Orm := preload("res://orm_maps.gd"). Call Orm.apply(material, orm_texture) on a StandardMaterial3D. In the Inspector it is the same as setting Roughness › Texture Channel to Green, Metallic › Texture Channel to Blue, and the Roughness and Metallic values to 1.
extends RefCounted
## Use a packed ORM texture (R = ambient occlusion, G = roughness, B = metallic) on a StandardMaterial3D.
## const Orm := preload("res://orm_maps.gd")
## Orm.apply($Crate.get_active_material(0), preload("res://textures/crate_orm.png"))
static func apply(mat: StandardMaterial3D, orm: Texture2D) -> void:
mat.ao_enabled = true
mat.ao_texture = orm
mat.ao_texture_channel = BaseMaterial3D.TEXTURE_CHANNEL_RED
mat.roughness_texture = orm
mat.roughness_texture_channel = BaseMaterial3D.TEXTURE_CHANNEL_GREEN
mat.metallic_texture = orm
mat.metallic_texture_channel = BaseMaterial3D.TEXTURE_CHANNEL_BLUE
# the maps are multiplied by these two values: at metallic 0 a metallic map does nothing
mat.roughness = 1.0
mat.metallic = 1.0
What we measured
A grey ball under one directional light, and two flat ORM textures: smooth plastic (AO 1, roughness 0.2, metallic 0) and smooth metal (AO 1, roughness 0.2, metallic 1). On the rendered screen we took the mean brightness of the ball and counted highlight pixels brighter than 0.85. Two runs gave the same numbers.
- Reference, values typed in, roughness 0.2, metallic 0: mean 0.384, 52 highlight pixels. Roughness 0.2, metallic 1: mean 0.223, 117.
- Plastic ORM in the roughness and metallic slots, channels left at red (the default): mean 0.409, 0 highlight pixels, a fully rough ball.
- The script, plastic ORM: 0.384 and 52, the same as the reference.
- Metal ORM, channels set to green and blue but metallic left at 0: 0.384 and 52, the plastic result.
- The script, metal ORM: 0.223 and 117, the same as the metal reference.
- ORMMaterial3D with the metal ORM as its ORM texture, nothing else changed: 0.223 and 117.
Why it happens
Each map slot of a StandardMaterial3D takes one channel, chosen by its Texture Channel setting, and red is the default for all of them. An ORM has AO in red, so both roughness and metallic read the AO, which is usually close to white. The slot's value then multiplies the map: the material's roughness starts at 1, so a roughness map works, but metallic starts at 0, so the metallic map is multiplied away. ORMMaterial3D is a material made for packed maps and reads the three channels itself.
What to change
- Separate roughness and metallic images, not packed: keep the channel on red (or the channel the image uses) but still set metallic to 1.
- Many ORMs at once: switching the materials to ORMMaterial3D gave the same result in our test.
- A metal ball that turns almost black: metal needs something to reflect. Bumps that look dented: DirectX and OpenGL normal maps.
Ready-made materials: 24 Sci-Fi PBR Materials has 24 seamless sci-fi PBR materials as 2K PNG maps, plus a Godot 4 ready version.
Tested in Godot 4.7 with the Compatibility renderer.
Ready-made: 24 Sci-Fi PBR Materials has 24 seamless sci-fi PBR materials as 2K PNG maps, plus a Godot 4 ready version.
More how-tos: Shaders, materials and lights
- A 3D outline that stays the same width on screen
- Find and fix the seam in a repeating texture
- PS1 vertex wobble that is the same near and far
- Snow that stays on the roofs
- Neon signs that share a material but not a colour
- A MatCap that stays the right way up from every side
- Scroll or tile a 2D texture without stretched edge lines
- Keep floors, roads and roofs sharp when the camera looks along them
- Make WorldEnvironment color grading apply to a 2D game
- Get a hard cel-shaded light edge from StandardMaterial3D's Toon mode
- Make metallic materials stop looking black or flat
- Make a glowing sign or screen actually light the wall around it
- Use a LUT strip for color grading in Godot 4
- Tiling textures that keep their size on any mesh
- A sharp low-resolution PS1 look
- Only 8 lights show on a long wall in Compatibility
- Hit flash shader for 2D sprites
- Flash a 3D enemy white when it takes a hit
- Dissolve shader for 3D models
- 2D outline shader that is not cut off
- 3D outline shader without gaps at the corners
- A force field shield with a hit ripple
- Normal map inverted: DirectX vs OpenGL
- Full-screen post-process shader in 3D
- Scroll a shader texture for hours without the once-an-hour jump