Skip to content

Instantly share code, notes, and snippets.

CONVERTED_MODEL_PATH = "path to converted v2 depth model"
DEVICE = "cuda"
INIT_IMAGE = "path to init image or None"
DEPTH_IMAGE = "path to black and white depth map"
OUTPUT_PATH = "path to save the result"
import diffusers
from diffusers.pipelines.stable_diffusion import StableDiffusionPipelineOutput
import torch
@donmccurdy
donmccurdy / generate_lods.mjs
Last active June 18, 2024 04:45
Example implementation of MSFT_lod in glTF-Transform.
import { Extension, ExtensionProperty, Node, NodeIO, PropertyType } from '@gltf-transform/core';
import { weld, dedup, simplifyPrimitive } from '@gltf-transform/functions';
import { MeshoptSimplifier } from 'meshoptimizer';
/******************************************************************************
* Example implementation of MSFT_lod for glTF-Transform.
*
* ⚠️ NOTICE: This code is provided for the sake of example, and is not tested or
* maintained. For a full implementation, refer to:
* https://github.com/takahirox/glTF-Transform-lod-script
@bigujun
bigujun / gist:5bdb40c3fcedd5ca3e8e3c4e3dcc8541
Created May 3, 2022 20:00
Vite + React + React rotuer dom, route pages from /pages
import { Fragment, lazy, Suspense } from 'react'
import { Routes, Route } from 'react-router-dom'
const PRESERVED = import.meta.globEager('/src/pages/(_app|404).tsx')
const ROUTES = import.meta.glob('/src/pages/**/[a-z[]*.tsx')
// const ROUTES = import.meta.globEager('/src/pages/**/[a-z[]*.tsx')
const preserved = Object.keys(PRESERVED).reduce((preserved, file) => {
const key = file.replace(/\/src\/pages\/|\.tsx$/g, '')
@0beqz
0beqz / BoxProjectedEnvMapHelper.js
Last active September 21, 2024 05:34
Updated code to box-project env-maps in three.js (r137) - credits go to codercat (https://codercat.tk) for the box-projecting code
import * as THREE from "three"
// credits for the box-projecting shader code go to codercat (https://codercat.tk)
const worldposReplace = /* glsl */`
#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )
vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );
#ifdef BOX_PROJECTED_ENV_MAP
vWorldPosition = worldPosition.xyz;
@spite
spite / superellipsoid
Last active September 2, 2021 16:42
distorts an icosahedron sphere into a superellipsoid
// https://en.wikipedia.org/wiki/Superellipsoid
function c(w, m) {
const cv = Math.cos(w);
return Math.sign(cv) * Math.abs(cv) ** m;
}
function s(w, m) {
const sv = Math.sin(w);
return Math.sign(sv) * Math.abs(sv) ** m;
@emilianavt
emilianavt / BestVTuberSoftware.md
Last active September 20, 2024 07:58
Best VTuber Software

Best VTuber software

This is a list of the most commonly used and relevant vtubing software. The "best" will always be subjective and depend on your specific requirements. Overall, the information in this list is as accurate as I could figure it out, but there might be errors or some details might become out of date. If you find anything that needs to be corrected, please let me know. You can also note it in a comment.

Additional explanations:

  • iPhone means that an iPhone is basically required
  • iFacialMocap support means that tracking data can be received from the iFacialMocap iPhone app
  • VMC protocol means that the application can send and/or receive tracking data from other VMC protocol capable applications, allowing the combination of multiple tracking methods (e.g. VSeeFace receiving VR tracking from Virtual Motion Capture and iPhone/ARKit face tracking from Waidayo)
  • Tobii means that the Tobii eye tracker is supported
@gfodor
gfodor / gist:1cf49c77886b592dc72fd0ce766e5172
Created October 20, 2020 16:27
Jel Media Stream System
// This code is licensed under MPLv2 - Author: Greg Fodor
const isMobileVR = AFRAME.utils.device.isMobileVR();
const isFirefoxReality = isMobileVR && navigator.userAgent.match(/Firefox/);
export class MediaStreamSystem {
constructor(sceneEl) {
this.mediaStream = new MediaStream();
this.scene = sceneEl;
this.store = window.APP.store;
@a-type
a-type / meshCollision.ts
Created September 21, 2020 19:08
ThreeJS mesh geometry collider in cannon.js
// supposing "geometry" is a ThreeJS BufferGeometry - if it's a geometry, just skip this step
const geo = new Geometry().fromBufferGeometry(geometry);
const vertices = [];
const indices = [];
// "scale" is a uniform scale you may or may not have applied to your mesh as a whole.
// just set it to 1 if you don't scale the mesh.
for (const vert of geo.vertices) {
vertices.push(vert.x * scale);
@AndreasH96
AndreasH96 / sticky-object.js
Last active August 17, 2020 13:23
This code is based on a gist made by Utophia, https://gist.github.com/Utopiah/f2b11a8026030b726ecc8c8c9430a9b4 . It's made for being able to snap videos onto other objects.
/* global AFRAME */
const COLLISION_LAYERS = require("../constants").COLLISION_LAYERS;
AFRAME.registerComponent("sticky-object", {
schema: { resetScaleWhenGrabbed: { default: true } },
init() {
this.currentSnapTarget = null;
const physicsSystem = this.el.sceneEl.systems["hubs-systems"].physicsSystem;
@zach-capalbo
zach-capalbo / hubseggbot.js
Created May 16, 2020 14:28
A Headless Mozilla Hubs Bot that drops easter eggs in a room
const ROOM_URL = "https://hub.link/cmPv8xv"
var HEADLESS_BROWSER = true
var puppeteer = require('puppeteer');
var browser
var page
async function launchBrowser () {
browser = await puppeteer.launch({headless: HEADLESS_BROWSER});