I can’t get the specular working in the tutorial i have type exactly as him
The cub is totaly black
Here is my code
Shader "ShaderLab Tutorials/Lighting" {
Properties
{
_Emission ("Emission", Color) = (0,0,0)
_Ambient ("Ambient", Color) = (0,0,0)
_Diffuse("Diffuse", Color) = (1, 1, 1)
_Specular ("Specular", Color) = (1,1,1)
_Shininess ("Shininess", Range(.1,1)) = .5
_MainTex ("Texture", 2D) = ""
}
SubShader
{
Lighting On
Material
{
//Emission [_Emission]
//Ambient [_Ambient]
//Diffuse [_Diffuse]
Specular [_Specular]
Shininess [_Shininess]
}
Pass
{
//SetTexture[_MainTex] {Combine primary * texture}
}
}
}
Take the // out of the line in Pass { } ?
That’ll uncomment the line.
Now my code look like this and it is not working
Shader "ShaderLab Tutorials/Lighting" {
Properties
{
_Emission ("Emission", Color) = (0,0,0)
_Ambient ("Ambient", Color) = (0,0,0)
_AmbientStrength ("Ambient Strenght", Float) = 1
_Diffuse("Diffuse", Color) = (1, 1, 1)
_Specular ("Specular", Color) = (1,1,1)
_Shininess ("Shininess", Range (0,1)) = 0.3
_MainTex ("Texture", 2D) = ""
}
SubShader
{
Lighting On
Material
{
//Emission [_Emission]
//Ambient [_Diffuse]
//Ambient([_AmbientStrength], [_AmbientStrength], [_AmbientStrength])
//Diffuse [_Diffuse]
Specular [_Specular]
Shininess [_Shininess]
}
Pass
{
//SetTexture[_MainTex] {Combine primary * texture}
}
}
}
Err… the double slash I told you to remove hasn’t been removed. Infact, none of them have.
Shader "ShaderLab Tutorials/Lighting" {
Properties
{
_Emission ("Emission", Color) = (0,0,0)
_Ambient ("Ambient", Color) = (0,0,0)
_AmbientStrength ("Ambient Strenght", Float) = 1
_Diffuse("Diffuse", Color) = (1, 1, 1)
_Specular ("Specular", Color) = (1,1,1)
_Shininess ("Shininess", Range (0,1)) = 0.3
_MainTex ("Texture", 2D) = ""
}
SubShader
{
Lighting On
Material
{
Emission [_Emission]
Ambient [_Diffuse]
Ambient([_AmbientStrength], [_AmbientStrength], [_AmbientStrength])
Diffuse [_Diffuse]
Specular [_Specular]
Shininess [_Shininess]
}
Pass
{
SetTexture[_MainTex] {Combine primary * texture}
}
}
}
But when i watched the tutorial he has it comented
Check it out
Jessy
June 20, 2011, 11:55am
7
With the line commented out, you’ll just see black + specular highlights (with no texture). Some reasons I can think of that you won’t see lighting, is that you don’t have a light in the scene, your shininess value is too high, or you’re just not viewing the mesh from an appropriate angle.
I have a light in the scene but i dont get any lighting
i changed the shininess value to a smaller
Shader "ShaderLab Tutorials/Lighting" {
Properties
{
_Emission ("Emission", Color) = (0,0,0)
_Ambient ("Ambient", Color) = (0,0,0)
_AmbientStrength ("Ambient Strenght", Float) = 1
_Diffuse("Diffuse", Color) = (1, 1, 1)
_Specular ("Specular", Color) = (1,1,1)
_Shininess ("Shininess", Range (0.01,1)) = 0.3
_MainTex ("Texture", 2D) = ""
}
SubShader
{
Lighting On
Material
{
//Emission [_Emission]
//Ambient [_Diffuse]
//Ambient([_AmbientStrength], [_AmbientStrength], [_AmbientStrength])
//Diffuse [_Diffuse]
Specular [_Specular]
Shininess [_Shininess]
}
Pass
{
//SetTexture[_MainTex] {Combine primary * texture}
}
}
}
Jessy
June 20, 2011, 1:49pm
9
I just tried it with the latest version of Unity, and had no problem. Make sure the color you set for Specular is bright enough to see. Jack it up to white as a test. If that doesn’t work, attach a package to your next post.
I have not got it to work here is a package of my files
608863–21674–$Specular.unitypackage (15.2 KB)
Jessy
June 20, 2011, 2:54pm
11
There’s no mesh or light in that scene. I added a directional light, and a cube, applied that material to a cube, and saw specular light.
I have a cube and a light in the scene but not in the package i add a video how i add it. But i have unity free, is it only pro
Jessy
June 20, 2011, 5:02pm
13
Looks broken to me. I’d update your package to make sure - I’ll take another look at it - but my guess at this point is that it’s a Windows bug. I’ve seen a lot of people have problems with fixed function shaders on Windows in particular.
Okay thanks for your help