POV-Ray : Newsgroups : povray.advanced-users : error: Cannot layer over a patterned texture. : Re: error: Cannot layer over a patterned texture. Server Time
2 Nov 2024 09:17:38 EDT (-0400)
  Re: error: Cannot layer over a patterned texture.  
From: Ron Parker
Date: 24 Nov 1999 15:06:33
Message: <383c4549@news.povray.org>
On 23 Nov 1999 11:29:02 -0500, Nieminen Juha wrote:
>  When I was making my irtc animation entry, povray told me this:
>
>error: Cannot layer over a patterned texture.
>
>  Why not?

This appears to be due to a bit of weird design in the renderer.  When it
evaluates a texture, it first finds out which two textures it needs to 
interpolate between (assuming there is a texture map).  Then, it evaluates
each of those textures as a "plain" (i.e. nonlayered) texture.  Finally,
it interpolates the resulting color.

Unfortunately, the routine that evaluates a "plain" texture is also the
routine that handles reflection, refraction, and lighting calculations.
There might be a perfectly valid reason why this is, but I haven't given
it enough thought to say for sure.  

In any case, the upshot is that the texture-evaluation functions, including 
the one to handle texture maps, return three-component colors (having 
already computed the results of any filtering or transmission.)  Since the 
plain-texture evaluation routine needs a five-component color to do its job, 
it can't call the texture_map evaluation routine.  One could change the 
texture_map routine to return five-component colors, but then it would 
require the plain routine to return five-component colors, and you'd have to
move the reflection, transmission, and lighting code into a wrapper outside 
of those routines.  In addition to colors, you'd also have to pass back 
normals and finish info from both routines.

I'm guessing that whoever wrote texture_maps reasoned that all that was too 
much work for a feature (layering texture_maps) that people would probably 
use rarely, if at all, and besides, you're supposed to be able to work 
around it.

By the way, one side-effect of this is that POV seems to trace too many rays 
for some scenes.  The following scene traces three rays per pixel (one eye 
ray plus one transmitted ray for each of the plain textures in the 
interpolation.)  I suppose you could call that a bug.

camera { location -5*z look_at 0 }

plane {
  -z, 0 
  texture {
    gradient x texture_map {
     [0 pigment {color rgbt 1}]
     [1 pigment {color rgbt 1}]
    }       
    translate .5*x scale 500
  }
}

Another side-effect is that the following two textures are not the same, even 
though it seems they should be (that is, a texture_map of two normals is not 
the same as a normal_map of the same two normals):

  texture {
    pigment {
      color rgb 1
    }     
    finish {reflection 1} 
    normal {
      gradient x 
      normal_map {
        [ 0 marble 50 scale .01 ]
        [ 1 marble 50 scale .01 rotate 90*z ]
      }
      translate -.5*x
      scale 50
    }
  }
  

  texture {
    gradient x 
    texture_map {
      [0 pigment {
           color rgb 1
         }     
         finish {reflection 1} 
         normal {marble 50 scale .01}
      ]
      [1 pigment {
           color rgb 1
         }     
         finish {reflection 1} 
         normal {marble 50 scale .01 rotate 90*z}
      ]
    }
    translate -.5*x
    scale 50
  }

-- 
These are my opinions.  I do NOT speak for the POV-Team.
The superpatch: http://www2.fwi.com/~parkerr/superpatch/
My other stuff: http://www2.fwi.com/~parkerr/traces.html


Post a reply to this message

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