POV-Ray : Newsgroups : povray.programming : objects order : objects order Server Time
28 Jul 2024 10:17:26 EDT (-0400)
  objects order  
From: Rafal 'Raf256' Maj
Date: 24 Jun 2002 16:00:43
Message: <Xns9237DF67CDE4Fraf256com@204.213.191.226>
Ther is a problem with objects sharing same space, like 
cone { y*0 1 y*1 1 }
cone { y*1 1 y*2 1 }

some pixels at y=1 will at same time be a part of cone #1 and #2. If cones 
were partial transparent, this will lead to errors on rendered images.

Imho there is an easy work around :)

* Idea : 
Use additional property to select one object as more important, in 
ambignous situations, like i.e. <0,1,0> in example above, this ID will 
decide to with object <0,1,0> belongs.   
* Example :
cone { y*0 1 y*1 1 objId 1 } // #1
cone { y*1 1 y*2 1 objId 2 } // #2
cone #2 has higher parametr objId, so it has higher priotity, so <0,1,0> 
will be consider as belonging to #2
* Algorithm :
there is probably some code looking like :

j=0; // background color
while (1) { 
  if ray[i].has_intercesion_with_object(j) break;
  j++;
}
return j;

it should be changed to :

j=0; // background color
int priorJ=j;
int highestId=0;
while (1) { 
  if ray[i].has_intercesion_with_object(j) {
    int id = object[j].objId;
    if (id>highestId) { // object 'j' has higher objId, so :
      priorJ=j; // object 'j' is currently most sutable to be consider
    	    	    	// as intercesion with ray
      highestId=id; // this is current highest id
    }
    if (id==9999) break; // objId 9999 is used to say "do NOT check other
    // "objects" 9999 is the highest possible objId
  }
  j++;
}
return j;



I have alsow some algorihms that will greatly improve speed of rendering 
when objId future is used. I can give full C code for that :) Will someone 
help me and translate this pseudo-codes for proper code to link-in to Pov-
Ray core ?


-- 


Post a reply to this message

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