How to: Shader with diffuse map + reflection + lightmap

I am a newbie. Is it possible to write a shader to show Diffuse Map + Reflection (cube) + Lightmap or Self Illumination that uses texcoords1 instead of 0

I have models with texture UV in texcoord0 and lightmap UV in texcoord1

Is there a possibility to use Self Illumination shader, but to apply the map in texcoords1?

Also how is it possible to write multipass material.

Thanks in advance for replies!

this is what i have done so far… I am a newbie remember, and have very little exposure in scripting.

Shader "Lightmap_Refl" {
   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 }
	_Illum ("Illumin (A)", 2D) = "white" {}
}
SubShader {


Name "PradShades"
	
	Tags { "RenderType"="Opaque" }
	
CGPROGRAM
#pragma surface surf Lambert

sampler2D _MainTex;
samplerCUBE _Cube;
sampler2D _Illum;

fixed4 _Color;
fixed4 _ReflectColor;

struct Input {
	float2 uv_MainTex;
	float3 worldRefl;
};

void surf (Input IN, inout SurfaceOutput o) {
	fixed4 tex = tex2D(_MainTex, IN.uv_MainTex);
	fixed4 c = tex * _Color;
	o.Albedo = c.rgb;
	
	fixed4 reflcol = texCUBE (_Cube, IN.worldRefl);
	reflcol *= tex.a;
	o.Emission = reflcol.rgb * _ReflectColor.rgb;
	o.Alpha = reflcol.a * _ReflectColor.a;
	
		
}
ENDCG


	}


}

ok! I made some progress today. This shader can have texture + lightmap + reflection!!

Shader "Megsmap_Refl" {
   Properties {
	_Color ("Main Color", Color) = (1,1,1,1)
	_ReflectColor ("Reflection Color", Color) = (1,1,1,0.5)
	_MainTex ("Texture", 2D) = "white" {} 
	_Cube ("Reflection Cubemap", Cube) = "_Skybox" { TexGen CubeReflect }
	
	_Illum ("Lightmap", 2D) = "white" { LightmapMode }
}
SubShader {

Pass {
 

   
	
		BindChannels {
					Bind "Vertex", vertex
					Bind "texcoord", texcoord0
					Bind "texcoord1", texcoord1
						} 
    
    SetTexture [_MainTex] {
        constantColor [_Color]
		Combine texture * constant
        
    }
	SetTexture [_Illum] {
	
         Combine texture * previous
    }
}

Pass {
Blend One One
  

    SetTexture [_Cube] {
	
        constantColor [_ReflectColor] 
		Combine  texture * constant
	
                
				
        
    
								}


	} 


}
}

Thanks. It is very usefull. What about Lightmapped reflective bumped specular?

It’s not working with specular map in alpha channel of diffuse texture.

Hi,pradmegs
could tell me where can i use this shader ?

Hi,pradmegs
could you tell me where can i use this shader?

This shader helped A LOT.

Thanks for posting it.

I don’t know nothing about programming shaders. Willing to start on it, but if anyone can suggest on how to improve this code could save me a little work.

Thanks.

Thanks, was looking for this shader :slight_smile: