Skip to content

Instantly share code, notes, and snippets.

View UXVirtual's full-sized avatar

Michael UXVirtual

View GitHub Profile
@UXVirtual
UXVirtual / TreeReplacerS.cs
Last active April 6, 2025 03:23 — forked from st4rdog/TreeReplacerS.cs
Replaces trees on a terrain with prefab.
using UnityEngine;
using UnityEditor;
// Replaces Unity terrain trees with prefab GameObjects.
// Handles terrain offsets correctly.
public class TreeReplacerS : EditorWindow
{
[Tooltip("The terrain containing the trees to replace.")]
public Terrain _terrain;
@sayakpaul
sayakpaul / run_flux_under_24gbs.py
Last active June 28, 2025 22:53
This gist shows how to run Flux on a 24GB 4090 card with Diffusers.
from diffusers import FluxPipeline, AutoencoderKL
from diffusers.image_processor import VaeImageProcessor
from transformers import T5EncoderModel, T5TokenizerFast, CLIPTokenizer, CLIPTextModel
import torch
import gc
def flush():
gc.collect()
torch.cuda.empty_cache()
@bryanknox
bryanknox / .editorconfig
Last active January 4, 2023 13:00
.editorconfig for C# Visual Studio projects
# EditorConfig is awesome: https://EditorConfig.org
#
# More info about editorconfig for C# and .NET in Visual Studio see:
# https://docs.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options?view=vs-2019
#
# Most of the .NET and C# rules below were taken from the
# Microsoft Roslyn team's editorconfig at:
# https://github.com/dotnet/roslyn/blob/master/.editorconfig
# Top-most EditorConfig file.
@willbroderick
willbroderick / modelviewer-extra.js
Last active February 15, 2025 08:30
Shopify Model Viewer UI inside slideshow
/*
A Gist to keep track of what was needed to make the Shopify Model Viewer UI
propagate events in a way that allows us to use it in a slideshow/carousel.
Works in Slick and Swiper. Other JS was obviously required outside here.
This is just for reference. This was called on a loop for each 3D model.
Add this SCSS:
.shopify-model-viewer-ui {
@ditzel
ditzel / MeshDestroy.cs
Created August 19, 2019 19:02
MeshDestroy => Put it on a game object with a mesh filter and renderer. Make sure to have read/write enabled on fbx import
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MeshDestroy : MonoBehaviour
{
private bool edgeSet = false;
private Vector3 edgeVertex = Vector3.zero;
private Vector2 edgeUV = Vector2.zero;
@fishtopher
fishtopher / OVRAvatarHandPoseOverrider.cs
Last active November 24, 2020 12:28
Tween the Oculus Avatar hands to any custom pose you want
using System.Collections;
using System.Collections.Generic;
using System;
using UnityEngine;
using Oculus.Avatar;
// Smoothly tween between the "real" hand pose that comes out of the
// Oculus Avatar SDK and a custom grip pose.
//
// ## Why?
@cortvi
cortvi / !Two-Sided Shader.md
Last active August 27, 2024 01:11
A PBR two-sided cloth shader that works correctly with Unity's lighting.

Extended from this article

two-sided custom shader cover image

@mokargas
mokargas / area-light.js
Last active September 5, 2017 02:25
A-Frame + Three.JS RectAreaLight
//This is now outdated. Please see: https://github.com/mokargas/aframe-area-light-component
/**
* A-Frame Wrapper for THREE.JS RectAreaLight
* @author Mo Kargas (DEVLAD) [email protected]
*/
/* global AFRAME */
@miketucker
miketucker / FXWaterPro.cs
Created February 19, 2017 22:21
Unity Water with VR support
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
Shader "FX/Water" {
Properties {
_WaveScale ("Wave scale", Range (0.02,3.0)) = 0.063
_ReflDistort ("Reflection distort", Range (0,1.5)) = 0.44
_RefrDistort ("Refraction distort", Range (0,1.5)) = 0.40
_Brightness("Brightness", Range(0,1.0)) = 0.40
_RefrColor ("Refraction color", COLOR) = ( .34, .85, .92, 1)
[NoScaleOffset] _Fresnel ("Fresnel (A) ", 2D) = "gray" {}
@DashW
DashW / ScreenRecorder.cs
Last active June 22, 2025 23:29
ScreenRecorder - High Performance Unity Video Capture Script
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Threading;
class BitmapEncoder
{
public static void WriteBitmap(Stream stream, int width, int height, byte[] imageData)