imagination XD

realizing dream

Shadowed Transparent Cutout Shader

6 Comments

Want to make a realistic tree but the leaves don’t cast shadows ? Having a problem with built-in Transparent/Cutout/Diffuse or Transparent/Cutout/Soft-edge unlit ?

Well, just use my customized shader named “ALPHARIZED SHADOW”.

Before. Culled!

Before. Culled!

After. Not culled, shadowed.

After. Not culled, shadowed.

Unity - Main.unity - MagicPuppy - PC, Mac & Linux Standalone_5Actually, in this code, Alpharized Shadow, I just disabled the cull on Transparent Cutout Diffuse shader. I’m having a research on making Additively Alpharized Shadow. What does it do ? Well, it’s simple, we enable shadow on Particle/Additive shader. It’ll make a realistic cloud effect.

Here’s the code for Alpharized Shadow

Shader "Alpharized Shadow" {
Properties {
	_Color ("Main Color", Color) = (1, 1, 1, 1)
	_MainTex ("Base (RGB) Alpha (A)", 2D) = "white" {}
	_Cutoff ("Base Alpha cutoff", Range (0,.9)) = .5
	_Multiplier("Color Multiplier",Range(1,10)) = 1.0
}
SubShader {
	Tags { "Queue"="AlphaTest" "RenderType"="TransparentCutout" }
	LOD 200
	Cull Off Lighting Off

CGPROGRAM
#pragma surface surf Lambert alphatest:_Cutoff

sampler2D _MainTex;
fixed4 _Color;
float _Multiplier;

struct Input {
	float2 uv_MainTex;
};

void surf (Input IN, inout SurfaceOutput o) {
	fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color * _Multiplier;
	o.Albedo = c.rgb;
	o.Alpha = c.a;
}

ENDCG
}

Fallback "Transparent/Cutout/VertexLit"
}
Advertisements

Author: IMGVERTEX

Started making games since 13 year old. 3D CGI Weeaboo | VFX Otaku | Anime Researcher | Indie Game Dev | VR Chuunibyou

6 thoughts on “Shadowed Transparent Cutout Shader

  1. Thank you for the great shader.
    I changed it a little in order to make toon looking, but the origin one helps me a lot.
    Thanks!

  2. Could you please help me? I am having a problem with textures on the palm trees, i have tried several models and everyone i tried does it. The problem is that when i am looking at the leaves of the tree from top it is normal, but when i look from beneath it it looks weird – the leaves are completly transparent. Any ideas how to fix it? Thanks .
    Some pics: http://tinypic.com/view.php?pic=dy8vf9&s=8#.Uz1_Tfl_tvA , http://tinypic.com/view.php?pic=2ccl4y9&s=8#.Uz2AIfl_tvA

FEED ME

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s