Skip to content

Instantly share code, notes, and snippets.

View StagPoint's full-sized avatar

StagPoint Software StagPoint

  • StagPoint Software
  • Seattle, WA
View GitHub Profile
@h3r2tic
h3r2tic / raymarch.hlsl
Last active November 14, 2024 18:25
Depth buffer raymarching for contact shadows, SSGI, SSR, etc.
// Copyright (c) 2023 Tomasz Stachowiak
//
// This contribution is dual licensed under EITHER OF
//
// Apache License, Version 2.0, (http://www.apache.org/licenses/LICENSE-2.0)
// MIT license (http://opensource.org/licenses/MIT)
//
// at your option.
#include "/inc/frame_constants.hlsl"
@alexanderameye
alexanderameye / CircularMenu.cs
Last active October 31, 2024 11:55
Circular menu for the Unity Editor
/*
MIT License
Copyright (c) [year] [fullname]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@Longor1996
Longor1996 / MF_GridLines.T3D
Created November 28, 2022 15:04
Unreal Engine 5 - Material Function - GridLines
Begin Object Class=/Script/Engine.MaterialFunction Name="MF_GridLines"
Begin Object Class=/Script/Engine.Material Name="Material_0"
Begin Object Class=/Script/Engine.MaterialEditorOnlyData Name="Material_0EditorOnlyData"
End Object
End Object
Begin Object Class=/Script/Engine.MaterialExpressionMaterialFunctionCall Name="MaterialExpressionMaterialFunctionCall_14"
End Object
Begin Object Class=/Script/Engine.MaterialExpressionMax Name="MaterialExpressionMax_2"
End Object
Begin Object Class=/Script/Engine.MaterialExpressionFunctionOutput Name="MaterialExpressionFunctionOutput_1"
@alexanderameye
alexanderameye / SceneSwitcherToolbarOverlay.cs
Last active December 1, 2023 22:37
A small scene switcher utility for Unity
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEditor.Overlays;
using UnityEditor.SceneManagement;
using UnityEditor.Toolbars;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UIElements;
@tattyd
tattyd / Shadow.cs
Last active November 14, 2024 09:11
Soft shadow control for Unity UI Toolkit
/* MIT License
Copyright (c) 2022 David Tattersall
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@brihernandez
brihernandez / NavMeshAreaIDs.cs
Last active June 20, 2022 19:07
Simple wrapper classes for handling Navmesh Area related operations in Unity.
using UnityEngine.AI;
/// <summary>
/// Convenience class for handling NavMesh Area related operations and lookups in Unity.
/// </summary>
public readonly struct UnityNavMeshLayer
{
/// <summary>
/// Name of the Area as defined in the Navigation window in Unity.
/// </summary>
@markeahogan
markeahogan / IMGUIRectExtensions.cs
Last active June 16, 2024 18:09
Utility functions for IMGUI Rects, useful for drawing PropertyFields in a single line without lots of Rect boilerplate
using UnityEngine;
namespace PopupAsylum
{
/// <summary>
/// Utility functions for IMGUI Rects, useful for drawing PropertyFields in a single line
/// Works by returning the Rect to draw the contol and filling the out argument with a Rect for the remaining space
/// By passing the same Rect to the out member it can keep eating chunks of the property's Rect
///
/// void ExampleDrawer(SerializedProperty property, Rect rect)
@dwilliamson
dwilliamson / MarchingCubes.js
Last active October 10, 2024 18:14
Marching Cubes Lookup Tables
//
// Lookup Tables for Marching Cubes
//
// These tables differ from the original paper (Marching Cubes: A High Resolution 3D Surface Construction Algorithm)
//
// The co-ordinate system has the more convenient properties:
//
// i = cube index [0, 7]
// x = (i & 1) >> 0
// y = (i & 2) >> 1
@bgolus
bgolus / MatCapTechniques.shader
Created January 29, 2022 00:37
Showing multiple matcap techniques, including a proposed improved method that's no more expensive than the usual fix if you're starting with the world position and world normal.
Shader "Unlit/MatCap Techniques"
{
Properties
{
[NoScaleOffset] _MatCap ("MatCap", 2D) = "white" {}
[KeywordEnum(ViewSpaceNormal, ViewDirectionCross, ViewDirectionAligned)] _MatCapType ("Matcap UV Type", Float) = 2
}
SubShader
{
Tags { "RenderType"="Opaque" }
@bgolus
bgolus / MobileVRHighlight.shader
Last active October 25, 2023 01:44
A mobile VR and MSAA friendly single object highlight shader using the stencil buffer
Shader "Mobile VR Highlight" {
Properties {
_ColorOutline ("Outline", Color) = (1,1,1,1)
_ColorInterior ("Interior", Color) = (0.25,0.25,0.25,0.25)
_ColorInteriorFaded ("Interior Faded", Color) = (0.1,0.1,0.1,0.1)
_ColorInteriorOcc ("Interior Occluded", Color) = (0.15,0.15,0.15,0.15)
_ColorInteriorOccFaded ("Interior Occluded Faded", Color) = (0.05,0.05,0.05,0.05)
_PulseRateMod ("Pulse Rate Modifier", Float) = 4.0
_OutlneWidth ("Outline Pixel Width", Float) = 1.0
}