x


Declaring a matrix parameter in a shader

Hi,

I'm writing a shader, and it would be convenient for me to expose a matrix (for programmable parameter insertion) rather than four vectors. I see that the material class has a SetMatrix function, but can only find predefined examples of using that.

I would like to do something like

_MyMat ("My Matrix", Matrix) = (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

In my shader, but can't get the syntax to compile. Does anyone know if its possible, and if so, what the syntax is?

Thanks!

more ▼

asked Mar 16 '11 at 08:11 PM

Noam Gat gravatar image

Noam Gat
23 3 3 3

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Well, i wasn't able to figure out if shaderlab supports matrix properties. The Unity docs doesn't say anything about that but in cg - shaders it seems to be possible, at least as global uniform parameter.

Most matrices are available by default (as far as i know), but i'm not really into shader development in Unity yet.
We need a shader guru here ;)

more ▼

answered Mar 16 '11 at 08:46 PM

Bunny83 gravatar image

Bunny83
45.2k 11 49 207

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1653
x66
x56

asked: Mar 16 '11 at 08:11 PM

Seen: 1328 times

Last Updated: Mar 16 '11 at 08:11 PM