Skip to content

Instantly share code, notes, and snippets.

View unitycoder's full-sized avatar
‏‏‎

mika unitycoder

‏‏‎
View GitHub Profile
@tombuben
tombuben / Internal-MotionVectors.shader
Created March 31, 2022 19:13
Simple extension of the built in Unity Standard shader to properly support motion vectors with cutout transparency
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
Shader "New/Internal-MotionVectors"
{
//BEGIN(Tomas.Bubenicek): Properties taken directly from Standard.shader
Properties
{
_Color("Color", Color) = (1,1,1,1)
_MainTex("Albedo", 2D) = "white" {}
@ScottJDaley
ScottJDaley / Outline.shader
Last active November 20, 2025 13:13
Wide Outlines Renderer Feature for URP and ECS/DOTS/Hybrid Renderer
// 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
using System;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Jobs;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.Rendering;
public class SimpleBRGExample : MonoBehaviour
{
@yasirkula
yasirkula / PaddingIgnoringImage.cs
Last active October 17, 2024 03:00
Modified version of Image component that ignores the sprite's padding in Unity
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Sprites;
using UnityEngine.UI;
#if UNITY_2017_4 || UNITY_2018_2_OR_NEWER
using UnityEngine.U2D;
#endif
#if UNITY_EDITOR
using UnityEditor;
@dwilliamson
dwilliamson / ModifiedMarchingCubes.js
Created February 8, 2022 16:20
Transvoxel's Modified Marching Cubes Lookup Tables
//
// Lookup Tables for Transvoxel's Modified Marching Cubes
//
// Unlike the original paper (Marching Cubes: A High Resolution 3D Surface Construction Algorithm), these tables guarantee
// a closed mesh "whose connected components are continuous and free of holes."
//
// Rotations are prioritised over inversions so that 3 of the 6 cases containing ambiguous faces are never added. 3 extra
// cases are added as a post-process, overriding inverses through custom-build rotations to eliminate the rest.
//
// Uses the exact same co-ordinate system as https://gist.github.com/dwilliamson/c041e3454a713e58baf6e4f8e5fffecd
@Vixxd
Vixxd / .gitignore
Last active August 20, 2024 12:08
Bakery Lightmapper .gitignore for Unity
########################################
# Bakery .gitignore
# Ignore: https://geom.io/bakery/wiki/index.php?title=How_do_I...#How_do_I_use_git.2Fcollab.2Fother_version_control_system_with_Bakery.3F
# Never ignore: https://geom.io/bakery/wiki/index.php?title=How_do_I...#How_do_I_share_a_scene_with_someone_who_doesn.E2.80.99t_have_Bakery_installed.3F
########################################
############# BAKERY ASSETS ############
# Ignore Bakery Assets folder
/[Aa]ssets/Bakery/*
@Cyanilux
Cyanilux / RenderToDepthTexture.cs
Last active June 17, 2025 12:23
URP Render Feature that manually renders DepthOnly pass to _CameraDepthTexture, filtered by LayerMask. Tested in URP v10, Unity 2020.3
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
/*
- Renders DepthOnly pass to _CameraDepthTexture, filtered by LayerMask
- If the depth texture is generated via a Depth Prepass, URP uses the Opaque Layer Mask at the top of the Forward/Universal Renderer asset
to determine which objects should be rendered to the depth texture. This feature can be used to render objects on *other layers* into the depth texture as well.
@rkandas
rkandas / decimator.py
Created November 27, 2021 16:00
Imports the given FBX model, Decimates the meshes and exports as FBX
import bpy
import os
import sys
'''
Imports the given FBX model, Decimates the meshes and exports as FBX
@input
<input_fbx_filepath>
@yasirkula
yasirkula / WavyImage.cs
Last active June 18, 2025 19:18
Create UI image with wave animation in Unity
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Sprites;
using UnityEngine.UI;
#if UNITY_2017_4 || UNITY_2018_2_OR_NEWER
using UnityEngine.U2D;
#endif
#if UNITY_EDITOR
using UnityEditor;
@ArieLeo
ArieLeo / Usage.cs
Created November 7, 2021 09:38 — forked from Refsa/Usage.cs
DrawMeshInstancedIndirect with ShaderGraph and URP
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;
class Render : MonoBehaviour
{
struct DrawData
{
public Vector3 Pos;
public Quaternion Rot;