I want make vertex-fragment shader in unity. I know about GLSL, but first try for cg/hlsl programming.
if i setting unity to 'graphic API for openGLCore', i can use struct uniform variables. uniform variable mean, shader properties. (glsl call it uniform)
but i setting unity to 'graphic API for Direct3D', it cant work. compile error.
this is error.
Shader error in 'HLSL/Phong_cg': Fragment program 'frag': Struct variable
'u_material' is ignored. Only instancing constant buffers can have struct
variables (on d3d11)
this is code.
struct MATERIAL {
fixed4 ambient_color;
fixed4 diffuse_color;
fixed4 specular_color;
fixed4 emissive_color;
float specular_exponent;
};
uniform MATERIAL u_material;
I can't find how to solve. if i use struct in function(local varialble), it has no problem. but i need global(uniform)....
it's impossible?
ps. in cg/hlsl, this 'uniform variable' called what? it's just properties?