🏴☠️
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
// Created 2024 StagPoint. Released to the public domain. | |
using System; | |
using System.Runtime.CompilerServices; | |
using Unity.Collections; | |
using UnityEngine; | |
using UnityEngine.Scripting; | |
using UnityEngine.UIElements; |
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
/** | |
* \brief Returns positional offset for a given point as a result of summing 4 gerstner waves | |
* \param positionWS point in world space | |
* \param wavelengths wavelength of each of the 4 waves | |
* \param amplitudes amplitudes of each of the 4 waves | |
* \param directions direction of each of the 4 waves (each row = one direction). MUST BE NORMALIZED! | |
* \param speed global speed multiplier. Individual wave speed depends on Wavelength | |
* \param steepness Gerstner wave 'Steepness' parameter. Modulates the horizontal offset of points | |
* \param normal returns the normal of given point. | |
* \return positional offset of the given point |
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
// Share code between HLSL (shaders) and C# | |
// | |
// Limitations: | |
// - Cannot use #include | |
// - Must use defines to hide certain keywords, such as public, private, protected, or any other object-oriented programming keywords | |
// - Use defines to convert half or fixed to your desired C# equivalent | |
// - Must always write f after float literals | |
// - Use #if !MY_DEFINE instead of #ifndef MY_DEFINE | |
// - #define cannot be used with a value in C#, not even inside an '#if SHADER_TARGET' block. Therefore, you have two options for declaring valued constants: | |
// a. Declare each constant separately in HLSL (using 'static const float MyConstant = 1.0f') and in C# (using 'const float MyConstant = 1.0f'). C# does not support 'static const'. |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#define da_append(xs, x) \ | |
do { \ | |
if ((xs)->count >= (xs)->capacity) { \ | |
if ((xs)->capacity == 0) (xs)->capacity = 256; \ | |
else (xs)->capacity *= 2; \ | |
(xs)->items = realloc((xs)->items, (xs)->capacity*sizeof(*(xs)->items)); \ | |
} \ |
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
// https://forum.unity.com/threads/programming-tools-constrained-delaunay-triangulation.1066148/#post-9181676 | |
#pragma kernel ClearVoxelsKernel | |
#pragma kernel BuildVoxelsKernel | |
#pragma kernel JumpFloodKernel | |
struct Seed | |
{ | |
float3 Location; | |
float3 Color; | |
}; |
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
// Original shader by @bgolus, modified slightly by @alexanderameye for URP, modified slightly more | |
// by @gravitonpunch for ECS/DOTS/HybridRenderer. | |
// https://twitter.com/bgolus | |
// https://medium.com/@bgolus/the-quest-for-very-wide-outlines-ba82ed442cd9 | |
// https://alexanderameye.github.io/ | |
// https://twitter.com/alexanderameye/status/1332286868222775298 | |
Shader "Hidden/Outline" | |
{ | |
Properties |
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
#ifndef TRICUBIC_INCLUDED | |
#define TRICUBIC_INCLUDED | |
float4 Cubic(float v) | |
{ | |
float4 n = float4(1.0, 2.0, 3.0, 4.0) - v; | |
float4 s = n * n * n; | |
float x = s.x; | |
float y = s.y - 4.0 * s.x; | |
float z = s.z - 4.0 * s.y + 6.0 * s.x; |
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 "Unlit/StereographicProjectionBubble" | |
{ | |
Properties | |
{ | |
_MainTex ("Texture", 2D) = "white" {} | |
_PanSpeed ("Pan Speed", Float) = 0.1 | |
_Spherify ("Spherify", Range(0,1)) = 1 | |
} | |
SubShader | |
{ |
NewerOlder