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;
}
Live Preview
Tags
glitter
The shader code and all code snippets in this post are under CC0 license and can be used freely without the author's permission. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

More from Jtad

Related shaders

guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments