  | 
    
 
  
    
    
      
        
          
         Author | 
        
         Topic: drawing order and alpha  (Read 525 times) | 
       
     
     | 
   
 
  
    
    
      
        
        
          
            
            aileron 
 
     
      
             | 
            
            
            
              
                
                drawing order and alpha 
                «  on: Feb 13th, 2004, 9:21am » | 
                
                
 
                 | 
               
             
             
            
            Noticed that alpha transperancy of an object only wants to work correctly on objects drawn before it.       Code:   int camX = 300;   int camY = 200;   int camZ = 0;   int camrotX = 0;   int camrotY = 0;   int camrotZ = 0;      int rotate1 = 0;      void setup() {     size(600, 400);     rectMode(CENTER_DIAMETER);   }      void loop() {     background(100);     stroke(200);          if(keyPressed){       if(key == UP)         camrotX+=2;       if(key == DOWN)         camrotX-=2;       if(key == RIGHT)         camrotY-=2;       if(key == LEFT)         camrotY+=2;     }          translate(camX, camY, camZ);     rotateX(camrotX*(PI/180));     rotateY(camrotY*(PI/180));     rotateZ(camrotZ*(PI/180));          rotate1++;     if(rotate1 > 359)       rotate1 = 0;          fill(100,105,60, 150);     box(0,0,0, rotate1,rotate1,rotate1, 50);     fill(100,60,60, 150);     box(100,0,0, 0,0,0, 50);     box(-100,0,0, 0,0,0, 50);   }      void box(int x, int y, int z, int rotX, int rotY, int rotZ, int size){     push();       translate(x,y,z);       rotateX(rotX*(PI/180));       rotateY(rotY*(PI/180));       rotateZ(rotZ*(PI/180));       box(size);     pop();   }        |  
  |         And it seems to me that a 3d object should alpha its own rear edges, does it not do that on purpose? 
            
             | 
           
            
            
            
              
                | « Last Edit: Feb 13th, 2004, 9:24am by aileron » | 
                  | 
               
             
            
             | 
           
         
         | 
       
     
     | 
   
 
  
    
    
      
        
        
          
            
            fry 
 
 
        
      
             | 
            
            
            
              
                
                Re: drawing order and alpha 
                « Reply #1 on: Feb 13th, 2004, 7:23pm » | 
                
                
 
                 | 
               
             
             
            
            yeah, that's an artifact of most 3D renderers (opengl has the same problem). we may switch to actually sorting all the polygons back to front first, but that would only be if/when we move to the new graphics engine.      (edit) actually, we'll prolly just offer it as an option. it's a speed hit to enable it, but i know that it's often worth it. 
            
             | 
           
            
            
            
              
                | « Last Edit: Feb 13th, 2004, 7:25pm by fry » | 
                  | 
               
             
            
             | 
           
         
         | 
       
     
     | 
   
 
 
 |