- Home /
Shader Property issue.
I'm having an issue with getting a shader to work in unity. (Decal Framework- blood flow).
Errors to the console all are similar to "Material doesn't have a texture property '_RampMap' UnityEditor.DockArea:OnGUI()"
Also for _MainTex, _SourceBumpMap, _Shininess, _SpecColor, and _Color
However the shader has these lines in its properties.
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_SpecColor ("Specular Color", Color) = (0.5, 0.5, 0.5, 0)
_Shininess ("Shininess", Range (0.01, 1)) = 0.078125
_MainTex ("Base (RGB) FluidHeight (A)", 2D) = "white" {}
_SourceBumpMap ("Bumpmap of source surface(RGB)", 2D) = "bump" {}
_RampMap ("Blood Ramp Map",2D) = "white" {}
}
Why can I not add this shader to a new material?
Answer by Owen-Reynolds · Mar 24, 2011 at 10:59 PM
I got this error trying to write the CGPROGRAM part (which you may not even have, which is fine.) It was because I needed to (re?)declare _SecondaryTex
, down below.
If you have a CGPROGRAM part, you should see sampler2D _MainTex;
down there. Add a similar line for your new texture.
I don't think your understanding of shaders is quite right. Declaring a variable in the properties block opens it up to be used in fixed-function shaders. Unity will pass their information to the CGProgram if you request (declare the variable again). Then I think by shader code you mean a CGProgram which isn't necessary to have a shader. And finally, in CG, a square 2d texture is defined as sampler2D not Texture2D.
Thanks. Someone co$$anonymous$$g from HLSL/CG shaders, using FXComposer, doesn't even touch the Fixed Function switches. The standard books have 2 pages on One$$anonymous$$inusDestAlpha
in the "History" section. So, no, I only understand the part that goes inside CGPROGRA$$anonymous$$, and just enough of the rest to get by. Editting my response...
Your answer
Follow this Question
Related Questions
Material doesn't have a color property '_Color' 4 Answers
Material offset relative to other game object 0 Answers
How can i get mixed texture from one shader and set it for another object with another shader? 0 Answers
Only on Mac OSX: Rendering/shader error within webplayer 0 Answers
Laser Shader/Material? 0 Answers