- Home /
Shader light - Problem
Hi, I'm using this code to create a customizable shirt color with a print, and i'm trying to add the scene light to the shader, when I activate the light using a tag the print on the shirt disappear, how do I make both works?
// Upgrade NOTE: replaced 'SeperateSpecular' with 'SeparateSpecular'
Shader "ShaderAvatar/TShirt" {
Properties {
_MainTex ("Color Base", 2D) = "white" {}
_DetailTex ("Details", 2D) = "white" {}
_Color ("Main Color", Color) = (1,1,1,1)
}
SubShader {
//Tags { "LightMode" = "ForwardAdd" }
Pass {
SetTexture [_MainTex] {
constantColor[_Color]
combine constant lerp(texture) previous
}
SetTexture [_DetailTex] {
combine texture lerp (texture) previous
}
}
}
}
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
private Color c;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
GameObject.Find("polySurface1").renderer.material.SetColor("_Color",new Color((c.r/255),(c.g/255),(c.b/255),1));
}
void OnGUI(){
GUI.color=c;
GUILayout.Label("Así o más largo");
GUI.color=Color.red;
c.r=GUILayout.HorizontalSlider(c.r,0,255);
GUI.color=Color.green;
c.g=GUILayout.HorizontalSlider(c.g,0,255);
GUI.color=Color.blue;
c.b=GUILayout.HorizontalSlider(c.b,0,255);
GUI.color=Color.white;
}
}
Comment