Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Calculating UV / Vertexes at point of intersection with INTERSECT OBJECT

Author
Message
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 14th Oct 2003 22:51
Does anyone know how to calculate which verticies make up the polygon which INTERSECT OBJECT intersects?

I am trying to translate some dynamic shadow code from Blitz to DB, but I can't see a way of lining up the shadow correctly without this functionality

Blitz code attached.

haggisman
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 15th Oct 2003 00:14
You might as well make your own intersection routine using memblocks to access the vertice information.

Defying the convention of an upright avatar since 1985
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 15th Oct 2003 01:33
I suppose, I just wondered if there was some neat way of working out which verticies were which rather than having to write custom ray-line routines.

Kevin Picone
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 15th Oct 2003 02:44
erm, you don't need to write your own intersections code. All you need is the UV cords of the face and their 3D space positions. It's pretty trivial really. Just a bit clumsy at the moment.

Anyway, Here's quick and nasty concept.

For starters yuo need to step in 'texture space". so If you can draw a triangle between the UV coords you calc the 3d wordl coords positions easily. Think about it.. It's just linear interpolation. Once you have a position in 3D space, you'd just use the intersect obejct to detect intersections between the light sources origin and this point. If the ray hit something, the point is shadowed.

Kevin Picone
Play Basic - Visible Worlds - Kyruss II
[url]www.underwaredesign.com[/url]
haggisman
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 15th Oct 2003 18:05
Why not just use a simple and fast ray-triangle intersection test like http://www.graphics.cornell.edu/pubs/1997/MT97.pdf which doesn't even need normals to be stored, only the vertex positions.

Defying the convention of an upright avatar since 1985

Login to post a reply

Server time is: 2026-07-26 04:27:19
Your offset time is: 2026-07-26 04:27:19