Skip to content

Instantly share code, notes, and snippets.

@bgolus
bgolus / WorldNormalFromDepthTexture.shader
Last active May 20, 2024 08:18
Different methods for getting World Normal from Depth Texture, without any external script dependencies.
Shader "WorldNormalFromDepthTexture"
{
Properties {
[KeywordEnum(3 Tap, 4 Tap, Improved, Accurate)] _ReconstructionMethod ("Normal Reconstruction Method", Float) = 0
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" }
LOD 100
@aras-p
aras-p / ExistingApi.cs
Created November 4, 2019 07:10
Mesh.ReadOnlyMeshData example
using System.Collections.Generic;
using System.Diagnostics;
using UnityEngine;
using UnityEditor;
using UnityEngine.Rendering;
using Debug = UnityEngine.Debug;
public class CreateSceneMesh : MonoBehaviour
{
[MenuItem("GameObject/Create Scene Mesh %G")]
@dakom
dakom / ECS notes.md
Last active May 4, 2024 21:05
ECS with sparse array notes (EnTT style)

Intro

The below is a breakdown / bird's eye view of how a sparse-array backed ECS like EnTT or Shipyard works.

Please see the thanks and references at the bottom - without their help I would not have been able to share this breakdown with you... everything here is really just notes and rephrasing of what they've written already :)

Also, these notes do not cover archetype systems (like unity) nor adaptations of archetypes (like in Flecs). Though there's a couple comparative footnotes at the end.

Here we go!

@rise-worlds
rise-worlds / For Mac 4.2.6 unlimited trial.md
Last active May 23, 2024 10:25 — forked from satish-setty/trial.md
Beyond Compare 4 license for Windows, Mac, Linux

for 4.2.4 or higher, 4.2.5,4.2.6,4.3.7, it's works, this is the way which makes Always in evaluation mode.

  1. open Terminal, go to the dir : cd /Applications/Beyond Compare.app/Contents/MacOS
  2. change the name BCompare to BCompare.bak: mv BCompare BCompare.bak
  3. touch a file name BCompare , and chmod a+ux BCompare : touch BCompare && chmod a+ux BCompare
  4. open BCompare with text editor, insert the script :
#!/bin/bash
rm "/Users/$(whoami)/Library/Application Support/Beyond Compare/registry.dat"
"`dirname "$0"`"/BCompare.bak $@
@tomlooman
tomlooman / SpiralBlurCustomDepth
Last active October 7, 2021 01:44
Spiral Blur modified to sample Custom depth buffer for soft object outlines.
float3 CurColor=0;
float2 NewUV = UV;
int i=0;
float StepSize = Distance / (int) DistanceSteps;
float CurDistance=0;
float2 CurOffset=0;
float SubOffset = 0;
float TwoPi = 6.283185;
float accumdist=0;
@aras-p
aras-p / SceneViewShowMips.shader
Last active July 2, 2021 07:51
Unity editor scene view "show mips" shader (as it is in 5.6 alpha)
/* C# code that sets up the mip colors texture:
s_MipColorsTexture = new Texture2D (32, 32, TextureFormat.RGBA32, true);
s_MipColorsTexture.hideFlags = HideFlags.HideAndDontSave;
Color[] colors = new Color[6];
colors[0] = new Color (0.0f, 0.0f, 1.0f, 0.8f);
colors[1] = new Color (0.0f, 0.5f, 1.0f, 0.4f);
colors[2] = new Color (1.0f, 1.0f, 1.0f, 0.0f); // optimal level
colors[3] = new Color (1.0f, 0.7f, 0.0f, 0.2f);
colors[4] = new Color (1.0f, 0.3f, 0.0f, 0.6f);
colors[5] = new Color (1.0f, 0.0f, 0.0f, 0.8f);
@galloscript
galloscript / imgui_color_gradient.cpp
Last active July 19, 2023 12:17
Gradient color generator and editor for ImGui
//
// imgui_color_gradient.cpp
// imgui extension
//
// Created by David Gallardo on 11/06/16.
#include "imgui_color_gradient.h"
#include "imgui_internal.h"
@nemotoo
nemotoo / .gitattributes
Last active May 18, 2024 08:08
.gitattributes for Unity3D with git-lfs
## Unity ##
*.cs diff=csharp text
*.cginc text
*.shader text
*.mat merge=unityyamlmerge eol=lf
*.anim merge=unityyamlmerge eol=lf
*.unity merge=unityyamlmerge eol=lf
*.prefab merge=unityyamlmerge eol=lf
@shelllee
shelllee / imgui_node_graph_test.cpp
Created April 12, 2016 09:50 — forked from ocornut/imgui_node_graph_test.cpp
Node graph editor basic demo for ImGui
// Creating a node graph editor for ImGui
// Quick demo, not production code! This is more of a demo of how to use ImGui to create custom stuff.
// Better version by @daniel_collin here https://gist.github.com/emoon/b8ff4b4ce4f1b43e79f2
// See https://github.com/ocornut/imgui/issues/306
// v0.02
// Animated gif: https://cloud.githubusercontent.com/assets/8225057/9472357/c0263c04-4b4c-11e5-9fdf-2cd4f33f6582.gif
// NB: You can use math functions/operators on ImVec2 if you #define IMGUI_DEFINE_MATH_OPERATORS and #include "imgui_internal.h"
// Here we only declare simple +/- operators so others don't leak into the demo code.
static inline ImVec2 operator+(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x+rhs.x, lhs.y+rhs.y); }
@tomlooman
tomlooman / ASMutator_WeaponReplacement.cpp
Created September 2, 2015 16:46
Test Gist: ASMutator_WeaponReplacement
bool ASMutator_WeaponReplacement::CheckRelevance_Implementation(AActor* Other)
{
ASWeaponPickup* WeaponPickup = Cast<ASWeaponPickup>(Other);
if (WeaponPickup)
{
for (int32 i = 0; i < WeaponsToReplace.Num(); i++)
{
const FReplacementInfo& Info = WeaponsToReplace[i];
if (Info.FromWeapon == WeaponPickup->WeaponClass)