|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Suggesting a patch for "smooth_color_triangle"
In my efforts to generate POV-ray output from an OpenGL program, I have
come across the problem of specifying normals AND colors for each
triangle vertex. Since this cannot be done directly with POV-ray (3.1g),
I first used a macro provided by Chris Colefax
(http://www.geocities.com/SiliconValley/Lakes/1434/), but my scenes are
easily above 50'000 triangles and the memory requirements were just too
much with this macro.
SO, I have written a patch which implements a new object type into a
triangle mesh (and _only_ in the mesh). You can find it at
http://www.bioz.unibas.ch/~xray/dino/pov
First thing I did was to add color to the mesh_triangle, similar as
vertex and normal are already implemented. Then I modified the
parse_mesh routine. A flag is set for each triangle that uses the color
information. Pretty straightforward up to now.
Next, I realized (maybe falsly) that in POV-ray the texture handling is
independent of the object coordinates and only depends on the
intersection coordinates (correct ?). Anyway, I inserted sort of a
catch-point into "Determine_Apparent_Colour" (found in lighting.c)
-> documented in detail on the webpage.
I basically check wether the intersected object is a mesh, the triangle
in the mesh has the smooth-color flag set and then interpolate the color
from the intersection point IPoint, the three triangle vertices and the
respective colors. This interpolated color is then forced as the
texture->pigment->color, while texture->pigment->type is set to
PLAIN_PATTERN
Possible problems:
a) what happens if there are multiple layers, which layer should
actually be forced to the interpolated color ?
b) when using predefined textures this obviously goes bad. Saving the
texture->pigment and restoring could work
All tests I have done so far indicate that it runs stable, does not
impact normal POV-ray functionality and allows to render large scenes
with smooth_color_triangles. These tests were not exhaustive!
I did briefly check wether such a functionality is under production, but
I did not find anything.
Any comments on this patch are of course appreciated, I am especially
curious if such a patch could be incorporated into the next 'official'
POV-ray release.
Ansgar
---
aphilipp at bioz dot unibas dot ch
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Wed, 28 Jul 1999 19:04:29 +0200, Ansgar Philippsen wrote:
>Any comments on this patch are of course appreciated, I am especially
>curious if such a patch could be incorporated into the next 'official'
>POV-ray release.
My only concerns with it as a viable patch are the ones you mentioned
in the "Problems" section in your original post. I wonder if you could
modify the patch to put the interpolated color "under" any other textures
that might be applied to that triangle, as an additional layer that acts
like a substrate.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi,
your approach is not bad :-))
Would it be possible to generalize it?
Both "Superpatch" and "UV Patch" implement the new object "mesh2"
which defines a more efficient handling of triangle meshes.
Additional it allows texurizing individual faces or groups of faces.
It would be nice to have a switchable, general interpolation/blending
of face materials. Possible ?
-tb
>Suggesting a patch for "smooth_color_triangle"
>
>In my efforts to generate POV-ray output from an OpenGL program, I have
>come across the problem of specifying normals AND colors for each
>triangle vertex. Since this cannot be done directly with POV-ray (3.1g),
>I first used a macro provided by Chris Colefax
>(http://www.geocities.com/SiliconValley/Lakes/1434/), but my scenes are
>easily above 50'000 triangles and the memory requirements were just too
>much with this macro.
>
>SO, I have written a patch which implements a new object type into a
>triangle mesh (and _only_ in the mesh). You can find it at
>
>http://www.bioz.unibas.ch/~xray/dino/pov
>
>First thing I did was to add color to the mesh_triangle, similar as
>vertex and normal are already implemented. Then I modified the
>parse_mesh routine. A flag is set for each triangle that uses the color
>information. Pretty straightforward up to now.
>
>Next, I realized (maybe falsly) that in POV-ray the texture handling is
>independent of the object coordinates and only depends on the
>intersection coordinates (correct ?). Anyway, I inserted sort of a
>catch-point into "Determine_Apparent_Colour" (found in lighting.c)
>-> documented in detail on the webpage.
>I basically check wether the intersected object is a mesh, the triangle
>in the mesh has the smooth-color flag set and then interpolate the color
>from the intersection point IPoint, the three triangle vertices and the
>respective colors. This interpolated color is then forced as the
>texture->pigment->color, while texture->pigment->type is set to
>PLAIN_PATTERN
>
>Possible problems:
>
> a) what happens if there are multiple layers, which layer should
>actually be forced to the interpolated color ?
>
> b) when using predefined textures this obviously goes bad. Saving the
>texture->pigment and restoring could work
>
>All tests I have done so far indicate that it runs stable, does not
>impact normal POV-ray functionality and allows to render large scenes
>with smooth_color_triangles. These tests were not exhaustive!
>
>I did briefly check wether such a functionality is under production, but
>I did not find anything.
>
>Any comments on this patch are of course appreciated, I am especially
>curious if such a patch could be incorporated into the next 'official'
>POV-ray release.
>
>Ansgar
>
>---
>
>aphilipp at bioz dot unibas dot ch
>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Thomas Baier wrote:
> Would it be possible to generalize it?
> Both "Superpatch" and "UV Patch" implement the new object "mesh2"
> which defines a more efficient handling of triangle meshes.
> Additional it allows texurizing individual faces or groups of faces.
> It would be nice to have a switchable, general interpolation/blending
> of face materials. Possible ?
To be honest, I do not know. I need to look at the structure of the mesh2
implementation. It would be nice if SuperPatch and UVPatch could somehow be
merged. The UV Patch I have found, still looking for the SuperPatch download
:)
I will look into this and post results...
Ansgar
aphilipp at bioz dot unibas dot ch
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> I wonder if you could
> modify the patch to put the interpolated color "under" any other textures
> that might be applied to that triangle, as an additional layer that acts
> like a substrate.
This is a very good idea, and I had originally intended to do so. This would
allow to blend the given pattern with the color-interpolation for some pretty
cool effects (I think).
Only I do not understand the POV-ray structure enough to do this. The 'upper'
layers would require some sort of transparent setting to allow the
interpolated color to shine through. I am unclear on this.
Additionally, as mentioned by T.B., it would be good to incorporate this into
the Super/UV patch, and therefore I need to dig into the mesh2 structure.
<SIGH> so much to do and so little time :)
BTW, which is the 'appropriate' place to announce/suggest patches. In
p.programming or p.unofficial-patches ?
Ansgar
aphilipp at bioz dot unibas dot ch
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Ansgar Philippsen wrote:
> The UV Patch I have found, still looking for the SuperPatch download
http://www2.fwi.com/~parkerr/superpatch/
--
Ken Tyler
mailto://tylereng@pacbell.net
http://home.pacbell.net/tylereng/links.htm
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> > The UV Patch I have found, still looking for the SuperPatch download
>
> http://www2.fwi.com/~parkerr/superpatch/
>
I wish all essential newsgroup answers would be available within 10min :)
1e6 TNX
Ansgar
aphilipp at bioz dot unibas dot ch
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Ansgar Philippsen wrote:
>
> Additionally, as mentioned by T.B., it would be good to incorporate this into
> the Super/UV patch, and therefore I need to dig into the mesh2 structure.
> <SIGH> so much to do and so little time :)
>
Actually, it shouldn't take too much time. mesh2 is simply a different
parser for the mesh object. Internally it is the same object.
-Nathan
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |