When/where is the model matrix set?

Hi,

I have a procedural shader dispatched with a DrawProcedural() call inside OnRenderObject() for one of my components.

While UNITY_MATRIX_MVP contains the correct camera and projection transforms, the transform for the object the component is attached to are not present.

When does Unity set the model/world transforms?
(Or, in what callback should I call DrawProcedural() to ensure they are in UNITY_MATRIX_MVP?)

Sj

What do you mean by “not present”?

see:
http://docs.unity3d.com/Manual/ExecutionOrder.html

When OnRenderObject is called the matrices should be updated to match whatever has been done in Update, LateUpdate, FixedUpdate, …

Thanks ericbegue, I will give that link a thorough look. By “not present” I mean the transform supplied to the shader remains the same, regardless of the parameters of the Transform of the gameobject to which the component script is attached.

Was this ever resolved? I am having a similar problem.

Ok I solved this by using a CommandBuffer, the DrawProcedural function in the CommandBuffer class takes a matrix. I then just used Graphics.ExecuteCommandBuffer