POV-Ray : Newsgroups : povray.general : POV-Ray in Challenge #21: The Bedroom : Re: POV-Ray in Challenge #21: The Bedroom Server Time
30 Jul 2024 02:25:37 EDT (-0400)
  Re: POV-Ray in Challenge #21: The Bedroom  
From: Christian Froeschlin
Date: 9 Dec 2009 19:30:21
Message: <4b20411d$1@news.povray.org>
Robert McGregor wrote:

> Hi all, I just saw over at Jeremy Birn's lighting challenges site (he's the
> lighting/rendering technical director for Pixar) that there's actually a POV-Ray
> scene included as part of this month's rendering challenge

if anyone is interested to play with this but doesn't want to
work with a single 76MB pov file (sort of impractical), I just
hacked a little perl script to extract the individual object
geometries and texture definitions to separate inc files:

split_geometry.pl:
------------------------------------------------------
open (POV, "$ARGV[0]") || die "can't open input file";

$object_name = "";
$triangles   = 0;

open (TEX, ">textures.inc") || die "unable to create textures.inc";

while (<POV>)
{
   if ($triangles)
   {
     if (/smooth/)
     {
       print INC $_;
     }
     else
     {
       if (/^texture/)
       {
         $texture_name = "T_$object_name";
         print "texture {$texture_name}";
         print TEX "#declare $texture_name = texture {lambert1}\n";
       }
       else
       {
         print $_;
       }
       $triangles = 0;
       close(INC);
     }
   }
   else
   {
     if (/Triangles for object '(.*)'/)
     {
       $object_name = $1;
     }

     if (/smooth_triangle/)
     {
       $inc_file = "inc/$object_name.inc";
       open (INC, ">$inc_file") || die "unable to create $inc_file";
       print '#include "' . $inc_file . '"' . "\n";
       print INC $_;
       $triangles = 1;
     }
     else
     {
       unless (/object \{/ || /End of triangles/)
       {
         print $_;
       }
     }
   }
}
------------------------------------------------------

Usage: perl split_geometry.pl Bedroom.pov > Bedroom_split.pov
A subdirectory inc must already exist in the current directory.
You will need to #include the new file textures.inc as well.

Note that the scene will render black initially as it comes
originally without any light source.


Post a reply to this message

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