Procedural Bamboo Shader

A procedural bamboo shader.

Shader code
/*
	竹シェーダー by あるる(きのもと 結衣) @arlez80
	Bamboo Shader by Yui Kinomoto

	MIT License
*/

shader_type spatial;

uniform vec4 stalk_color : hint_color = vec4( 0.45, 0.81, 0.57, 1.0 );
uniform vec4 node_color : hint_color = vec4( 0.97, 0.92, 0.85, 1.0 );
uniform float node_scale = 18.0;
uniform float shift = 0.001;
uniform float noise_scale = 450.0;

float node( float y )
{
	float f = mod( y * node_scale, 1.0 );
	return float( f < 0.02 ) * sin( f * 50.0 );
}

void fragment( )
{
	float x = sin( cos( UV.x * noise_scale ) * 6.0 ) * max( sin( UV.y * node_scale ) * 0.05, 0.01 );
	float y = clamp( -node( UV.y - shift ) + node( UV.y + shift ), -0.5, 0.5 );
	
	NORMALMAP = normalize( vec3( 0.5 + x, 0.5 + y, 0.5 ) );
	ALBEDO = mix( stalk_color.rgb, node_color.rgb, node( UV.y ) );
}
Live Preview
Tags
Bamboo, Procedural
The shader code and all code snippets in this post are under MIT license and can be used freely. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

More from arlez80

Related shaders

guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments