Simple cube axes

This shader is a representation of the axes.
Red/Cyan – X
Green/Purple – Y
Blue/Yellow – Z

*The rotation represented in cover image not included

Shader code
shader_type spatial;

render_mode cull_front, unshaded;


void fragment() {

	vec3 world_normal = (INV_VIEW_MATRIX * vec4(NORMAL, 0.0)).xyz;

	vec3 rounded_normal = round(world_normal);

	ALBEDO =  dot(vec3(1.0), rounded_normal) < 0.0 ? -rounded_normal : cross(cross(rounded_normal, vec3(1)), rounded_normal);

}

Tags
axis, cube, simple
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.

Related shaders

Cube Mesh Glow Outline

Simple Menu Transition

Simple shadow catcher

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments