x


making the built in shader Reflective/Diffuse to Fade In Out

Am a newbie to the shader world. Am just trying to add a slider to the built in Reflective/Diffuse shader which would control the alpha of the material.

Below is the shader I wrote, I just added Transparent/Diffuse which would use the alpha value from Main Color (_Color )

Shader "MyShaders/Test" {

Properties {
   _Color ("Main Color", Color) = (1,1,1,1)
   _ReflectColor ("Reflection Color", Color) = (1,1,1,0.5)
   _MainTex ("Base (RGB) RefStrength (A)", 2D) = "white" {}
   _Cube ("Reflection Cubemap", Cube) = "_Skybox" { TexGen CubeReflect }
}

SubShader {
   //LOD 200
   //Tags { "RenderType"="Opaque" }
   UsePass "Reflective/VertexLit/BASE"
   UsePass "Diffuse/PPL"
   UsePass "Transparent/Diffuse/BASE"
}enter code here
FallBack "Diffuse"

}

So basically if i change the alpha value of _Color that entire material should fade In/Out

any ideas???

more ▼

asked Dec 23 '09 at 10:51 AM

pkamat gravatar image

pkamat
443 11 12 20

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

A "pass" in ShaderLab-speak means a complete rendering of the object (several passes means the object is rendered several times). Later passes are rendered over earlier ones, so you can't modify the transparency of an earlier pass with a later one. Transparency in the later pass just shows through to the result of the earlier one.

You would need to modify the reflective pass to include transparency or else find an existing shader that does this.

more ▼

answered Jan 14 '10 at 01:35 PM

andeeee gravatar image

andeeee ♦
1.4k 3 6 18

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1655
x56

asked: Dec 23 '09 at 10:51 AM

Seen: 1611 times

Last Updated: Dec 23 '09 at 10:57 AM