POV-Ray : Newsgroups : povray.programming : Anyone up to testing? : Anyone up to testing? Server Time
29 Jul 2024 00:37:49 EDT (-0400)
  Anyone up to testing?  
From: Mike
Date: 24 Jan 1999 04:53:23
Message: <36AAECD3.B789830A@aol.com>
The problem with radiosity getting messed up on interrupted renders was
ticking me off, so I decided to try to fix it.  The problem doesn't
occur as often in version 3.1 it seemed, but after some testing I found
it was still there.  So I came up with a fix that let's you control
whether or not the radiosity cache file is to be written, when or if
it'll be used, or to skip it altogether.  This is probably something
that was meant to be written anyway...must have got lost in the shuffle.

There's just a few things to add, and if you cut and paste it should
only take a few minutes. I try to leave the beginning and end parts that
were there originally so you can use find to locate the spot.

Add to parse.c (global_settings section)

CASE (RECURSION_LIMIT_TOKEN)
           if (( opts.Radiosity_Recursion_Limit = (int)Parse_Float()) <=
0)
           {
              Error("Radiosity recursion limit must be a positive
number.");
           }
         END_CASE


         //added keywords for radiosity cache file control

		 CASE (FILE_READONCONTINUE_TOKEN)
		   opts.Radiosity_File_ReadOnContinue = (int)Parse_Float();
		   if (( opts.Radiosity_File_ReadOnContinue != 0) &
			   ( opts.Radiosity_File_ReadOnContinue != 1))
		   {
			   Error("Radiosity file readoncontinue must be 0 or 1");
		   }
		 END_CASE


		 CASE (FILE_ALWAYSREADATSTART_TOKEN)
		   opts.Radiosity_File_AlwaysReadAtStart = (int)Parse_Float();
		   if (( opts.Radiosity_File_AlwaysReadAtStart != 0) &
			   ( opts.Radiosity_File_AlwaysReadAtStart != 1))
		   {
			   Error("Radiosity file alwaysreadatstart must be 0 or 1");
		   }
		 END_CASE
			   
		CASE (FILE_SAVEWHILERENDERING_TOKEN)
		   opts.Radiosity_File_SaveWhileRendering = (int)Parse_Float();
		   if (( opts.Radiosity_File_SaveWhileRendering != 0) &
			   ( opts.Radiosity_File_SaveWhileRendering != 1))
		   {
			   Error("Radiosity file savewhenrendering must be 0 or 1");
		   }
		 END_CASE	
			 
         CASE (FILE_KEEPONABORT_TOKEN)
		   opts.Radiosity_File_KeepOnAbort = (int)Parse_Float();
		   if (( opts.Radiosity_File_KeepOnAbort != 0) &
			   ( opts.Radiosity_File_KeepOnAbort != 1))
		   {
			   Error("Radiosity file keeponabort must be 0 or 1");
		   }
		 END_CASE	   
			   
		CASE (FILE_KEEPALWAYS_TOKEN)
		   opts.Radiosity_File_KeepAlways = (int)Parse_Float();
		   if (( opts.Radiosity_File_KeepAlways != 0) &
			   ( opts.Radiosity_File_KeepAlways != 1))
		   {
			   Error("Radiosity file keepalways must be 0 or 1");
		   }
		 END_CASE	   	   
			   
         //that is all

to parse.h add these 5 keywords.  I'm open to better ideas. ;)

RECURSION_LIMIT_TOKEN,
  FILE_READONCONTINUE_TOKEN, //radiosity fix
  FILE_SAVEWHILERENDERING_TOKEN, //radiosity fix
  FILE_ALWAYSREADATSTART_TOKEN, //radiosity fix
  FILE_KEEPONABORT_TOKEN, //radiosity fix
  FILE_KEEPALWAYS_TOKEN, //radiosity fix
  HF_GRAY_16_TOKEN,

Add this crap to tokenize.c

{FCLOSE_TOKEN, "fclose"},
  {FILE_READONCONTINUE_TOKEN, "file_readoncontinue"},  //radiosity fix
  {FILE_SAVEWHILERENDERING_TOKEN, "file_savewhilerendering"},
//radiosity fix
  {FILE_ALWAYSREADATSTART_TOKEN, "file_alwaysreadatstart"}, //radiosity
fix
  {FILE_KEEPONABORT_TOKEN, "file_keeponabort"}, //radiosity fix
  {FILE_KEEPALWAYS_TOKEN, "file_keepalways"},  //radiosity fix
  {FILE_EXISTS_TOKEN, "file_exists"},

Just change these values in povray.c (init_vars() )
so that it default to using no cache file, which is how it should be IMO

opts.Radiosity_Quality = 6;     /* Q-flag value for light gathering */
  opts.Radiosity_File_ReadOnContinue = 0;  //changed from 1
  opts.Radiosity_File_SaveWhileRendering = 0;  //changed from 1
  opts.Radiosity_File_AlwaysReadAtStart = 0;
  opts.Radiosity_File_KeepOnAbort = 0;  //changed from 1
  opts.Radiosity_File_KeepAlways = 0;


  init_statistics(stats);
  init_statistics(totalstats);

And that's it!  Now try some renders, interrupt them, change between
scene files, and see if you have any problems.  If not, then you can
have some fun with the cache file.

To turn on all options, just add this to radiosity in global_settings.
I recommend you use_cutandpaste :)

//0 = off, 1 = on

file_savewhilerendering 1
file_readoncontinue 1
file_alwaysreadatstart 1
file_keeponabort 1
file_keepalways 1

What's fun with these setting is to render a file all the way through,
then move one and render the scene again.  If the cache file worked,
you'll get the object in a different place but the lighting will be the
same!

-Mike


Post a reply to this message

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