Accessing View Projection Matrix from material

Hello,

I need to access view projection matrix in my material, is it possible in any way?

Thanks in advance.

Not without using Custom nodes or special named parameters.

But there is a good chance you can accomplish what you want with the Transform nodes:

If you need something more flexible, you might want to consider writing USF shaders directly. But if you really need to, you can take a look at the source code for the Transform nodes (or other nodes that transform between coordinate spaces) to see how to access the view parameters in the material editor.

1 Like

Thanks for the answer, I’ll look into it, I need it for projected grid shader I think I can actually achieve it with Transform nodes you provided, thanks a lot again. :wink:

I love you :slight_smile:

It’s an old post but, I leave a comment because I think There are still many people that search for this these days.


You can get view projection matrix using custom node and ResolvedView.ViewToClip fuction.
Return value is a matrix so, you should acces rows or elements with a array access expression. e.g. ResolvedView.ViewToClip[0][0]

I think there are more matrix like that in engine code so, If I need I should search through engine code.

1 Like

Great help! :slightly_smiling_face: