lygia
/lighting
/material
/zero
)Material Constructor with all the values set to zero.
Use:
void materialZero(out <material> _mat)
<material> materialZero()
#ifndef FNC_MATERIAL_ZERO
#define FNC_MATERIAL_ZERO
void materialZero(out Material _mat) {
_mat.albedo = vec4(0.0);
_mat.emissive = vec3(0.0);
_mat.position = vec3(0.0);
_mat.normal = vec3(0.0);
#if defined(RENDER_RAYMARCHING)
_mat.sdf = 0.0;
_mat.valid = true;
#endif
#if defined(SCENE_BACK_SURFACE)
_mat.normal_back = vec3(0.0);
#endif
_mat.ior = vec3(0.0);
_mat.roughness = 0.0;
_mat.metallic = 0.0;
_mat.reflectance = 0.0;
_mat.ambientOcclusion = 0.0;
#if defined (SHADING_MODEL_CLEAR_COAT)
_mat.clearCoat = 0.0;
_mat.clearCoatRoughness = 0.0;
#if defined(MATERIAL_HAS_CLEAR_COAT_NORMAL)
_mat.clearCoatNormal = vec3(0.0);
#endif
#endif
#if defined(SHADING_MODEL_IRIDESCENCE)
_mat.thickness = 0.0;
#endif
#if defined(SHADING_MODEL_SUBSURFACE)
_mat.subsurfaceColor = vec3(0.0);
_mat.subsurfacePower = 0.0;
_mat.subsurfaceThickness = 0.0;
#endif
}
Material materialZero() {
Material mat;
materialZero(mat);
return mat;
}
#endif
Use:
void materialZero(out <material> _mat)
<material> materialZero()
#ifndef FNC_MATERIAL_ZERO
#define FNC_MATERIAL_ZERO
void materialZero(out Material _mat) {
_mat.albedo = float4(0.0, 0.0, 0.0, 0.0);
_mat.emissive = float3(0.0, 0.0, 0.0);
_mat.position = float3(0.0, 0.0, 0.0);
_mat.normal = float3(0.0, 0.0, 0.0);
#if defined(RENDER_RAYMARCHING)
_mat.sdf = 0.0;
_mat.valid = true;
#endif
#if defined(SCENE_BACK_SURFACE)
_mat.normal_back = float3(0.0, 0.0, 0.0);
#endif
_mat.ior = float3(0.0, 0.0, 0.0);
_mat.roughness = 0.0;
_mat.metallic = 0.0;
_mat.reflectance = 0.5;
_mat.ambientOcclusion = 0.0;
#if defined (SHADING_MODEL_CLEAR_COAT)
_mat.clearCoat = 0.0;
_mat.clearCoatRoughness = 0.0;
#if defined(MATERIAL_HAS_CLEAR_COAT_NORMAL)
_mat.clearCoatNormal = float3(0.0, 0.0, 0.0);
#endif
#endif
#if defined(SHADING_MODEL_IRIDESCENCE)
_mat.thickness = 0.0;
#endif
#if defined(SHADING_MODEL_SUBSURFACE)
_mat.subsurfaceColor = float3(0.0, 0.0, 0.0);
_mat.subsurfacePower = 0.0;
_mat.subsurfaceThickness = 0.0;
#endif
}
Material materialZero() {
Material mat;
materialZero(mat);
return mat;
}
#endif
LYGIA is dual-licensed under the Prosperity License and the Patron License for sponsors and contributors.
Sponsors and contributors are automatically added to the Patron License and they can ignore the any non-commercial rule of the Prosperity Licensed software (please take a look to the exception).
It's also possible to get a permanent comercial license hook to a single and specific version of LYGIA.
Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository