Skip to content

Instantly share code, notes, and snippets.

shader_type particles;
void start() {
if (RESTART_POSITION) {
TRANSFORM[3].xyz = EMISSION_TRANSFORM[3].xyz; //sets to emitter position
float _time = TIME * 200.0;
VELOCITY = vec3(1.*cos(_time),0.,1.*sin(_time)); //sets angle based on time
}
}
@partybusiness
partybusiness / random_wang_tiles.gdshader
Created April 2, 2024 21:46
Godot Wang Tile Shaders
shader_type spatial;
render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_lambert, specular_schlick_ggx;
uniform sampler2D Tile_Texture:source_color;
//used for random values on tile
vec2 random(float x, float y) {
vec2 co = round(vec2(x,y));
return vec2(
Shader "Unlit/ScreenSpaceGradient"
{
Properties
{
_TopColour("Top Colour", Color) = (0.5,0.5,0.5,1)
_BottomColour("Bottom Colour", Color) = (0.5,0.5,0.5,1)
_Height("Height", float) = 0.0
}
SubShader
{
@partybusiness
partybusiness / TwoPassStencilShader.shader
Last active April 23, 2023 03:20
Testing stencil to prove the order that passes are rendered
Shader "Unlit/TwoPassStencilShader"
{
Properties
{
_Color1("Colour1", Color) = (1,0,0,1)
_Color2("Colour2", Color) = (0,0,1,1)
}
SubShader
{
Tags{
@partybusiness
partybusiness / CircleBlur.shader
Last active January 8, 2023 19:16
VHS style camera
Shader "Unlit/CircleBlur"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_Radius ("Radius", float) = 0.8
}
SubShader
{
@partybusiness
partybusiness / GatheringEnergy.shader
Created July 12, 2021 01:23
Lines shoot into a single point. Inspired in part by an effect from Revolutionary Girl Utena.
Shader "Unlit/GatheringEnergy"
{
Properties
{
_LineWidth("Line Width", float) = 1.5
_LineLength("Line length", float) = 10.0
_LengthMult("Length Multiplier", float) = 0.2
_InwardSpeed("Inward Speed", float) = 4.0
_Seed("Random Seed", float) = 0.0
_Slices("Radial Slices", int) = 9
Shader "Skybox/MoonSkybox"
{
//Displays a skybox with an overlayed texture that can be positioned as a moon
Properties
{
_MoonTex ("Moon Texture", 2D) = "white" {}
_SkyMap ("Sky Map", Cube) = "" {}
_MoonDirection ("Moon Direction", Vector) = (0.4, 0.8, 0, 0)
_MoonScale ("Moon Scale", Range(0.01, 1.0)) = 0.2
}
@partybusiness
partybusiness / OnePointPerspective.cs
Last active September 12, 2022 11:59
Some camera tricks with the camera projectionMatrix in Unity
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[ExecuteInEditMode]
public class OnePointPerspective : MonoBehaviour {
[SerializeField]
private Camera camcam;
@partybusiness
partybusiness / ConvertImagesToTest.cs
Last active April 15, 2021 22:22
Text image format converter
#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System;
using System.IO;
@partybusiness
partybusiness / AlphaCorrect.shader
Last active March 27, 2021 01:23
Post-processing correction when outputting a transparent rendertexture. For some reason, I was getting a squared alpha so if I just dropped the result back in the scene, it was too transparent.
Shader "Post/AlphaCorrect"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" }
LOD 100