Skip to content

Instantly share code, notes, and snippets.

View tosk3's full-sized avatar
🦆

tosk3

🦆
View GitHub Profile
@bgolus
bgolus / PristineRadialGrid.shader
Last active June 12, 2024 18:15
An application of the Pristine Grid technique onto radial grid with atan derivative discontinuity fixes applied. https://bgolus.medium.com/the-best-darn-grid-shader-yet-727f9278b9d8 https://bgolus.medium.com/distinctive-derivative-differences-cce38d36797b
Shader "Pristine Radial Grid"
{
Properties
{
[Toggle] _WorldUV ("Use World Space UV", Float) = 1.0
_GridScale ("Grid Scale", Float) = 1.0
[Toggle] _UseAdaptiveAngularSegments ("Use Adaptive Angular Segment Count", Float) = 0.0
[IntRange] _AngularSegments ("Angular Segments", Range(1,360)) = 4.0
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Random = System.Random;
// This source code is used for the video. It obviously requires heavy alterations to be used in a real project.
public class ExampleGrid : MonoBehaviour
{
[SerializeField] private Vector2Int _size;
[SerializeField] private Vector2 _gap;
@lover-drive
lover-drive / BlitPass.cs
Created February 18, 2022 23:24
URP volumetric fog experiment
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
namespace Zombies.VFX {
public class BlitPass : ScriptableRenderPass {
RenderTargetHandle _source;
@Invertex
Invertex / CustomHoldingInteraction.cs
Last active May 16, 2024 09:56
Unity New Input System custom Hold "Interaction" where the .performed callback is constantly triggered while input is held.
using UnityEngine;
using UnityEngine.InputSystem;
//!!>> This script should NOT be placed in an "Editor" folder. Ideally placed in a "Plugins" folder.
namespace Invertex.UnityInputExtensions.Interactions
{
//https://gist.github.com/Invertex
/// <summary>
/// Custom Hold interaction for New Input System.
/// With this, the .performed callback will be called everytime the Input System updates.
@Fewes
Fewes / Tricubic.cginc
Last active May 7, 2024 07:16
Tricubic texture sampling using 8 trilinear samples
#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;