Skip to content

Instantly share code, notes, and snippets.

View josephbk117's full-sized avatar

Joseph Kalathil josephbk117

View GitHub Profile
@josephbk117
josephbk117 / FirstPass.shader
Created December 7, 2018 16:24
Unity built in Terrain Diffuse Shader
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
Shader "Nature/Terrain/Diffuse" {
Properties {
[HideInInspector] _Control ("Control (RGBA)", 2D) = "red" {}
[HideInInspector] _Splat3 ("Layer 3 (A)", 2D) = "white" {}
[HideInInspector] _Splat2 ("Layer 2 (B)", 2D) = "white" {}
[HideInInspector] _Splat1 ("Layer 1 (G)", 2D) = "white" {}
[HideInInspector] _Splat0 ("Layer 0 (R)", 2D) = "white" {}
[HideInInspector] _Normal3 ("Normal 3 (A)", 2D) = "bump" {}
@josephbk117
josephbk117 / TriPlanarTerrain.shader
Last active July 12, 2023 06:27
Tri-Planar Unity Terrain Shader
/*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 this stuff is not my responsibility*/
Shader "BitshiftProgrammer/TriPlanarTerrain"
{
Properties {
_TransitionFalloff ("Transition Falloff", Range(0.01, 10.0)) = 4.0
[HideInInspector] _Control ("Control (RGBA)", 2D) = "red" {}
[HideInInspector] _Splat3 ("Layer 3 (A)", 2D) = "white" {}
@josephbk117
josephbk117 / ReplacementShaderTest.cs
Created December 22, 2018 10:53
Replacement Shaders & Shader Keywords
using UnityEngine;
public class ReplacementShaderTest : MonoBehaviour
{
public Shader replaceShader;
private string[] KeyWords = new string[] { "UV_VIS", "LOCAL_POS_VIS", "WORLD_POS_VIS", "DEPTH_VIS", "LOCAL_NORMAL_VIS", "WORLD_NORMAL_VIS" };
private void Update()
{
if (Input.GetKeyDown(KeyCode.A))
GetComponent<Camera>().SetReplacementShader(replaceShader, ""); // All objects will have shader applied on it