ModelViewProjection matrix in script

Hallo,
how can i get ModelViewProjection matrix in script.I have try

	Matrix4x4 world = transform.localToWorldMatrix;
	cam = Camera.current;
	Matrix4x4 view = cam.worldToCameraMatrix;
	Matrix4x4 proj = cam.projectionMatrix;
	newMatrix = proj * view * world;

but result is differen from

glstate.matrix.mvp

I have probe with

renderer.material.SetMatrix("modelViewProjNew",newMatrix);

and

o.pos = mul( /*glstate.matrix.mvp*/modelViewProjNew, v.vertex );

I think the worldToCameraMatrix is other and not like view matrix component in shader.What is right view matrix? Maybe i have wrong.
Thanks for antworts

Are you trying this on Windows (D3D) or Mac (OpenGL)?

In Unity, coordinate space is so that Z axis points away from the camera. In OpenGL, Z axis points towards the camera. So the matrices in the shaders can be modified (one of them flipped around Z axis) to “compensate” for that. Additionally, projection matrix on D3D will be changed because projection range is different (-1…1 in OpenGL, 0…1 in D3D).

The actual question is, why do you need to access worldviewprojection matrix in the script?

I make this with D3D.I need current and last world view projection matrix for motion blur.I have two possibilities:I try to get correct matrix from shader and save it, but it say that i have not property with this name,but i can send value to this property :?
And second i can send saved matrix value from script and hier need i correct ModelViewProjection matrix for D3D.

Also,how can i get ModelViewProjection matrix in script?

there is no point in saving it, its only required for rendering and is always present in the shader which is the only place you will ever need it

what you need in the editor and scripts is the transform normally

I have wrote,that i need it and why.Shader have no possibilities save the last MVP matrix and i need it in current frame.

I have wrote function for perspective matrix from here Microsoft Learn: Build skills that open doors in your career this not helped

	Matrix4x4 perspectiveDirectX(float fovY,float aspectR,float zn,float zf){
	float yScale = 1/Mathf.Tan(fovY/2);
	float xScale = yScale / aspectR;

Matrix4x4 result = Matrix4x4.identity;

    result.SetColumn(0,new Vector4(xScale,0,0,0));
	result.SetColumn(1,new Vector4(0,yScale,0,0));
	result.SetColumn(2,new Vector4( 0,0,zf/(zf-zn) ,-zn*zf/(zf-zn)));
	result.SetColumn(3,new Vector4(0,0,1,0));
	
	return result;

		
		}

I use only
#pragma only_renderers d3d9
#pragma target 3.0

One more question to Aras.How changed the projection matrix from skript to D3D shader projection matrix?

This is 2009, now its 2023 - I am looking for a way to render a scene with a custom model-view-projection matrix obtained by a camera calibration method. But camera is in the middle of it and I am not sure how to proceed.