w component

I have been so confusing about the w component for ages, until I read this:
Explaining Homogeneous Coordinates & Projective Geometry

So I quickly made a simple to shader to test it out:

To summarize, w component is the

The W dimension is the distance from the projector to the screen(object).

when w > 1, the object looks far (smaller)
when w = 1, the size remains the same
when w = 0, it’s actually covering the whole screen

This is the reason why we have make sure the w component is correct when we are doing _Object2World and _World2Object

Also a interesting point to note from the blog post:

If W=1, then it is a point light. If W=0, then it is a directional light.

(Thanks Kemal for the tutorial links!)


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s