Hello. I have a Linear regression matrix built from correspondences between 3D world points and the position they can be found in the Screen coord system.

I can multiply a 3D point to this matrix and I can confirm it outputs x,y values where it would be represented on the Screen coord system.

Now, I am not sure how to apply this matrix to the pipeline correctly.
Following some examples like this , I am just trying to apply this custom matrix to the camera.projectionMatrix

The camera’s projection matrix needs to be just the projection matrix and the view matrix comes from the camera’s transform. Part of the reason for this is the projection matrix set on the camera is expected to be an OpenGL projection matrix. If you’re using anything but OpenGL for rendering (currently only Android and Linux, though those both will likely soon be Vulkan by default) then the projection matrix needs to be transformed from from OpenGL to Direct3D or a similar form. If the view matrix is pre-applied, then I suspect that transformation doesn’t work properly. If you can, construct the projection matrix and the view matrix separately, and apply the projection matrix to the camera and the view matrix to the camera’s transform as a position and rotation.

You could construct your projection matrices as a Direct3D in c#, but you still can’t set it on the camera since it will always try to convert the projection matrix. The other option would be to pass in your matrix as a custom global property and use custom shaders to use your custom matrix instead of the built in ones. You may also need to use command buffers to render objects, as objects placed in the scene will be frustum culled if they’re not in the view of the existing camera (based on the projection and view matrices it uses by default).

Thanks for the reply!
I might be wrong, but I’ve been convinced decomposing a view-projection matrix is a bit complicated, no? (multi-solution)

I am trying to use the same logic I used in a sketch from Processing long ago, where, in the end, I use push and pop matrix to encapsulate the code where I apply this custom matrix to the current model matrix. Pretty much as it follows, I was in the hope something like the code below could be of any help:

//the line below draws correctly:
GL.Color(Color.yellow);
GL.Begin(GL.LINES);
GL.Vertex3(5, -5, -5);
GL.Vertex3(5, 5, -5);

//is there a way I can render everything from scene here, under this matrix transform?

GL.PopMatrix();
}

I am using this attached to the camera, OnPostRender(), just to evaluate the matrix itself. So far I know I might have to put this piece of code inside another method in case it could be ever useful. I need a little more material to study when you refer to a custom global property or command buffers if some one could indicate me.