Difference between ViewSpace, Screen Space and Clip Space.

I’m watching this tutorial on shaders, and came across the function “UnityObjectToClipPos”, which is described as doing a series of transformations, from LocalSpace to WorldSpace to ViewSpace to ClipSpace to Screen Space. I understand Local and world, but I’m having trouble understanding the differences between View, Clip and Screen. What are these?

  • Thanks!

This might be helpful.
x.com

edit: Working link
https://antongerdelan.net/opengl/raycasting.html

I wrote another post somewhere going into further detail that I can’t find. However the basics are view space (aka eye space) is the position in local camera space, like if you were to attach a game object as a child of a camera game object.

Clip space is what you get when you apply the projection matrix. This gets a bit complicated, but basically it gets things ready for rasterization by putting what will appear on screen in -w to +w range.

Screen space is clip space after rasterization, which is clipPos.xyz / clipPos.w (aka device space in that link), or that transformed into a 0.0 to 1.0 UV range (aka viewport space).

9 Likes

Hi,

If you want a bit more detail on how to go from one to another there was this article from cushycode (website at the bottom of the page, but it looks like it’s down, not mine)

3337988–260510–Transformations between Local, World and Camera Spaces in Unity3D shaders – Cushy Code.pdf (194 KB)

1 Like

For more details about transformations, here is excel file with step-by-step calculations from object space to screen space (link to file is included in movie description)

6 Likes