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


DirectX with Spheres

Recommended Posts

Two ideas...

1. Under normal circumstances, render everything with your nice detailed texture, but if the user clicks, turn off lighting, etc. and render your scene to a texture render target using a texture that has simple colored regions for your countries. If you set up your viewport, matrices, and target correctly, you can actually render only the click point and reading that small texture can be very fast. The color at that point is the country. Turn on lighting, etc. set the target back to the back buffer, and keep rendering.

2. The first way uses the card to do alot of processing for you. The other way is to find which polygon on your sphere you clicked on using the approach from the picking sample in the SDK. Once you have the triangles, you have the texture coordinates. Find the actual intersection point within the triangle, interpolate the texture coordinates for that point, and use that as a look up into a table of countries. That table is probably a bitmap that looks alot like your world texture but lacking detail like bumps, etc.

Both of these let you easily support accurate picks, even on the very edges of countries with rough borders. Assuming your sphere has a fairly low poly count, both should be fast.

Share this post

Link to post
Share on other sites