- Home /
shaders not compiling properly in monodevelop?
hi, im having real trouble with some simple custom shaders - using the latest patch of 2017 and monodevelop - i paste the code into a shader file but when i hot compile in monodevelop it doesnt show up in the shader drop down list, unless i go back to monodevelop and save the code using 'save as', so then it appears, but i get an error that this shader and fallbacks are not supported on this gpu - ive got an nvidia gtx 1050, so i cant imagine its not supported, plus its a very simple shader... also it appears its not compiling properly because in the script there is code for main_tex, but in the shaderthere is no space to put a texture?
any help please?
paul uk
Shader "Cg shader for billboards" {
Properties {
_MainTex ("Texture Image", 2D) = "white" {}
_ScaleX ("Scale X", Float) = 1.0
_ScaleY ("Scale Y", Float) = 1.0
}
SubShader {
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// User-specified uniforms
uniform sampler2D _MainTex;
uniform float _ScaleX;
uniform float _ScaleY;
struct vertexInput {
float4 vertex : POSITION;
float4 tex : TEXCOORD0;
};
struct vertexOutput {
float4 pos : SV_POSITION;
float4 tex : TEXCOORD0;
};
vertexOutput vert(vertexInput input)
{
vertexOutput output;
output.pos = mul(UNITY_MATRIX_P,
mul(UNITY_MATRIX_MV, float4(0.0, 0.0, 0.0, 1.0))
+ float4(input.vertex.x, input.vertex.y, 0.0, 0.0)
* float4(_ScaleX, _ScaleY, 1.0, 1.0));
output.tex = input.tex;
return output;
}
float4 frag(vertexOutput input) : COLOR
{
return tex2D(_MainTex, float2(input.tex.xy));
}
ENDCG
}
}
}
also - i know this shader works because ive seen it work in a youtube tutorial - its very basic - unless the code is out of date, but i dont think its that old...
If it was a tutorial, if depends on that unity version used. You should see in the inspector when selecting the shader in the project view what's wrong with it.
Your answer
Follow this Question
Related Questions
Unity 5.0.0f4 freezes at "Building assets for scene 0" 0 Answers
Terrain Tree Billboard have bright outline against dark background 6 Answers
Need help applying an x-rotation to a billboard shader (i.e. cylindrical sprite) 0 Answers
Need help with billboard shader 0 Answers
getting custom shader to work 0 Answers