yum-archive/Tooner

A toon shader for Unity's BIRP.

git clone https://git.yummers.dev/yum-archive/Tooner

yumInitial commitdcb15c0

v0.0.0
2.1 KiB64 linesraw
1#ifndef __MOCHIE_SHADOW_CASTER_INC
2#define __MOCHIE_SHADOW_CASTER_INC
3
4// Source: https://github.com/cnlohr/shadertrixx?tab=readme-ov-file#shadowcasting
5// MIT License
6// 
7// NOTE: Much content here is originally from others.  Content in third party
8// folder may not be fully MIT-licensable. 
9// 
10// Copyright (c) 2021 cnlohr, et. al.
11// 
12// All other content in this repository falls under the following terms:
13// 
14// Permission is hereby granted, free of charge, to any person obtaining a copy
15// of this software and associated documentation files (the "Software"), to deal
16// in the Software without restriction, including without limitation the rights
17// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18// copies of the Software, and to permit persons to whom the Software is
19// furnished to do so, subject to the following conditions:
20// 
21// The above copyright notice and this permission notice shall be included in all
22// copies or substantial portions of the Software.
23// 
24// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30// SOFTWARE.
31
32#pragma vertex vert
33#pragma fragment frag
34#pragma multi_compile_instancing
35#pragma multi_compile_shadowcaster
36#include "UnityCG.cginc"
37
38struct appdata {
39	float4 vertex : POSITION;
40	float3 normal : NORMAL;
41	UNITY_VERTEX_INPUT_INSTANCE_ID
42};
43
44struct v2f {
45	float4 pos : SV_POSITION;
46	UNITY_VERTEX_INPUT_INSTANCE_ID 
47		UNITY_VERTEX_OUTPUT_STEREO
48};
49
50v2f vert (appdata v){
51	v2f o = (v2f)0;
52	UNITY_SETUP_INSTANCE_ID(v);
53	UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
54	TRANSFER_SHADOW_CASTER_NORMALOFFSET(o)
55		return o;
56}
57
58float4 frag (v2f i) : SV_Target {
59	UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
60	return 0;
61}
62
63#endif  // __MOCHIE_SHADOW_CASTER_INC
64