Reflective/BumpedSpecularSRCGeometry shader not working in Unity 3?

I have this transparent bumped specular reflective shader that worked fine, but as soon as I upgraded to Unity 3, the reflective cubemap part doesn’t work. After I set the cubemap for it to use, It does not show up on the object. How should I fix this? There aren’t any errors or warnings showing up, so I have no idea what it could be…

Here is the code:

Shader "Reflective/BumpedSpecularSRCGeometry" {
	Properties {
		_Color ("Main Color", Color) = (1,1,1,0)
		_SpecColor ("Specular Color", Color) = (0,0,0,0)
		_Shininess ("Shininess", Range (0.01, 1)) = 0.078125
		_ReflectColor ("Reflection Color", Color) = (1.0, 1.0, 1.0, 0)
		_MainTex ("Base (RGB) Gloss (A)", 2D) = "white"
		_BumpMap ("Bumpmap", 2D) = "bump" 
		_Cube ("cubemap", Cube) = "_Skybox"
	}
	Category {
		ZWrite Off
		Alphatest Greater 0
		Tags { "Queue" = "Geometry+1"}
		Fog { Color [_AddFog] }
		SubShader {
		UsePass "Alpha/Glossy/BASE"
		// ------------------------------------------------------
	 	// ARB_FP, Geforce3
	 	// ------------------------------------------------------
			UsePass "Reflective/Bumped Unlit/BASE" 
			Pass {
				Name "BASE"
				Tags {"LightMode" = "Vertex"}
				
				Blend SrcAlpha One
					Material {
						Diffuse [_Color]
						Ambient (1,1,1,1)
						Shininess 10
						Specular [_SpecColor]
					}
				Lighting On
				SeparateSpecular on
				SetTexture [_MainTex] { 
					constantColor [_Color] Combine texture * primary DOUBLE, constant
				}
			}
			UsePass "Alpha/BumpedSpecular/PPL"
		}
	}
	FallBack "Alpha/BumpedSpecular", 1
}

The transparency, bumpmapping, and lighting works, but the reflection is the only thing that doesn’t…

I also noticed that the cubemap element of this shader doesn’t seem to work in Unity 3. I am curious to know why as well. Do you think there’s a way to implement this shader in Strumpy Shader Editor?

Is it possible that the pass you’ve got is overwriting the reflective surface?

i.e. move this line

UsePass "Reflective/Bumped Unlit/BASE"

Below the scripted Pass {}

Yeah, using two BASE passes in a row without a Blend statement will cause the second pass to simply overwrite the results of the first.

Thanks for the answers! So were should I move it exactly? I tried several places below the Pass {}, but then it did one of two things: it either didn’t work, or it returned an error. Where should I put UsePass “Reflective/Bumped Unlit/BASE” ?

You’ll have to copy and rewrite one of the passes to use blending.

I’m still confused about what I’m supposed to be doing here…I tried copying one of the passes (I think I’m doing it right) but the shader still doesnt give me the reflection…

Can anyone here help? I tried removing one of the passes, then it let me see the reflective part, but not the transparent or specular effects.then I tried moving it to a different spot, which didnt do anything. I tried copying some of the passes and it didnt help. What should I modify here?

hi there :slight_smile:

I have the same probleme!
Any solutions?

I haven’t solved this yet, but I will try fiddling around with the code until it works! I NEED THIS SHADER!

I’m having the same problem

No solutions i’ll go back on unity 2.6 lol

gah, I still didnt figure out how to make this work…
…and I’m NOT going back to unity 2.6!! :rage:

I’m surprised this shader worked in Unity 2 to begin with. It overwrites its own passes, and refers to passes from shaders that didn’t exist by default. It’s no surprise that it doesn’t work in Unity 3.

Here is a modification of the built-in Reflective/Bumped Specular shader that supports transparency. Changes are in blue. It really is this simple with surface shaders.

Shader "Transparent/Reflective Bumped Specular" {
	Properties {
		_Color ("Main Color", Color) = (1,1,1,1)
		_SpecColor ("Specular Color", Color) = (0.5,0.5,0.5,1)
		_Shininess ("Shininess", Range (0.01, 1)) = 0.078125
		_ReflectColor ("Reflection Color", Color) = (1,1,1,0.5)
		_MainTex ("Base (RGB) RefStrGloss (A)", 2D) = "white" {}
		_Cube ("Reflection Cubemap", Cube) = "" { TexGen CubeReflect }
		_BumpMap ("Normalmap", 2D) = "bump" {}
	}

	SubShader {
		[COLOR="#4169e1"]Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}[/COLOR]
		LOD 400
		CGPROGRAM
			[COLOR="#4169e1"]#pragma surface surf BlinnPhong alpha[/COLOR]
			#pragma target 3.0

			sampler2D _MainTex;
			sampler2D _BumpMap;
			samplerCUBE _Cube;

			fixed4 _Color;
			fixed4 _ReflectColor;
			half _Shininess;

			struct Input {
				float2 uv_MainTex;
				float2 uv_BumpMap;
				float3 worldRefl;
				INTERNAL_DATA
			};

			void surf (Input IN, inout SurfaceOutput o) {
				fixed4 tex = tex2D(_MainTex, IN.uv_MainTex);
				fixed4 c = tex * _Color;
				o.Albedo = c.rgb;
	
				o.Gloss = tex.a;
				o.Specular = _Shininess;
	
				o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
	
				float3 worldRefl = WorldReflectionVector (IN, o.Normal);
				fixed4 reflcol = texCUBE (_Cube, worldRefl);
				reflcol *= tex.a;
				o.Emission = reflcol.rgb * _ReflectColor.rgb;
				[COLOR="#4169e1"]o.Alpha = c.a;[/COLOR]
			}
		ENDCG
	}

	[COLOR="#4169e1"]FallBack "Transparent/Bumped Specular"[/COLOR]
}

HI there, I copied and pasted this code into an empty file exactly and saved it as a shader, but I’m getting an error:

But all that’s there is a needed closing curly brace, that closes SubShader, line 51.
Can someone show me what the problem is?
EDIT
Ignore that, i had missed a curly brace.

Thanks working like a charme.

Hi! i tried to use this in unity 3.5 and is not working, i get a lot of error in the script.

833904--31102--$error_shader.JPG

Any chance to fix this? I’m not any good at shader scripting.

Thanks!

You’re copy and pasting nonsense text. Look at the errors.

thanks… i feel so dump right know… work fine.

Nonsense text? I got the same errors when i cut and paste the code, can you explain what you mean by the nonsense text?

Thanks