Skip to content

This is a visual shader addon for Godot 4.2+. This adds the UVManipulation node to the visual shader editor.

License

Notifications You must be signed in to change notification settings

Foyezes/Godot-UV-Manipulation-Node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Godot UV Manipulation Node

This is a visual shader addon for Godot 4.2+. This adds the UVManipulation node to the visual shader editor. image

Method

This node allows you to change pivot point, scale, rotate and offset a UV.

The order of operation is: Change Pivot > Scale > Rotate > Reset Pivot > Offset

The rotate function is created first.

vec2 rotateUV(vec2 uv_in, float angle) {
	  float angle_rad = radians(angle);
	  mat2 rotate = mat2(
		  vec2(cos(angle_rad), -sin(angle_rad)),
		  vec2(sin(angle_rad), cos(angle_rad))
	  );
  	return rotate * uv_in;
}

Then the UV manipulation.

vec2 UVManip(vec2 uv, float scale_placeholder, float rotation_placeholder, vec2 pivot_placeholder, vec2 offset_placeholder) {
  vec2 pivot_internal = clamp(pivot_placeholder, 0.0, 1.0);
  uv -= pivot_internal;
  uv *= scale_placeholder;
  uv = rotateUV(uv, rotation_placeholder);
  uv += pivot_internal;
  uv += offset_placeholder;
  return uv;
}

Installation

Extract the zip file and copy the folder to your project. You'll need to restart the editor for the node to appear in visual shader. Alternatively, you can make a new gdscript file and copy the code.

About

This is a visual shader addon for Godot 4.2+. This adds the UVManipulation node to the visual shader editor.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published