This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Drawing; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Custom/StandardClippable" { | |
Properties | |
{ | |
_Color("Color", Color) = (1,1,1,1) | |
_MainTex("Albedo", 2D) = "white" {} | |
_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5 | |
_Glossiness("Smoothness", Range(0.0, 1.0)) = 0.5 | |
[Gamma] _Metallic("Metallic", Range(0.0, 1.0)) = 0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef PLANE_CLIPPING_INCLUDED | |
#define PLANE_CLIPPING_INCLUDED | |
//Plane clipping definitions. Uses three planes for clipping, but this can be increased if necessary. | |
#if CLIP_ONE || CLIP_TWO || CLIP_THREE || CLIP_FOUR | |
//If we have 1, 2 or 3 clipping planes, PLANE_CLIPPING_ENABLED will be defined. | |
//This makes it easier to check if this feature is available or not. | |
#define PLANE_CLIPPING_ENABLED 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class ClippableObject : MonoBehaviour | |
{ | |
//only 3 clip planes for now, will need to modify the shader for more. | |
private int _clipPlanes = 4; | |
public Material[] _materials; | |
public GameObject _planeX; | |
public GameObject _planeXnegative; |