- Home /
Recreating the ModelViewProjection in Script ( as used in Shader ? )
Basically, I'm interested in exactly what the question asks. I've tried several combination of the Matrices but none seem to have the same result as the Matrix used by "glstate.matrix.mvp"
If anyone has a solution, please share! This is killing me.
bump
What are you wanting to use the $$anonymous$$VP matrix for? $$anonymous$$aybe you can get the info from somewhere else (your billboarding tag suggests this may be the case...)
Yeah, I pass 4 vertices( quad ) to the shader all at the same location;
The shader then uses the Billboard Extrusions, defined in UV1. To transform the vertices into Billboards with the help of the Camera Location and Up/Right vectors.
Answer by Daniel-Brauer · Aug 26, 2010 at 08:20 PM
Matrix4x4 p = camera.projectionMatrix; p[2,2] = -p[2,2]; p[3,2] = -p[3,2];
Matrix4x4 mvp = p*cameraTransform.worldToLocalMatrix*objectTransform.localToWorldMatrix;
I don't know why you need to negate those two values.
@$$anonymous$$: Do you know (just curious), if Unity does multiplication as it should (right to left), or left to right? I know XNA does ltr.
Your answer
![](https://koobas.hobune.stream/wayback/20220613020042im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Can I make a billboard plane on terrain tree prefab? 3 Answers
custom tree shading issue 1 Answer
Create facing camera quad at runtime given start and end points 1 Answer
Efficient mesh instantiation 2 Answers
How to make a billboard shader? 1 Answer