Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is there a way to get OpenGL to do linear texture-mapping?



Hey Nicholas,

You already guessed what I'm up to.. reflective water :-) I also read the ShaderX article, I just don't get the perspective part quite right.
The matrix you show below doesn't quite seem to fix my problem. Looking at it, I think it just translates the projected vertex coordinates ([-1,1],[-1,1],[-1,1]) into texture coord space ([0,1],[0,1],[0,1]). I got that right, too.. The problem just seems to be that the space between the vertices gets distorted by perspective-correct texture mapping. If I increase the tesselation level enough, or move the camera far away, so the polygons become smaller, the problem isn't visible any longer. Also changing the vertex program output of the texture w value doesn't seem to have any effect on coordinate interpolation.


Does your fragment shader do anything more then looking up the texel at the interpolated texture coordinates? Also at what point in your program do you project the texture (calculate x/z,y/z)? The vertex program code snippet you sent me doesn't seem to do that..

Cheers,
jonas


On Mar 30, 2005, at 2:03 PM, Nicholas Francis wrote:

Hi Jonas...

You want to take a look at texture w coordinate to undo the effects of the perspective correction. You use the texture matrix together with eye-space texgen to set it up.

ATI has a paper detailing it: http://www.ati.com/developer/shaderx/ ShaderX_RipplingRefractiveAndReflectiveWater.pdf

For GooBall, we couldn't get their stuff to work, so we rolled our own (the paper was still well worth the read). The matrix we used ended up looking like this:

.5	 0	 0	 .5
 0 	-.5	0	.5
0	0	.5	.5
0	0	0	1

If you're using a rectangle texture, you wat to multiply the two upper rows with the texture dimensions.

_______________________________________________ Do not post admin requests to the list. They will be ignored. Mac-opengl mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/mac-opengl/email@hidden

This email sent to email@hidden
References: 
 >Is there a way to get OpenGL to do linear texture-mapping? (From: jonas echterhoff <email@hidden>)
 >Re: Is there a way to get OpenGL to do linear texture-mapping? (From: Nicholas Francis <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.