Skip to content

Instantly share code, notes, and snippets.

View TerraUnity's full-sized avatar

Amir Badamchi TerraUnity

View GitHub Profile
@ChristianSchott
ChristianSchott / RenderPC.cs
Created November 12, 2024 19:06
Unity Point Cloud - Compute Rasterizer
// based on https://github.com/m-schuetz/compute_rasterizer
using UnityEngine;
public struct Particle
{
public Vector4 position;
public Vector4 color;
}
@bgolus
bgolus / WorldNormalFromDepthTexture.shader
Last active October 9, 2025 03:53
Different methods for getting World Normal from Depth Texture, without any external script dependencies.
Shader "WorldNormalFromDepthTexture"
{
Properties {
[KeywordEnum(3 Tap, 4 Tap, Improved, Accurate)] _ReconstructionMethod ("Normal Reconstruction Method", Float) = 0
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" }
LOD 100
@IRCSS
IRCSS / SmoothGameCameraMovement.cs
Last active May 10, 2023 03:03
Unity Camera Movement in Game view like Scene View with filtering
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// Moves Camera similar to how camera is moved in the Unity view port. Drop the scrip on the game object which has the camera and you wish to move.
public class SmoothGameCameraMovement : MonoBehaviour
{
public float lateralSpeed = 0.0015f;
@smkplus
smkplus / UnityShaderCheatSheet.md
Last active October 22, 2024 12:19
Controlling fixed function states from materials/scripts in Unity

16999105_467532653370479_4085466863356780898_n

Shader "MaterialPropertyDrawer"
{
Properties
{
_MainTex("Texture", 2D) = "white" {}
 
[HideInInspector] _MainTex2("Hide Texture", 2D) = "white" {}
using UnityEngine;
public class TerrainDetector
{
private TerrainData terrainData;
private int alphamapWidth;
private int alphamapHeight;
private float[,,] splatmapData;
private int numTextures;
@spaceemotion
spaceemotion / OcclusionBase.cs
Created December 24, 2016 22:09
Free dynamic (run time) object occlusion scripts (https://www.reddit.com/r/Unity3D/comments/5k1gqv)
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class OcclusionBase : MonoBehaviour {
public bool isVisible { get; set; }
public DateTime lastSeen { get; set; }
}
@TJHeuvel
TJHeuvel / MeshVisualizeWindow.cs
Last active May 9, 2024 14:58
Visualizes the mesh vertices and triangles
using UnityEngine;
using UnityEditor;
using System.Collections;
using System;
public class MeshVisualizeWindow : EditorWindow
{
[MenuItem("Window/Mesh visualizer")]
public static void OpenWindow()
{
@tsubaki
tsubaki / CullingGroupSample.cs
Created January 7, 2016 15:25
CullingGroupの使用例
using UnityEngine;
using System.Collections;
public class CullingGroupSample : MonoBehaviour {
private CullingGroup group = null;
private BoundingSphere[] bounds;
[SerializeField] Transform[] targets = null;