Created
September 21, 2015 14:10
-
-
Save hecomi/68b95e1e18059fce5e93 to your computer and use it in GitHub Desktop.
THETA の動画のテクスチャをくっつけるやつ
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 "Theta/Sphere1" { | |
Properties { | |
_MainTex ("Base (RGB)", 2D) = "white" {} | |
_AlphaBlendTex ("Alpha Blend (RGBA)", 2D) = "white" {} | |
_OffsetU ("Offset U", Range(-0.5, 0.5)) = 0 | |
_OffsetV ("Offset V", Range(-0.5, 0.5)) = 0 | |
_ScaleU ("Scale U", Range(0.8, 1.2)) = 1 | |
_ScaleV ("Scale V", Range(0.8, 1.2)) = 1 | |
_ScaleCenterU ("Scale Center U", Range(0.0, 1.0)) = 0 | |
_ScaleCenterV ("Scale Center V", Range(0.0, 1.0)) = 0 | |
} | |
SubShader { | |
Tags { "RenderType" = "Transparent" "Queue" = "Background" } | |
Pass { | |
Name "BASE" | |
Blend SrcAlpha OneMinusSrcAlpha | |
Lighting Off | |
ZWrite Off | |
CGPROGRAM | |
#pragma vertex vert_img | |
#pragma fragment frag | |
#include "UnityCG.cginc" | |
uniform sampler2D _MainTex; | |
uniform sampler2D _AlphaBlendTex; | |
uniform float _OffsetU; | |
uniform float _OffsetV; | |
uniform float _ScaleU; | |
uniform float _ScaleV; | |
uniform float _ScaleCenterU; | |
uniform float _ScaleCenterV; | |
float4 frag(v2f_img i) : COLOR { | |
float2 uvCenter = float2(_ScaleCenterU, _ScaleCenterV); | |
float2 uvOffset = float2(_OffsetU, _OffsetV); | |
float2 uvScale = float2(_ScaleU, _ScaleV); | |
float2 uv = (i.uv - uvCenter) * uvScale + uvCenter + uvOffset; | |
float4 tex = tex2D(_MainTex, uv); | |
tex.a *= pow(1.0 - tex2D(_AlphaBlendTex, i.uv).a, 2); | |
return tex; | |
} | |
ENDCG | |
} | |
} | |
} |
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 "Theta/Sphere2" { | |
Properties { | |
_MainTex ("Base (RGB)", 2D) = "white" {} | |
_AlphaBlendTex ("Alpha Blend (RGBA)", 2D) = "white" {} | |
_OffsetU ("Offset U", Range(-0.5, 0.5)) = 0 | |
_OffsetV ("Offset V", Range(-0.5, 0.5)) = 0 | |
_ScaleU ("Scale U", Range(0.8, 1.2)) = 1 | |
_ScaleV ("Scale V", Range(0.8, 1.2)) = 1 | |
_ScaleCenterU ("Scale Center U", Range(0.0, 1.0)) = 0 | |
_ScaleCenterV ("Scale Center V", Range(0.0, 1.0)) = 0 | |
} | |
SubShader { | |
Tags { "RenderType" = "Transparent" "Queue" = "Background+1" } | |
UsePass "Theta/Sphere1/BASE" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
詳細はこちら: https://twitter.com/hecomi/status/645964647846141952