Twilight POV
A custom modification of PovRay. Focused on allowing functional distortions of regular objects. By Jeff M. Thomas jeff@twilightfair.com (This site is hastily thrown together with no polish whatsoever. It may improve some day, but probably not, I do internet work for a living so doing it on my spare time is not a high priority :-) I love isosurfaces and their ability to add real programmatic distortions to the surface of an object, it creates effects I find much more satisfying than surface normals and some things you simple can't do any other way. But isosurfaces have some drawbacks, most notably that you can only create objects that can be defined mathematically. Try to mathematically define an end table, or a statue of a horse. Not easy. I wanted to be able to surface distort all types of POV-Ray objects like CSGs and Mesh2s. So I downloaded the POV-Ray 3.5 source code to see what I could do. After looking at the code for a bit I decided the best approach would be to 'convert' the objects into isosurfaces and surface distort them in the usual way rather than try to modify each type of object. To do this I opted to create an object function, similar to the pigment function, that would take any object and make it appear to be a mathematically defined function. After one false start and lots of learning about POV I got it going. The above POV-Ray banner was rendered with this function. Here are some more sample images followed by a brief explanation of how it works, what problems it still has and what I hope to get done soon.
How this works is deceptively simple. Much simpler and more effective than my first stab at it in fact. Basically the function works by returning the distance of the given point from the nearest surface of the object. The distance is negative if the point is inside the object. Naturally the tricky part is finding the nearest surface. Because the only sure way of finding a surface of any given object in POV-Ray is to intersect it with a Ray, the object function shoots out a number of rays from the point in question in a spherical pattern. If it fails to hit anything it increases the number of rays and tries again. This works quite well but as you might imagine it's quite slow. The average time to render one of the sample images above was over 2-3 hours (on a 800mhz PIII), the banner at the top took over 7 hours. Right now I'm working on an optimization scheme. If anyone has any ideas please e-mail me at the address below. It also isn't working with hollow objects (such as Mesh2s) which, predictably, always return false to Inside_Object calls. I have a solution to this but I haven't put it in code yet. If anyone is interested in obtaining the code, or a winpov binary, let me know. I'm not ready to release it or do an 'official un-official' build of the executable at this time, and I probably wont be until I've got some optimization work done, but if enough people are interested I'll put it on the to-do list. Send them all to: jeff@twilightfair.com (I can't promise I will reply to all senders, but I will read it) |