Skip to content

Instantly share code, notes, and snippets.

@hybridherbst
hybridherbst / Readme.md
Created November 25, 2024 09:26
Absolute Image URL for glTF Asset Test

AbsolutePath 안녕하세요, 세계

@hybridherbst
hybridherbst / building-openusd.md
Last active August 28, 2024 20:20
Building OpenUSD on MacOS

Building OpenUSD on MacOS

Note: This setup is not using virtualenv since I didn't get that to work for building.

Prerequisites

  • install Xcode from App Store
    • alternative: only install the Xcode Command Line Utilities
  • install official CMake
  • at time of writing: Direct download link
@hybridherbst
hybridherbst / RuntimeInitializeOnLoad - Event Order.cs
Created March 8, 2021 15:04
[RuntimeInitializeOnLoad] Event Order
static Lifecycle() => Debug.Log(Prefix + "Static Constructor");
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] static void Subs() => Debug.Log(Prefix + "Subsystem Registration");
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)] static void AfterAsm() => Debug.Log(Prefix + "AfterAssembliesLoaded");
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)] static void BeforeSlash() => Debug.Log(Prefix + "Before Splash");
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] static void BeforeScene() => Debug.Log(Prefix + "BeforeScene");
private void Awake() => Debug.Log(Prefix + "Awake");
private void OnEnable() => Debug.Log(Prefix + "OnEnable");
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)] static void AfterScene() => Debug.Log(Prefix + "AfterSceneLoad");
[RuntimeInitializeOnLoadMethod] static void DefaultLog() => Debug.Log(Prefix + "RuntimeInit Default");
void Start() => Debug
@hybridherbst
hybridherbst / VisualizeMotionTrajectories.cs
Created September 13, 2022 20:48
Motion Trajectories in Unity 3D
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
using UnityEngine.Playables;
namespace Needle.AnimationUtils
{
public class VisualizeMotionTrajectories : MonoBehaviour
@hybridherbst
hybridherbst / Custom_UIAfterPP.shader
Created August 30, 2019 09:26
Unity HDRP custom UI shader version that works for both text + images for me. Random trial + error on the blend mode. Not sure which other things are broken now...
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
Shader "Custom/UI-Default-AfterPP (Images)"// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
{
Properties
{
[PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {}
_Color("Tint", Color) = (1,1,1,1)
_StencilComp("Stencil Comparison", Float) = 8
/**
* @license
* webxr-ios-js
* Copyright (c) 2019 Mozilla Inc. All Rights Reserved.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
def "_materials"
{
def Material "Suzanne"
{
token outputs:surface.connect = </_materials/Suzanne/preview/Principled_BSDF.outputs:surface>
def Scope "preview"
{
def Shader "Principled_BSDF"
{
@hybridherbst
hybridherbst / utf8-stress-test.txt
Last active December 3, 2021 23:56
UTF8 Stress Test ₧₪№↨בּשּׂ؟⇶♚❂☈☃ ҉ↂ✂❧☠℥
Probably most complete version:
₧₪№↨בּשּׂ؟⇶♚❂☈☃ ҉ↂ✂❧☠℥
Copied with Windows Clipboard from Discord Status to Gist
₧₪№↨בּשּׂ؟⇶♚❂☈ ҉ↂ❧℥
Copied with Android Clipboard from Hangouts Status to Gist
₧₪№↨בּשּׂ؟⇶♚❂☈☃ ҉ↂ✂❧☠℥‎‎‎‎‎‎‎‎‎‎
@hybridherbst
hybridherbst / index.html
Created November 29, 2021 23:07
Twitter Player Card Meta Example
<!-- Original URL: https://prefrontalcortex.de/labs/model-viewer/upload/Tyrlefing/ -->
<!-- Twitter Card, also unfurls in Slack/Discord etc. -->
<meta name="twitter:card" content="player" />
<meta name="twitter:site" content="hybridherbst" />
<meta name="twitter:player" content="https://prefrontalcortex.de/labs/model-viewer/upload/Tyrlefing/index.html" />
<meta name="twitter:player:width" content="480" />
<meta name="twitter:player:height" content="480" />
<meta property="og:image" content="https://prefrontalcortex.de/labs/model-viewer/upload/Tyrlefing/20211100-231259-poster.webp" />
<meta property="og:title" content="Tyrlefing" />
@hybridherbst
hybridherbst / gist:90d554dfb6791517acb2d75af6baf516
Last active November 26, 2021 16:12
Unity PlayerPref & EditorPref hash handling
// Unity hashes PlayerPref names to make them case-sensitive
// (Windows Registry isn't case sensitive otherwise)
private static string ToKey(string prefName)
{
return prefName + "_h" + Hash(prefName);
}
// djb2-xor hash method
private static uint Hash(string str)