Skip to content

Instantly share code, notes, and snippets.

@shivaduke28
shivaduke28 / StandardVariant.hlsl
Created March 16, 2022 17:49
a copy of Standard shader
/*
Copyright(c) 2016 Unity Technologies
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files(the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions :
@shivaduke28
shivaduke28 / ShaderUtility.cs
Last active March 16, 2022 13:44
create HLSL file in Unity
using UnityEditor;
using System.IO;
using System.Linq;
namespace TKMNY.Editor
{
public static class ShaderUtility
{
private const string DefaultHLSLTemplate = @"
#ifndef <TemplateName>_INCLUDED
@shivaduke28
shivaduke28 / UdonProgramLocation.cs
Last active March 11, 2022 05:18
U#スクリプトと同じフォルダに置いてProgramAssetを移動したりするやつ
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEngine;
using VRC.Udon;
using System.Linq;
namespace Shivaduke.Editor
{
[CreateAssetMenu(menuName = "Shivaduke/UdonProgramLocation", fileName = "UdonProgramLocation")]
@shivaduke28
shivaduke28 / EmissiveGamma.shader
Created February 23, 2022 14:34
AVProScreen用のシェーダー
Shader "Custom/EmissiveGamma"
{
Properties
{
// _MainTex_ST is overridden by AVProVideoScreen.
// use _ScaleOffset instead of _MainTex_ST.
[NoScaleOffset] _MainTex("Texture", 2D) = "black" {}
_ScaleOffset("Tiling Offset", Vector) = (1, 1, 0, 0)
_Emission("Emission Scale", Float) = 1
// enable gamma for AVProVideo
@shivaduke28
shivaduke28 / .gitignore
Created February 23, 2022 09:43
gitignore VRChat Avator
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore
#
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
@shivaduke28
shivaduke28 / ScreenSpaceTexture.hlsl
Last active February 13, 2022 00:46
VRでテクスチャをスクリーンスペースに表示するやつ
float _Alpha;
sampler2D _MainTex;
float4 _MainTex_TexelSize;
float _Scale;
struct appdata
{
float4 vertex : POSITION;
};
@shivaduke28
shivaduke28 / MyObjectCreateUtils.cs
Last active January 24, 2022 05:08
Create Object from MenuItem
[MenuItem("GameObject/Foo", false, -1)]
public static void CreateFoo(MenuCommand command = null)
{
// When called from MenuItem, this method is executed for every selected objects in the Hierarchy.
if (command != null)
{
var context = command.context;
if (context != null && context != Selection.activeObject) return;
}
var parents = Selection.transforms;
@shivaduke28
shivaduke28 / ObjectReference.cs
Created November 29, 2021 02:58
ObjectReference
using System.Linq;
using System.Text;
using UnityEngine;
namespace MyNameSpace
{
public class ObjectReference<T> where T : Component
{
T value;
readonly string rootName;
@shivaduke28
shivaduke28 / FogController.cs
Last active October 16, 2021 15:05
VRChat Global Fog Controller(全然ちゃんと動作確認してないよ!)
using UdonSharp;
using UnityEngine;
using UnityEngine.UI;
using VRC.SDKBase;
using VRC.Udon;
namespace Tsukemonoya
{
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
@shivaduke28
shivaduke28 / LightMapHolder.cs
Last active March 20, 2023 01:02
Simple Udon scripts for changing ligthmaps at runtime
using UdonSharp;
using UnityEngine;
namespace TKMNY
{
[UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)]
public sealed class LightMapHolder : UdonSharpBehaviour
{
[SerializeField] Texture[] lightmaps;