POV-Ray : Newsgroups : povray.programming : patch: smooth_color_triangle : Re: patch: smooth_color_triangle Server Time
28 Jul 2024 20:19:35 EDT (-0400)
  Re: patch: smooth_color_triangle  
From: Thomas Baier
Date: 29 Jul 1999 01:03:34
Message: <37a1df05.2542925@news.povray.org>
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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.