Skip to content

Instantly share code, notes, and snippets.

View unitycoder's full-sized avatar
‏‏‎

mika unitycoder

‏‏‎
View GitHub Profile
@unitycoder
unitycoder / CloneAndFlipTriangles.cs
Created September 22, 2022 10:53 — forked from kurtdekker/CloneAndFlipTriangles.cs
Clones and flips a piece of geometry, optionally using another material
using UnityEngine;
// @kurtdekker
//
// Place on a MeshFilter / MeshRenderer GameObject.
//
// This will:
// - duplicate the entire GameObject via Instantiate
// (and obviously its children; those are ignored!)
// - parent it to the same place the original was
@unitycoder
unitycoder / Comment.cs
Created September 8, 2022 15:17 — forked from apkd/Comment.cs
Use this component to leave comments to other developers (and yourself) on GameObjects, prefabs, etc. Double-click the text area to edit.
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.Callbacks;
#endif
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using S = UnityEngine.SerializeField;
@unitycoder
unitycoder / TriplanarWorld.shader
Created August 22, 2022 07:46 — forked from radiatoryang/TriplanarWorld.shader
a triplanar / procedural UV / world space UV shader for Unity, cobbled together bits from @quickfingerz and @Farfarer
Shader "Tri-Planar World" {
Properties {
_Side("Side", 2D) = "white" {}
_Top("Top", 2D) = "white" {}
_Bottom("Bottom", 2D) = "white" {}
_SideScale("Side Scale", Float) = 2
_TopScale("Top Scale", Float) = 2
_BottomScale ("Bottom Scale", Float) = 2
}
@unitycoder
unitycoder / UnityStencilMask.shader
Created August 19, 2022 12:00 — forked from ewandennis/UnityStencilMask.shader
A simple stencil buffer masking shader for Unity
Shader "Custom/StencilMask" {
Properties {
_StencilMask("Stencil mask", Int) = 0
}
SubShader {
Tags {
"RenderType" = "Opaque"
"Queue" = "Geometry-100"
}
@unitycoder
unitycoder / UnityGraphicsBullshit.cs
Created August 19, 2022 07:56 — forked from JimmyCushnie/UnityGraphicsBullshit.cs
Exposes some Unity URP graphics settings that are (for some stupid fucking bullshit reason) private.
using System.Reflection;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
using ShadowResolution = UnityEngine.Rendering.Universal.ShadowResolution;
/// <summary>
/// Enables getting/setting URP graphics settings properties that don't have built-in getters and setters.
@unitycoder
unitycoder / GazeRays.cs
Created August 17, 2022 10:06 — forked from qxxxb/GazeRays.cs
Render gaze rays for each eye on the HTC Vive Pro Eye.
using System.Runtime.InteropServices;
using UnityEngine;
using ViveSR.anipal.Eye;
public class GazeRays : MonoBehaviour
{
private static EyeData eyeData = new EyeData();
private bool eye_callback_registered = false;
// Render gaze rays.
@unitycoder
unitycoder / VoronoiNoise.shader
Created August 16, 2022 20:52 — forked from josephbk117/VoronoiNoise.shader
Voronoi shader in unity
/*Please do support www.bitshiftprogrammer.com by joining the facebook page : fb.com/BitshiftProgrammer
Legal Stuff:
This code is free to use no restrictions but attribution would be appreciated.
Any damage caused either partly or completly due to usage of this stuff is not my responsibility*/
Shader "BitShiftProductions/VoronoiMagic2"
{
Properties
{
}
@unitycoder
unitycoder / ffmpeg-commands.sh
Created August 11, 2022 19:24 — forked from 44213/ffmpeg-commands.sh
ffmpeg commands.
# To extract the sound from a video and save it as MP3:
ffmpeg -i <video.mp4> -vn <sound>.mp3
# To convert frames from a video or GIF into individual numbered images:
ffmpeg -i <video.mpg|video.gif> <frame_%d.png>
# To combine numbered images (frame_1.jpg, frame_2.jpg, etc) into a video or GIF:
ffmpeg -i <frame_%d.jpg> -f image2 <video.mpg|video.gif>
# To quickly extract a single frame from a video at time mm:ss and save it as a 128x128 resolution image:
@unitycoder
unitycoder / ffmpeg.md
Created August 10, 2022 06:36 — forked from whizkydee/ffmpeg.md
using ffmpeg to extract audio from video files

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

@unitycoder
unitycoder / get_exe_version.c
Created July 28, 2022 21:13 — forked from djha-skin/get_exe_version.c
Get version from EXE file on linux
/* Distributed under the CC-wiki license.
* user contributions licensed under cc by-sa 3.0 with attribution required: https://creativecommons.org/licenses/by-sa/3.0/
* Originally taken from the answer by @rodrigo, found here: http://stackoverflow.com/a/12486703/850326
*/
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <string.h>
#include <stdint.h>
#include <sys/stat.h>