XNA's Ray-Sphere Intersection test returns true with a distance of zero if the Ray originates inside the sphere.
This is great for games. Very fast. Avoids all the lengthy distance calculations and just kicks out an indication of collision.
This is not good for ray-tracers. The transmitted ray specifically looks at what happens when a ray travels through a translucent object. The requires us to spawn a ray within a spherical boundary and find the intersection on the other side.
I've tried writing a new sphere intersection test. There are a couple that I've found that I really like, and are very slick. The problem? C#'s floating point numbers aren't accurate enough to support them. Whatever XNA's BoundingSphere is doing, it's accurate enough for these calculations, whereas I can't figure out how to make mine accurate enough.
So I'm going to try to fake it. I'm going to use the XNA sphere test for external intersections, and my own for internal calculations. Once I know that I'm inside from the other one, hopefully I'll be accurate enough on my own.
Using XNA's vector class may have been a mistake here. Probably should've rolled our own using double precision numbers.
Showing posts with label xna. Show all posts
Showing posts with label xna. Show all posts
Friday, May 2, 2008
Sunday, April 13, 2008
Visual Studio is Microsoft's greatest product
I just used the refactoring tools for the first time in VS2005Pro. It was a minor change: I wanted to change the property
to
in my Artificial Intelligence project.
VS was able to make the change and then update ALL references. Took 30 seconds, despite the fact that the property was referenced in a couple dozen different places across about a half dozen different class files.
Things are starting to come together. The following image is a walk map, that is a map of areas that are legal to walk on in blue and illegal in white.
public ScreenManager ScreenManagerto
public ScreenManager Hostin my Artificial Intelligence project.
VS was able to make the change and then update ALL references. Took 30 seconds, despite the fact that the property was referenced in a couple dozen different places across about a half dozen different class files.
Things are starting to come together. The following image is a walk map, that is a map of areas that are legal to walk on in blue and illegal in white.
Friday, March 14, 2008
Water
I'm not technically sure it's alright to be posting non-IT409 related things here, but I'm going to brashly go ahead anyways.
I've been working terrain rendering in XNA for months now as a side project. I've gone from really bad implementations using patches and quadtrees to the most cutting edge techniques my hardware supports. (IE, Vertex Texture Fetch in Shader Model 3.0)
I'm trying to implement a water model to go with it, so in addition to cheaply textured mountains and valleys I can have poorly textured water. I just got the first 'visually interesting' iteration done. It is on it's way to a lot of improvements, but you test as you go.
The image shows the current progress. I'm unhappy with the transparency effect right now, the visibility should fall off the further you look through the water, and right now it doesn't depend on that at all. I know how to fix it, requiring a look up of the depth values, but I need to see if I can get that data directly, or if I need to render the depth values to a texture to get the information. I'll figure it out.
Subscribe to:
Posts (Atom)
