chris wrote:I read the thread on the ray tracing forum, and it looks like you've been doing some nice work.
Thanks. I think you have been doing great work with Celestia.
chris wrote:I don't think that there's too much use for a ray tracer as an alternate renderer, however. It would be a great deal of effort to make sure that all features worked with both the ray tracer and the OpenGL renderer. The frame rates with software ray tracing are still quite low even with a high end CPU.
I should have named this thread "CPU Celestia renderer?", for I'm not offering what is considered by an ordinary ray tracer. I understand the skepticism, however I wouldn't be quite so fast to dismiss the possibility. As for speed, I know it is fast enough now let alone in couple of years.
Would two different renderers need to support all the same features? Even if a render could initially just handle solar system level visualization, it would be pretty novel feature IF it enabled people with a modern dual core computers and weak graphics cards to get unprecedented visual quality. The strength of doing software graphics with a language like C++ is the relative ease and power of implementation.
chris wrote:And there are a few things that Celestia must draw which would be very difficult for a pure ray tracer. For example, it seems very difficult to ray trace a star field; traditional rasterization works much better for this.
I completely agree that there is no point in raytracing for example a distant star field. Actually I am using so far a combination of rasterization, raytracing and analytical shading to get best of all worlds. I use ray tracing for drawing perfect anti-aliased mathematical primitives like spheres and discs. That is accelerated by projecting the scene first on a buffer, which says what pixel to intersect with what primitives, which makes it fast. For shading not a single light or shadow ray is cast, it is handled with custom algorithms.
chris wrote:A limited form of ray tracing may be useful for calculating more accurate eclipse shadows (I notice you've done quite a bit of work with sphere-sphere shadowing.)
Yes, the sphere light blocked by sphere shadow support is I think most complete feature I have. It doesn't use or rely on any ray tracing though and I think the algorithm could be used with Celestia's GPU renderer. You need to however know where you are on a surface of object you are shading per pixel.
It works by first checking per object exactly, what spheres occlude other spheres. This scales to several thousands of spheres checked once per frame, so you can just feed all your planets in a solar system to it. Based on that it does per pixel analysis, that is very physically accurate: It's like looking at the sun and moon from a point on earth, making a 2d picture of what you see with sun and moon as circles and then deducing from those circles' position and overlap the amount of sun's area visible to your location behind the moon. Quite simple really and just a couple of lines of dot products and vector operations coupled with the final circle comparisons.
Other things Celestia might have use for is approximate algorithm for Lambertian diffuse lightness from a spherical light source. I assume the current algorithm assumes point light and does a simple dot product?
chris wrote:But enough with the negative stuff . . . I do think that ray tracing can be useful in Celestia. It's already used to some degree--atmospheric effects are calculated with simple ray marching. Cloud shadows could be computed with a ray-sphere intersection test. A limited form of ray tracing may be useful for calculating more accurate eclipse shadows (I notice you've done quite a bit of work with sphere-sphere shadowing.) It might also be possible to use ray marching to improve the rendering of galaxies. In all of these cases, the ray calculations would be handled in shaders on the GPU. This is the appropriate place for ray tracing in Celestia. Would you be interested in pursuing any of these projects?
I will be of help to you, if you want to add the above mentioned shadows in Celestia GPU renderer and perhaps I can offer other algorithms and ideas too, but that is all I can do to improve Celestia currently. Even the renderer I'm talking about will need more features before it would justify the work needed to add support for such a thing.