Sign in to follow this  
guya

frustum clipping u,v problem

Recommended Posts

Hi, I am building a 3d portal engine and i already done a frustum clipping in 3d. I have a problem with the u v clipping because it making the texture bending and twisting (although the 3d card is doing perspective correction) I am using this formula for the u,v calculation (where s is the intersection point distance): u = u1 + s*(u2-u1) v = v1 + s*(v2-u1) What did i do wrong? Thanks, Guy

Share this post


Link to post
Share on other sites
oops, i wrote it by mistake...

I'm using this formula:

u = u1 - s*(u2-u1)
v = v1 - s*(v2-v1)

and i have the texture bending problem while clipping..

[Edited by - guya on September 10, 2009 9:23:45 AM]

Share this post


Link to post
Share on other sites
Are you manually clipping your triangles against the portals? If so, you really shouldn't. With modern hardware that kind of low-level messing with your data will kill performance. Try to find the article: A New Technique for Rendering Complex Portals. It describes a better method using the stencil buffer and render-to-texture.

Sorry if this is way of mark for your problem, your OP was unclear.

Share this post


Link to post
Share on other sites
yes, i understand.

but I'm using adobe director so i don't have these fancy stuff.

I'm posting 2 example links of my engine, one with the frustum portal clipping:
http://alturl.com/hur3

and one without the clipping:
http://alturl.com/cof9

you can move with direction keys and "a", "d" for walking left and right.

can someone tell me how to do the uv clipping right in the old fashion way?

10x

Share this post


Link to post
Share on other sites
OK, i solved the problem!

I find out that when I'm using objects with quad faces or more,
the texture is bending after the frustum clipping.
But when I'm using models with triangles only,
the texture looks fine after the clipping.

Thanks anyway,
Guy

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this