Jump to content
• ### What is your GameDev Story?

• Advertisement

#### Archived

This topic is now archived and is closed to further replies.

# Texture coordinate interpolation

This topic is 5541 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

Hi there, I am using the vs_2_0 and ps_2_0 vertex and pixel shaders heavily. Usually I normalize my vectors (L, N etc.) for per-pixel lighting in the pixel shader. The normalization is necessary because the transform in the vertex shader and the interpolation in the texture coordinate registers de-normalize the vectors. I am currently thinking about this texture coordinate interpolation process. How does it exactly working ? Thanks for your help, - Wolf [edited by - wolf on November 15, 2003 3:18:04 PM]

#### Share this post

##### Share on other sites
Advertisement
Your L and N should be interpolated in screen space such that they are correct in world space (ie, perspective correct). So should just need to normalise them per-pixel (using pixel shader or cube texture).

I think texture coordinate interpolation works like this...
For input texture coords [s, t, r, q]:
- [s/w, t/w, r/w, q/w] is calculated per-vertex after vertex shader (where w is 4th component of transformed vertex position),
- these 4 values are linearly interpolated in screen-space (as triangle is rasterized) to get [s', t', r', q'] per-pixel,
- [s'/q', t'/q', r'/q'] is calculated per-pixel and passed to the pixel shader.
...there's other combinations such as dividing by r instead of q, ignoring q, etc, depending on the api you're using (and even the driver) but that's where I start getting confused.

[edited by - soiled on November 16, 2003 4:18:16 AM]

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement
• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

(You must login to your GameDev.net account.)

• ### Popular Now

• 13
• 9
• 15
• 14
• 46
• Advertisement
• ### Forum Statistics

• Total Topics
634059
• Total Posts
3015291
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!