Skip to content

Instantly share code, notes, and snippets.

@Erkaman
Erkaman / taa.frag
Last active April 25, 2023 02:32
rudimentary temporal anti-aliasing solution, that is good as a starting point for more advanced TAA techniques.
/*
The MIT License (MIT)
Copyright (c) 2018 Eric Arnebäck
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
@kaiware007
kaiware007 / SceneCameraController.cs
Last active April 23, 2023 16:53
GameViewのカメラを、SceneViewのカメラと同じような操作感で動かせるスクリプト for Unity
using UnityEngine;
[RequireComponent(typeof(Camera))]
public class SceneCameraController : MonoBehaviour
{
public Vector3 targetPoint; // 注視点
public float rotateSpeed = 10;
public float translateSpeed = 1;
public float zoomSpeed = 5;
@mandarinx
mandarinx / NormalsVisualizer.cs
Last active January 12, 2024 23:08
Visualize mesh normals in Unity3D
using UnityEditor;
using UnityEngine;
[CustomEditor(typeof(MeshFilter))]
public class NormalsVisualizer : Editor {
private const string EDITOR_PREF_KEY = "_normals_length";
private Mesh mesh;
private MeshFilter mf;
private Vector3[] verts;
@nemotoo
nemotoo / .gitattributes
Last active April 19, 2024 15:35
.gitattributes for Unity3D with git-lfs
## Unity ##
*.cs diff=csharp text
*.cginc text
*.shader text
*.mat merge=unityyamlmerge eol=lf
*.anim merge=unityyamlmerge eol=lf
*.unity merge=unityyamlmerge eol=lf
*.prefab merge=unityyamlmerge eol=lf
@EsProgram
EsProgram / SceneViewCamera.cs
Last active February 22, 2024 03:41
Unityのカメラ用スクリプト。Sceneビューのようなマウス操作でカメラを移動可能にする。
using UnityEngine;
/// <summary>
/// GameビューにてSceneビューのようなカメラの動きをマウス操作によって実現する
/// </summary>
[RequireComponent(typeof(Camera))]
public class SceneViewCamera : MonoBehaviour
{
[SerializeField, Range(0.1f, 10f)]
private float wheelSpeed = 1f;
@nobnak
nobnak / Quaternion.cginc
Last active April 16, 2021 09:21
Quaternion Calculation for Unity
#ifndef __QUATERNION__
#define __QUATERNION__
#define HALF_DEG2RAD 8.72664625e-3
float4 quaternion(float3 normalizedAxis, float degree) {
float rad = degree * HALF_DEG2RAD;
return float4(normalizedAxis * sin(rad), cos(rad));
}
float4 qmul(float4 a, float4 b) {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
/// <summary>
/// A simple free camera to be added to a Unity game object.
///
/// Keys:
@JohnnyBeluga
JohnnyBeluga / Unity Basic Tessellation Shader
Last active April 4, 2018 05:01
Basic triangle Unity ShaderLab Shader; Tessellates a triangle mesh and colors it red.
Shader "Tesselation/Triangle_Tesselation" {
Properties {
_TessEdge ("Edge Tess", Range(1,64)) = 2
}
SubShader {
Pass {
CGPROGRAM
#pragma target 5.0