Skip to content

Instantly share code, notes, and snippets.

@wojtekpil
wojtekpil / rd_32_bits.gd
Created December 30, 2022 20:49
Godot 4 - Rendering pipeline with 32 bits image attachment
extends Node
# based on https://github.com/pkdawson/rd_demo/blob/master/demo.gd
# CC0-1.0 license
#path to TextureRect node for visualisations
@onready var texture_rect = $"../VBoxContainer/TextureRect"
var vertSrc = "#version 450
vec2 positions[3] = vec2[](
@wojtekpil
wojtekpil / hterrain_enhanced.shader
Created July 28, 2021 12:59
Hterrain enhanced shader for terrain (Classic4)
shader_type spatial;
render_mode cull_back,blend_mix, diffuse_burley, specular_schlick_ggx;
// This is the reference shader of the plugin, and has the most features.
// it should be preferred for high-end graphics cards.
// For less features but lower-end targets, see the lite version.
uniform sampler2D u_terrain_heightmap;
uniform sampler2D u_terrain_normalmap;
// I had to remove `hint_albedo` from colormap because it makes sRGB conversion kick in,
@wojtekpil
wojtekpil / hterrain_detail_enhanced.shader
Last active October 11, 2023 19:14
Hterrain enhanced shader for detail layers
shader_type spatial;
render_mode cull_disabled, blend_mix,diffuse_burley, specular_schlick_ggx;
uniform sampler2D u_terrain_heightmap;
uniform sampler2D u_terrain_detailmap;
uniform sampler2D u_terrain_normalmap;
uniform sampler2D u_terrain_globalmap : hint_albedo;
uniform mat4 u_terrain_inverse_transform;
uniform mat3 u_terrain_normal_basis;
shader_type spatial;
render_mode blend_mix,depth_draw_always, cull_disabled,diffuse_burley,specular_schlick_ggx;
uniform vec4 albedo : hint_color;
uniform sampler2D texture_albedo : hint_albedo;
uniform float specular = 0.5;
uniform float metallic = 0;
uniform float proximity_fade_distance = 0.85;
uniform float roughness : hint_range(0,1) = 1;
uniform float alpha_clip : hint_range(0,1) = 0.85;
@wojtekpil
wojtekpil / 10-matrix-gpio-keyboard.rule
Created September 19, 2018 18:33
Joystick and buttons for PowerMinty 1.2
SUBSYSTEM=="input", ATTRS{name}=="Matrix GPIO keyboard", ENV{ID_INPUT_JOYSTICK}="1"