Skip to content

Instantly share code, notes, and snippets.

@ArieLeo
ArieLeo / URP_Normal.shader
Created April 27, 2023 08:47 — forked from shivaduke28/URP_Normal.shader
simple URP Lit shaders for learning
Shader "MyShader/URP_Normal"
{
Properties
{
[Header(Base Color)]
[MainTexture]_BaseMap("_BaseMap (Albedo)", 2D) = "white" {}
[HDR][MainColor]_BaseColor("_BaseColor", Color) = (1,1,1,1)
[Header(Normal)]
[MainTexture]_NormalMap("_NormalMap", 2D) = "white" {}
}
@ArieLeo
ArieLeo / ComponentVariable.cs
Created March 20, 2023 12:58 — forked from adamski11/ComponentVariable.cs
A ComponentVariable<T> can be used as a mini dependancy injection system to allow for rapid prototyping and the referencing of values without having to hard set those references in your scripts.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
using UnityEngine.Serialization;
/*To use this script, when you need to get a variable from another script/component, instead of directly
referencing the component and then the specific variable (e.g. rBody.velocity), you would make a "ComponentVariable"
@ArieLeo
ArieLeo / DebugNode.hlsl
Created March 9, 2023 16:52 — forked from bestknighter/DebugNode.hlsl
"Print a value" custom function node code for Unity ShaderGraph, aware of +Inf/-Inf and nan
// This gist can be found at https://gist.github.com/bestknighter/660e6a53cf6a6643618d8531f962be2c
// I modified Aras Pranckevičius's awesome shader code to be able to handle Infinite and Not A Number numbers
// Tested on Unity 2023.1.0a15 with ShaderGraph 15.0.1.
// Quick try at doing a "print value" node for Unity ShaderGraph.
//
// Use with CustomFunction node, with two inputs:
// - Vector1 Value, the value to display,
// - Vector2 UV, the UVs of area to display at.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.Profiling;
using UnityEngine.UI;
using System.Text;
using Unity.Profiling.LowLevel.Unsafe;
public class ReleaseBuildRecordCheck : MonoBehaviour
{
@ArieLeo
ArieLeo / .readme.md
Created December 14, 2022 07:20 — forked from andrew-raphael-lukasik/.UniversalTurretComponent.cs.md
basic turret with limited gimbal range

basic turret with limited gimbal range

@ArieLeo
ArieLeo / .readme.md
Created December 14, 2022 07:20 — forked from andrew-raphael-lukasik/.SunController.cs.md
basic sun controller script

basic sun controller

@ArieLeo
ArieLeo / .preview.md
Created December 14, 2022 06:19 — forked from andrew-raphael-lukasik/.GpuInstancingForGameObjects.cs.md
GPU Instancing for GameObjects

GPU Instancing for GameObjects

frustum culling, multiple materials are being segregated into batches with their own AABB:

@ArieLeo
ArieLeo / RaymarchSDF.hlsl
Created December 12, 2022 09:33 — forked from Anthelmed/RaymarchSDF.hlsl
A Texture3D SDF function to be used inside Unity shader graph
#ifndef RAYMARCHSDFINCLUDE_INCLUDED
#define RAYMARCHSDFINCLUDE_INCLUDED
#define STEPS 256
#define MAX_DISTANCE 500
#define MIN_DISTANCE 0.001
#if !SHADERGRAPH_PREVIEW
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Texture.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
/*
MIT License
Copyright (c) 2022 FIGHT4DREAM LIMITED
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:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
/*
A simple little editor extension to copy and paste all components
Help from http://answers.unity3d.com/questions/541045/copy-all-components-from-one-character-to-another.html
license: WTFPL (http://www.wtfpl.net/)
author: aeroson
advise: ChessMax
editor: frekons
*/
#if UNITY_EDITOR