Skip to main content
gamedev.net
🔒 Locked

D3DUTIL_IntersectTriangleCull

Started by NotTaxes 3 replies 900+ views
Original Post
NotTaxes
NotTaxes
I'm using this function to do landscape picking, but it's not returning what I expect it to on the u,v parameters (the t is perfect). I'm doing a quad-tree cull type of thing to speed up the landscape picking, and creating a large quad 80x80 units. This gets split into two tris, which I pass to the IntersectTriangleCull function. The IntersectTriangleCull function records a ray hit from the mouse on one or the other of the tris, and correcly returns the t (height) of the intersection, but the u and v coordinates are coming back with figures like 0.5 and 0.000003, instead of the expected values (e.g. 10,10). If anyone can help, it would be fantastic. btw, for interest's sake, I was doing this on a per triangle basis testing hits against the terrain, but it was seriously slow. Now I'm using a quad-tree type of thing so that I only have to check a handful of actual terrain triangles. The problem is that if the terrain is seriously jagged, the quad-tree culls in the wrong place... that is, if there is mountain in the center of a quad, the intersect is first trapped on the adjacent quad further away, and then it continues to refine the intersection on that quad, instead of the one with mountain. Any way around this? [edited by - Nottaxes on October 30, 2002 6:42:34 AM]
'Doing the impossible is kind of fun' - Walt Disney
NotTaxes
NotTaxes
Or perhaps put another way, is there a way that I can find out at which x,y,z coordinate a ray intersects a triangle?
'Doing the impossible is kind of fun' - Walt Disney
NotTaxes
NotTaxes
I''m pretty sure that there is an answer to this somewhere on Gamedev and I would normally track it, but with the search engine down... anyone have an idea?
'Doing the impossible is kind of fun' - Walt Disney
mishikel
mishikel
If you know the distance to the intersection, and you have the normalized direction of the picking vector, will fDistance * vDirectionVector = the 3D location you are looking for?
NotTaxes
NotTaxes
Too true. I am feeling soooo dumb right about now. Thanks for the reality check chap.
'Doing the impossible is kind of fun' - Walt Disney

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.