POV-Ray : Newsgroups : povray.general : Help in optimizing a scene : Help in optimizing a scene Server Time
30 Jul 2024 00:19:50 EDT (-0400)
  Help in optimizing a scene  
From: ruy
Date: 14 Apr 2010 14:10:01
Message: <web.4bc6040077295221ad2eb90@news.povray.org>
Hello again,

If this is too much to ask, or if there is a tutorial that may help me figure
things out by myself, please just give the word, OK?

I could use some help with optimization. The way the scene listed below is coded
at the moment  makes it all but impossible to render with the resources I have
at hand.

Of course I had to use a lot of things that are time-consuming, like radiosity
and glass, but I sense that there is some room for improvement. If someone could
help I would be very grateful.


orange areas). I believe this is due to the very high density of blob points in
this region, but I am not sure. I tried to mitigate this problem by reducing the
points in the lower 1/7th of the spiral, and it seems to have helped to some
extent.

Still, a 320x240 render is taking over 8 hours in a Core2Duo with 4GB of RAM
(Windows 7, with little else running in parallel).

Any tips on how to optimize this scene?

Thanks in advance,

Ruy

/*************************************************************************/
/*                                                                       */

/*                                                                       */
/*  All Rights Reserved                                                  */
/*                                                                       */

/*                                                                       */
/*************************************************************************/

#include "colors.inc"
#include "functions.inc"

// My own macro fro changing HSV into RGB
// Differs from the one in colors.inc because it allows for a transmission
// of 0.5 (makes it "glassy"),which unfortunately makes it also extremely
// slow to render.
#macro R_CHSV2RGB(Color)
   #local HSVFT = color Color;
   #local H = (HSVFT.red);
   #local S = (HSVFT.green);
   #local V = (HSVFT.blue);
   #local SatRGB = CH2RGB(H);
   #local RGB = ( ((1-S)*<1,1,1> + S*SatRGB) * V );
   <RGB.red,RGB.green,RGB.blue,(HSVFT.filter),0.5>// (HSVFT.transmit)>
#end

// I'm not sure these focal blur settings are affecting the render time too
// negatively. It doesn't seem so, and quality seems to be OK.
camera{
 location < 0, 150, -1000 >
 look_at < 0, 0, 0.000 >
 angle 1.000

 focal_point < 0, 20, 0.000 >
 aperture 10
 blur_samples 50
}

// Single frontal light source, placed in order to create a nice light trail
// on the water surface.
light_source{<100, 50, 3000> rgb 1}


// Radiosity settings is something I haven't mastered yet. The effect seems
// to be OK, and comparing their rendering process with the rendering of the
// glassy blob seems to indicate that my problems lie elsewhere.
global_settings{
  adc_bailout 0.0039
  ambient_light rgb <255/255,255/255,255/255>
  assumed_gamma 2.200
  hf_gray_16 0
  irid_wavelength rgb <68/255,46/255,36/255>
  max_intersections 64
  max_trace_level 10
  number_of_waves 1

  radiosity {
    pretrace_start 0.08
    pretrace_end   0.005
    count 400
    error_bound 0.5
    recursion_limit 1
    low_error_factor .15
    gray_threshold 0.0
    minimum_reuse 0.015
    brightness 1
    adc_bailout 0.01/2
  }
}

// A simple sky sphere. light blue hue is used mostly for the effect on the
// water surface.
sphere {
  <0, 0, 0>, 1
  texture {
    pigment {
      gradient y
      color_map {
        [0.0 color rgb < 0.90, 01.0, 1.0 >]
        [0.0 color rgb < 0.90, 01.0, 1.0 >]
      }
    }
    finish { diffuse 0 ambient 1 }
  }
  hollow on
  no_shadow
  scale 30000
}


// The water, with a material taken from the tutorial by Christoph Hormann.
// I do like it, but it seems to be inverted, that is: instead of crests I
// see grooves. I could be wrong.
plane { y, -1.0
  material {
    texture {
      pigment {
        color rgbt <.1, .1, .1, .1>
      }
      finish {
        ambient 0.0
        diffuse 0.0

        reflection {
          0.0, 1.0
          fresnel on
        }

        specular 0.8
        roughness 0.001
      }
      normal {
        function {
          f_ridged_mf(x, y, z, 0.1, 3.0, 7, 0.7, 0.7, 2)
        } 0.8
        scale 3
      }
    }
    interior {
      ior 1.3
    }
  }
}

// The ascending spiral, the main object in the scene. I believe my problem
// lies in the fact that the initial points are too condensed together in
// the base of the spiral, and hence the use of only every fifth point in
// the bottom 1/7 of the spiral.
blob {
    threshold .0005

    #declare Cr = 0;
    #declare Mx = 2430;
    #declare Me = Mx/2;
    #declare Rd = 0.1;
    #declare Ap = 1;
    #declare As = 1;
    #declare Vl = 1;
    #while (Cr <= Mx)
      #if (Cr<(Mx/7))
        #if (mod (Cr,5) = 0)
               sphere { <0,0,0>, 1.3 ,1
                 translate <Cr*Ap*Rd*Rd, Cr*Vl*Rd*Rd*1.3, Cr*As*Rd*Rd>
                 rotate y*Cr*Vl
                 texture {
                         pigment{rgbft R_CHSV2RGB(<(Cr/Mx)*300, 1.0, 1.0>)
                         }
                         finish {
                                ambient 0.4
                                diffuse 0.1
                                reflection .25
                                specular 1
                                roughness .001
                          }
                 }
               }
        #end
      #else
               sphere { <0,0,0>, 1.3 ,1
                 translate <Cr*Ap*Rd*Rd, Cr*Vl*Rd*Rd*1.3, Cr*As*Rd*Rd>
                 rotate y*Cr*Vl
                 texture {
                         pigment{rgbft R_CHSV2RGB(<(Cr/Mx)*300, 1.0, 1.0>)
                         }
                         finish {
                                ambient 0.4
                                diffuse 0.1
                                reflection .25
                                specular 1
                                roughness .001
                          }
                 }
               }
      #end
      #declare Cr = Cr + 1;
    #end
    no_shadow
    interior { ior 1.2 }
  }


Post a reply to this message

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