POV-Ray : Newsgroups : povray.beta-test : Code gets the processor too hot? : Code gets the processor too hot? Server Time
2 May 2024 11:23:46 EDT (-0400)
  Code gets the processor too hot?  
From: Ger
Date: 1 Apr 2013 18:38:45
Message: <515a0c75@news.povray.org>
Consider the following code;

// A first try at a "Simple eroder"

#version 3.7;
   global_settings {
		    ambient_light 0
		    adc_bailout 0.09 
		    max_trace_level 200 
		    noise_generator 3
		    assumed_gamma 1.0
		  }
		  
		  
#include "shapes.inc"


#declare WindDirection = -1;
#declare Particles = frame_number*50;
#declare ParticleRandom = seed(1); 
#declare ParticleSize = seed(1);



// A simple column object
#declare Object = union {
  cone {<0, 12, 0>, 6, <0, 50, 0>, 3}
  #for (CC, 0, 8)
    cylinder {<-6, 12, 0>, <-3, 50, 0>, 0.5 rotate y * CC * 45}
  #end
  torus {6, 1 translate y * 12}
  torus {7, 1 translate y * 11}
  torus {8, 1 translate y * 10}
  Round_Box_Union(<-10,-10,-10>, < 10, 10, 10>, 1)
  }

#declare Max = max_extent(Object);
#declare Min = min_extent(Object);

#macro Damage()
  #local Hit = false;
  #while (Hit = false)
//    #local ParticleOrigin = <0, 0, 0>;
    #local ParticleOriginX = -WindDirection * 1000;
    #local ParticleOriginY = Min.y + (Max.y - Min.y) * rand(ParticleRandom);
    #local ParticleOriginZ = Min.z + (Max.z - Min.z) * rand(ParticleRandom);
    #local ParticleOrigin = < ParticleOriginX, ParticleOriginY,  
ParticleOriginZ>;
    #local PointOfImpact = trace(Object, ParticleOrigin, <-1,0,0>);
    #if (vlength(PointOfImpact) > 0)
      #local Hit = true;
    #end
  #end
  sphere{PointOfImpact, (1 + rand(ParticleSize))/10}
#end

#macro Erode(ObjectToErode)
  #for (ParticleCount, 0, Particles, 1)
    #declare ObjectToErode =
      difference {
	object { ObjectToErode }
	Damage()
	}
  #end
  ObjectToErode
#end


#macro Erode1(ObjectToErode)
  #declare ObjectToErode =
    difference {
      object { ObjectToErode }
      #for (ParticleCount, 0, Particles, 1)
	Damage()
      #end
      }
  ObjectToErode
#end



object {Erode(Object) pigment {rgb 1}}


camera {
  location < 100,  60,  100>
  look_at <0,20, 0>
  direction z *   2.0
  right image_width / image_height * x
}

light_source {<  400, 1000, 500>*10, color 1.0 }
light_source {< -400, 1000, 500>*10, color 0.125 rotate y * 120 shadowless}
light_source {< -400, 1000, 500>*10, color 0.125 rotate y * -120 shadowless}

// End code

If I use the first Erode macro, the proc runs nicely with all cores at 100% 
and at normal work temp. When I otoh the Erode1 macro use, the parse times 
are obviously much shorter but the processor get way too hot when tracing 
the image.
-- 
Ger


Post a reply to this message

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