Extended from this article
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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 */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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" {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
NewerOlder