- Home /
Forcing the Standard Shader to use 0 specular
Hi there. I'm trying to make a threadbare carpet material so I don't want any specular reflection. This page...
https://docs.unity3d.com/Manual/shader-NormalSpecular.html
..says 'the alpha channel of the main texture acts as a Specular Map'. I have tried, in Photoshop, to add an alpha channel which is just black (0 specular), but the image does not save with that alpha channel included!
How do I save an image with an alpha channel set to black?
I have tried using both the metallic and specular versions of the standard shader, but even when I set the specular to colour to black, or added a black texture to the specular texture, I'm still getting specular reflections off my carpet!
What's the deal? How do I save an image with a black alpha channel?
Any help, much appreciated!
So you can't just set the Smoothness value to 0? Is there something different about your material editor?
Also, the page you linked to is not about the Standard shader, it is about the Specular shader which has since been replaced by the Standard shader and is ins$$anonymous$$d available in the legacy shaders sub-menu.
Ah ha! Well, the fact is was from an earlier version of Unity was not obvious to me. So I'm guessing the 'alpha channel acts as Specular $$anonymous$$ap' line doesn't apply. I had also already set smoothness to 0, but the carpet still has specular reflection. $$anonymous$$aybe I can say the home owners have just has the carpet cleaned or something...
It shouldn't have reflection unless you have set the default reflection source in the lighting menu to 'Custom', in which case it may disregard smoothness settings. Could you post an image?
O$$anonymous$$, that's good to know. I'll check the lighting menu setting on $$anonymous$$onday. I have smoothness set to 0, but I'm still getting a subtle 'sheen' reflected on the carpet material, so that may well be it.
Answer by JScotty · Oct 14, 2016 at 09:38 AM
Hi Moose,
Here I have an custom shader class for you, to create one, go in editor->Assets-> right mouse -> create -> shader -> sub shader (first)
name your shader what you'll want
and open it with Visual studio or Monodevelop
replace all code within the standard shader with:
//name "customShader" whatever you like to name it
Shader "Custom/customShader" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Main textyre", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
_Transparency ("Transparency", Range(0.0,1.0)) = 1
}
SubShader {
Tags{ "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" }
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard alpha
sampler2D _MainTex;
struct Input {
float2 uv_MainTex;
};
half _Glossiness;
half _Metallic;
fixed4 _Color;
half _Transparency;
void surf (Input IN, inout SurfaceOutputStandard o) {
// Albedo comes from a texture tinted by color
fixed4 alpha = fixed4(1, 1, 1, _Transparency);
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * alpha * _Color;
o.Albedo = c.rgb;
o.Alpha = alpha.a;
// Metallic and smoothness come from slider variables
o.Smoothness = _Glossiness;
o.Metallic = _Metallic;
}
ENDCG
}
FallBack "Diffuse"
}
In this case to use this shader, create new material add to shader -> Custom -> customShader Playaround with the smoothness and metallic (smooth and metallic 0 is no specular)
Hope this worked a bit
Your answer
![](https://koobas.hobune.stream/wayback/20220612094610im_/https://answers.unity.com/themes/thub/images/avi.jpg)