Hello forum!
So, I found a great billboard GLSL shader at this link, I made some little changes, and it works perfectly on OSX and iOS to suit my needs. In this demo I made, I used this shader to render some fake 3D boxes.
As you can expect, it doesn’t show on Windows machines since it’s GLSL… So I would like to ask if someone can help me converting it in any other type, so everyone can see the above demo without glitches.
Thanks to whose willing to help. ![]()
Here it is my shader:
Shader "Billboard" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Texture Image", 2D) = "white" {}
}
SubShader {
Pass {
Cull Off
GLSLPROGRAM
uniform sampler2D _MainTex;
uniform vec4 _Color;
uniform vec4 _MainTex_ST;
varying vec4 textureCoords;
varying vec4 color;
#ifdef VERTEX
void main()
{
gl_Position = gl_ProjectionMatrix
* (gl_ModelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0)
+ vec4(gl_Vertex.x, gl_Vertex.y, 0.0, 0.0));
textureCoords =
vec4(gl_Vertex.x + 0.5, gl_Vertex.y + 0.5, 0.0, 0.0);
color = vec4(_Color.r - 0.5, _Color.g - 0.5, _Color.b - 0.5, 1.0);
}
#endif
#ifdef FRAGMENT
void main()
{
gl_FragColor = texture2D(_MainTex , _MainTex_ST.xy * vec2(textureCoords) + (_MainTex_ST.zw));
if (gl_FragColor.a < 0.5)
{
discard;
}
gl_FragColor += color;
}
#endif
ENDGLSL
}
}
}