Skip to content

Instantly share code, notes, and snippets.

@PixHammer
PixHammer / LocalYBillboardUnshaded.gdshader
Last active February 22, 2024 18:11
Local Y Space Billboard Shader - Godot 4.2
// By default Godot does not include a local y space billboard option within the StandardMaterial3D, and only includes a world up.
// This is annoying, as for a lot of effects you need the billboard to align with an axis that isn't world up.
// For example bullet tracers, or muzzle flashes shown from the side, or grass aligned with a slopes normal.
// This shader adds this feature.
// To use it, simply add this as the shader on a quad's material.
shader_type spatial;
render_mode blend_mix,depth_draw_opaque,cull_back,unshaded;
uniform vec4 albedo : source_color;
uniform sampler2D texture_albedo : source_color,filter_linear_mipmap,repeat_enable;
@PixHammer
PixHammer / TerrainDataCloner.cs
Last active March 7, 2024 23:07 — forked from Eldoir/TerrainDataCloner.cs
Helper to deep-copy a TerrainData object in Unity3D - Updated for Unity 2021.2
using UnityEngine;
/// <summary>
/// Provides means to deep-copy a TerrainData object because Unitys' built-in "Instantiate" method
/// will miss some things and the resulting copy still shares data with the original.
/// </summary>
public class TerrainDataCloner {
/// <summary>
/// Creates a real deep-copy of a TerrainData
/// </summary>