This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shader_type spatial; | |
render_mode skip_vertex_transform; | |
uniform vec4 albedo : source_color = vec4(1.0); | |
uniform sampler2D texture_albedo : source_color,filter_linear_mipmap,repeat_enable; | |
uniform sampler2D texture_normal : hint_roughness_normal,filter_linear_mipmap,repeat_enable; | |
uniform float normal_scale : hint_range(-16,16) = 1.0; | |
uniform sampler2D texture_heightmap : hint_default_black,filter_linear_mipmap,repeat_enable; | |
uniform float heightmap_scale = 1.0; | |
uniform int heightmap_min_layers: hint_range(0, 128, 1) = 8; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func format_value(value: float) -> String: | |
var result := "" | |
var negative := value < 0.0 | |
value = abs(value) | |
if _last_value > 1000.0: | |
var scale = ["K", "M", "G", "T", "P", "E"] | |
var v = _last_value | |
var index = -1 | |
while v > 1000.0 and index < (scale.size() - 1): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class_name MeshUtils | |
static func auto_smooth(mesh: Mesh, threshold_degrees := 30.0) -> Mesh: | |
var result := ArrayMesh.new() | |
var threshold := deg_to_rad(threshold_degrees) | |
var sanitized_mesh := merge_duplicate_vertices(mesh) | |
# Auto smooth each surfaces. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shader_type spatial; | |
uniform sampler2D depth_texture : hint_depth_texture, repeat_disable, filter_nearest; | |
uniform sampler2D screen_texture : hint_screen_texture, repeat_disable, filter_nearest; | |
uniform float v_depth_offset = 0.0; | |
uniform float v_depth_fade = 1.0; | |
uniform sampler2D underwater_color : repeat_disable; | |
uniform sampler2D caustics_texture : hint_default_black; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A Godot 4 shader to make things appear on top of other things within a range. | |
// Initially, this was made so my characters' facial features would be rendered on top of their hair. | |
shader_type spatial; | |
render_mode unshaded; | |
uniform sampler2D depth_texture : hint_depth_texture, repeat_disable, filter_nearest; | |
// Maximum depth we can overdraw relative to the object original depth, in ENGINE UNITS. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends EditorNode3DGizmoPlugin | |
var editor_plugin: EditorPlugin | |
var _previous_size | |
func _init(): | |
create_material("lines", Color(1, 1, 1)) | |
create_material("box", Color(1.0, 1.0, 1.0, 0.1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class_name ShaderCache | |
extends Spatial | |
signal stage_completed | |
signal all_shaders_compiled | |
export var shaders_folder := "res://material/shaders/" | |
export var particles_folder := "res://vfx/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tool | |
extends Resource | |
class_name GridShape | |
export var size := Vector2.ONE | |
export var grid := [] | |
func _init() -> void: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tool | |
class_name ConceptBoxInput | |
extends Spatial | |
signal input_changed | |
signal property_changed | |
export var size := Vector3.ONE setget set_size |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shader_type spatial; | |
uniform sampler2D mask; | |
uniform float min_scale = 0.0; | |
uniform float max_scale = 1.0; | |
varying float scale; | |
float range_lerp(float value, float istart, float istop, float ostart, float oend) { |
NewerOlder