|
|
>> Yep! Easy, almost trivial, to do with mesh based geometry, but nearly
>> impossible to do with mathematically based geometry.
>
> Does povray knows for each pixel on the rendered image to which surface it
> corresponds and what is the normal at this point ? I suppose yes. If so, this is
> maybe possible to do something on the rendered image...
No, it's not possible. Yes POV knows which surface/shape it has hit, but
it knows nothing about any other surfaces in the scene. The way the CSG
works in a raytracer, any surface is not known about (or
calculated/stored anywhere) until a ray actually hits it.
POV and CAD may seem to work the same way (you give both a list of
mathematical definitions of shapes and how to combine them) - but
internally they work very differently.
As an example, think of a simple union between a box and a sphere. Think
of all the possible different shapes you might end up with depending on
the relative position of the two, the relative sizes/scaling (which
could be non-uniform) and any rotations involved.
POV doesn't have to worry at all about all these options, or even do any
calculations about it. It simply goes along, pixel by pixel, and figures
out if the ray through that pixel hits the sphere or the box, and if it
hits both, which is closer to the camera. It doesn't care, or know, what
the overall shape looks like, it has no concept of how many surfaces or
edges are involved, it doesn't matter.
CAD works by calculating an exact representation of the geometry first.
It will calculate exactly where all the intersection lines are between
the two solids, defining all the new surfaces as bounded planes or
bounded spherical sections (in this example). As you can imagine this is
a lot of geometrical calculations with many "special cases" to deal
with, and the result can be quite complex even for this simple example.
At the end though, it will have a list of surfaces and edges that make
up the final shape. To "render" it, it is relatively trivial to then
mesh this geometry representation (most CAD software gives you options
for how detailed to mesh the geometry for display purposes).
Post a reply to this message
|
|