3DSprite 3Der or smth

ive used this site a lot so i thought hey- lets share some of my code.

Shader code
shader_type spatial;
render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_burley, specular_schlick_ggx;

uniform sampler2D texture_albedo : source_color, filter_nearest;
uniform float tilt_angle_degrees : hint_range(0.0, 45.0) = 12.0;
uniform float tilt_speed : hint_range(0.1, 10.0) = 3.0;
uniform float instance_phase_randomness : hint_range(0.0, 1.0) = 1.0;

void vertex() {
	// Calculate unique phase offset using node position
	float phase_offset = NODE_POSITION_WORLD.x * 12.9898 + NODE_POSITION_WORLD.z * 78.233;
	float phase = sin(TIME * tilt_speed + phase_offset * instance_phase_randomness);
	
	float angle = radians(tilt_angle_degrees) * phase;
	
	float cos_a = cos(angle);
	float sin_a = sin(angle);
	
	mat2 rot_matrix = mat2(
		vec2(cos_a, -sin_a),
		vec2(sin_a, cos_a)
	);
	
	float height_factor = VERTEX.y + 0.5; 
	VERTEX.xy = mix(VERTEX.xy, rot_matrix * VERTEX.xy, clamp(height_factor, 0.0, 1.0));
}

void fragment() {
	vec4 albedo_tex = texture(texture_albedo, UV);
	ALBEDO = albedo_tex.rgb;
	ALPHA = albedo_tex.a;
	ALPHA_SCISSOR_THRESHOLD = 0.5; 
}

// See SiKoRa on itch.io!
Live Preview
Tags
3d
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.
guest

2 Comments
Oldest
Newest Most Voted
tentabrobpy
9 days ago

Mein Gott…it’s adorable