Sets entity roughness factor (0.0=smooth/glossy, 1.0=rough/matte, clamped 0.0-1.0). Takes entity (mesh entity handle), roughness (0.0-1.0 double). Returns nothing. Clamps roughness to 0.0-1.0 range, updates material roughnessFactor, sets metallicRoughnessTextureIndex=1 (default white texture) so factor controls roughness exclusively. Mesh entities only.
This function sets roughness property. Roughness meaning: PBR property controlling surface smoothness (0.
Sets entity roughness factor (0.0=smooth/glossy, 1.0=rough/matte, clamped 0.0-1.0). Takes entity (mesh entity handle), roughness (0.0-1.0 double). Returns nothing. Clamps roughness to 0.0-1.0 range, updates material roughnessFactor, sets metallicRoughnessTextureIndex=1 (default white texture) so factor controls roughness exclusively. Mesh entities only.
This function sets roughness property. Roughness meaning: PBR property controlling surface smoothness (0.0 = smooth/glossy with sharp reflections like polished metal/glass/mirror, 1.0 = rough/matte with diffuse reflections like concrete/clay/fabric). Value clamping: input clamped to 0.0-1.0 range (negative values become 0.0, values > 1.0 become 1.0). Material handling: surface-based meshes (procedural shapes) update all surface materials directly, loaded meshes (GLB models) use material override system (checks entity.materialOverrideIndex, uses override if exists else uses mesh.materialIndex). Texture override: sets metallicRoughnessTextureIndex=1 (default white texture index) so roughnessFactor is ONLY thing controlling roughness (without this texture values would multiply with factor). Use cases: (1) Smooth surfaces (0.0-0.2 for polished metal, glass, mirrors, wet surfaces), (2) Semi-rough surfaces (0.3-0.6 for painted metal, plastic, wood), (3) Rough surfaces (0.7-1.0 for concrete, stone, fabric, matte paint), (4) Dynamic weathering (animate from 0.0 to 1.0 for aging polished surface), (5) Material variation (same model different roughness for variety). Common patterns: mirror b3dSetEntityRoughnessFX(entity, 0.0), polished metal b3dSetEntityRoughnessFX(entity, 0.2), plastic b3dSetEntityRoughnessFX(entity, 0.5), concrete b3dSetEntityRoughnessFX(entity, 0.9), dynamic weathering roughnessValue = roughnessValue + 0.01 until 1.0. Typical usage: set to 0.0-0.3 for shiny materials (mirrors, polished metals, wet surfaces), set to 0.4-0.7 for common materials (plastics, painted surfaces), set to 0.8-1.0 for matte materials (fabric, stone, rough wood), animate for wear/weathering effects. PBR roughnessFactor: controls specular lobe spread (0.0 = tight sharp highlights, 1.0 = wide diffuse highlights), affects visual appearance dramatically (polished gold vs brushed gold same color different roughness). Roughness workflow: companion to metallic property (together define surface BRDF), independent of color (red mirror and red fabric differ only in roughness). Specular highlights: roughness directly controls highlight size (0.0 = tiny bright specular dot, 0.5 = medium soft highlight, 1.0 = broad diffuse sheen). Material override: uses same clone-on-write pattern as SetEntityColorFX (prevents shared material modification). Performance: O(1) for single surface mesh, O(N) for N-surface procedural mesh. Default value: likely 1.0 (fully rough) if not set (verify during testing). Validation: prints error if invalid mesh handle or non-mesh entity, prints error if entity has no material. Related: b3dSetEntityMetallicFX sets metallic property (companion property), b3dSetEntityColorFX sets base color, b3dGetEntityRoughnessFX reads current roughness value.