Calling InScreenSpace() from Jobs

Hello,

Is there some workaround I can use to call InScreenSpace() using a CommandBuilder from inside a Job, since I can’t pass managed data to them and the required Camera is managed?

Hi

Calling InScreenSpace is equivalent to calling WithMatrix with like this:

WithMatrix(camera.cameraToWorldMatrix * camera.nonJitteredProjectionMatrix.inverse * Matrix4x4.TRS(new Vector3(-1.0f, -1.0f, 0), Quaternion.identity, new Vector3(2.0f/camera.pixelWidth, 2.0f/camera.pixelHeight, 1)))

so you could store this matrix in your job, and then use WithMatrix in the job (or PushMatrix and PopMatrix if it’s a burst-compiled job).

Wonderful, thank you Aron! I will try it out when I have time.