Glitter Material (noise/worldspace based)
I used a 128^3 fastnoise cellular, 0.3 freq, fractal none, return cell value.
texture has consistent scale regardless of how big the object is, a small sphere and large sphere will have glitters the same size. It also transforms with the mesh but I couldn’t get it to rotate with it.
Shader code
shader_type spatial;
uniform sampler3D noise : filter_linear;
uniform vec3 color : source_color;
uniform vec3 aura : source_color;
varying vec3 world_position;
void vertex()
{
world_position = (MODEL_MATRIX * vec4(VERTEX, 1.0)).xyz *5.;
}
float fresnel(float amount, vec3 normal, vec3 view)
{
return pow((1.0 - clamp(dot(normalize(normal), normalize(view)), 0.0, 1.0 )), amount);
}
void fragment() {
ALBEDO = color;
METALLIC = 1.;
ROUGHNESS = .5;
SPECULAR = 1.;
NORMAL_MAP = NORMAL_MAP+ (texture(noise, world_position).rgb -.5)*.2;
EMISSION = 2.0* fresnel(2.0, NORMAL, VIEW) * aura;
}
