Vital.sandbox
Model

self:is_material_flag

Shared

Retrieves whether a specific rendering flag is enabled on a material


Syntax

local result = self:is_material_flag(component, material, flag)

Parameters

TypeNameDescription
stringcomponentPath of the component containing the material
stringmaterialName of the material to check
intflagFlag index to query
Refer Flags section

Returns

TypeNameDescription
boolresulttrue if the flag is enabled, false otherwise

Flags

ValueNameDescription
0FLAG_DISABLE_DEPTH_TESTDrawn on top of all other objects, bypassing depth sorting. May cause z-fighting after transparent pass
1FLAG_ALBEDO_FROM_VERTEX_COLORSets the albedo color from the per-vertex color defined in the mesh
2FLAG_SRGB_VERTEX_COLORTreats vertex colours as nonlinear sRGB and converts them to linear for rendering. Only effective on Forward+ and Mobile
3FLAG_USE_POINT_SIZEUses point size to alter primitive point rendering; changes albedo texture lookup to use POINT_COORD instead of UV
4FLAG_FIXED_SIZEScales the object by depth so it always appears the same size on screen
5FLAG_BILLBOARD_KEEP_SCALEPreserves the scale set on the mesh when billboarding. Only applies when billboard_mode is BILLBOARD_ENABLED
6FLAG_UV1_USE_TRIPLANARUses triplanar texture lookup for all texture lookups that would normally use UV
7FLAG_UV2_USE_TRIPLANARUses triplanar texture lookup for all texture lookups that would normally use UV2
8FLAG_UV1_USE_WORLD_TRIPLANARUses world-space triplanar texture lookup for all lookups that would normally use UV
9FLAG_UV2_USE_WORLD_TRIPLANARUses world-space triplanar texture lookup for all lookups that would normally use UV2
10FLAG_AO_ON_UV2Uses UV2 coordinates to look up the ambient occlusion texture
11FLAG_EMISSION_ON_UV2Uses UV2 coordinates to look up the emission texture
12FLAG_ALBEDO_TEXTURE_FORCE_SRGBForces the shader to convert the albedo texture from nonlinear sRGB to linear encoding
13FLAG_DONT_RECEIVE_SHADOWSDisables receiving shadows cast by other objects
14FLAG_DISABLE_AMBIENT_LIGHTDisables the contribution of ambient light on this material
15FLAG_USE_SHADOW_TO_OPACITYEnables the shadow-to-opacity feature
16FLAG_USE_TEXTURE_REPEATEnables texture repeat when UV coordinates fall outside the 0–1 range. May cause edge artefacts with linear filtering
17FLAG_INVERT_HEIGHTMAPInverts values read from the depth texture to convert them to height values
18FLAG_SUBSURFACE_MODE_SKINEnables skin mode for subsurface scattering to improve the look of human skin
19FLAG_PARTICLE_TRAILS_MODEEnables shader parts required for GPUParticles3D trails such as RibbonTrailMesh or TubeTrailMesh. Enabling this on non-GPUParticles3D materials will break rendering
20FLAG_ALBEDO_TEXTURE_MSDFEnables multichannel signed distance field rendering for the albedo shader
21FLAG_DISABLE_FOGDisables depth-based or volumetric fog on this material
22FLAG_DISABLE_SPECULAR_OCCLUSIONDisables specular occlusion
23FLAG_USE_Z_CLIP_SCALEEnables the use of z_clip_scale
24FLAG_USE_FOV_OVERRIDEEnables the use of fov_override

Examples

Check if certain flags are enabled on a material
local entity = model.create("character")

--Check if depth test is disabled on a material
engine.print("info", "Depth test disabled:", entity:is_material_flag("Skeleton3D/Body", "outline", 0))

--Check if the material ignores shadows
engine.print("info", "Shadows disabled:", entity:is_material_flag("Skeleton3D/Head", "face", 13))

On this page