POV-Ray : Newsgroups : povray.programming : Anyone up to testing? Server Time
29 Jul 2024 02:21:51 EDT (-0400)
  Anyone up to testing? (Message 1 to 3 of 3)  
From: Mike
Subject: Anyone up to testing?
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

From: Ben Birdsey
Subject: Re: Anyone up to testing?
Date: 24 Jan 1999 14:38:48
Message: <36AB77F7.FDC98F82@unlgrad1.unl.edu>
It looks like you've gone a long way toward curing the problem with radiosity
for *continued* renders.  However, my problem is that if the scene looks like
junk I want to be able stop right in the middle and tweak it and then re-render
it. But interrupting the trace almost always crashes Radiosity.

	As far as I can tell, the real problem with interrupted renders is that the
global variable radiosity_trace_depth is not re-initialized every time an image
is rendered.  From my investigations, it looks like the global
radiosity_trace_depth is only initialized when POV loads.  So, if you interrupt
a render when radiosity_trace_depth = 2 and you render a *new* image, the
renderer will *begin* with radiosity_trace_depth = 2.

	A simple fix might be to move the radiosity_trace_depth initialization to the
code which initializes radiosity ( in Radiosity.c ) and to set
radiosity_trace_depth = 0 if not continue_trace.

	In Him,
	Ben


Post a reply to this message

From: Mike
Subject: Re: Anyone up to testing?
Date: 25 Jan 1999 03:48:22
Message: <36AC2F16.33EAC67C@aol.com>
You're right.  I had done a few more tests and what I had changed hadn't
fixed the problem. Changing Radiosity_Trace_Depth to 2 causes the
problem all the time.  If it is being set to two by an interrupted
render, it must only happen when the render is interrupted at a specific
portion of the radiosity code, which would explain why the problem is
intermittent and unpredictable.

In radiosit.c in Deinitialize_Radiosity_Code(), add this at the end:

if (Radiosity_Trace_Level !=1)
  {
	  Radiosity_Trace_Level = 1;
  }

This should ensure that if the render is interrupted that this variable
gets reset to 1.

Let me know if it works.

-Mike

Ben Birdsey wrote:
> 
>         It looks like you've gone a long way toward curing the problem with
radiosity
> for *continued* renders.  However, my problem is that if the scene looks like
> junk I want to be able stop right in the middle and tweak it and then re-render
> it. But interrupting the trace almost always crashes Radiosity.
> 
>         As far as I can tell, the real problem with interrupted renders is that the
> global variable radiosity_trace_depth is not re-initialized every time an image
> is rendered.  From my investigations, it looks like the global
> radiosity_trace_depth is only initialized when POV loads.  So, if you interrupt
> a render when radiosity_trace_depth = 2 and you render a *new* image, the
> renderer will *begin* with radiosity_trace_depth = 2.
> 
>         A simple fix might be to move the radiosity_trace_depth initialization to
the
> code which initializes radiosity ( in Radiosity.c ) and to set
> radiosity_trace_depth = 0 if not continue_trace.
> 
>         In Him,
>         Ben


Post a reply to this message

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