Patterns
Home Up UV Mapping Patterns Meshes Radiosity Photons Misc. Changes Media

 

Image_Pattern

A new pattern type was added, which is called "image_pattern". It uses a very similar syntax as "bump_map", but without "bump_size". There is also a new keyword "use_alpha" which works similar to "use_color" or "use_index" (see the POV-Ray documentation regarding bump maps).

It is meant to be used for creating texture "masks", like the following:

  texture
  {
    image_pattern { tga "image.tga" use_alpha }
    texture_map
    {
      [0 mytex               ]
      [1 pigment{transmit 1} ]
    }
  }                

note, the following macros might come in handy:

#macro texture_transmit(tex, trans)
  average texture_map {[1-trans tex] [trans pigment{transmit 1}] }
#end
#macro pigment_transmit(tex, trans)
  average pigment_map {[1-trans tex] [trans transmit 1] }
#end
#macro normal_transmit(tex, trans)
  average normal_map {[1-trans tex] [trans bump_size 0.0] }
#end                

Reset_Children

First I want to give credit to Daren Scot Wilson.  His "warp_map_only" patch inspired this feature.  Unfortunately his patch had some bugs which this implementation tries to avoid.

When using texture maps, or any textures that have child textures, you can run into problems if you want to modify the texture map (such as with turbulence), but you do not want to modify the child textures.  Here is an example:

The solution to this is a new warp, called "reset_children."   When you add this warp to an texture, the child textures are reset.  All following warps and transformations will apply to the texture, but everything before the "reset_children" warp is cleared for the child textures.  Here's what the previous scene looks like with the reset_children warp applied:

RESET.jpg (14501 bytes) This image shows off both the reset_children warp and uv mapping.

The lathe on the right has texture tex1 (see below), while the lathe on the left has texture tex2.  Notice how the turbulence has been reset for the child textures, but still applies to the parent leopard pattern.  Both are uv mapped.

 
#declare grad_tex = texture{
  pigment{gradient x color_map{[0 rgb<0,0,0>][1 rgb<0,0,1>]}} 
}
#declare check_tex = texture{
  pigment{checker rgb<1,1,1>, rgb<1,0,0> scale .25} 
}                                        
 
#declare tex1 = texture {
  leopard
  texture_map {
    [ .04  grad_tex]
    [ .06  check_tex]
  }
  warp{turbulence .3}
  scale .1
}                                        
 
#declare tex2 = texture {
  leopard
  texture_map {
    [ .04  grad_tex]
    [ .06  check_tex]
  }
  warp{turbulence .3}
  warp{reset_children}
  scale .1
}                                        

For those who care, the implementation of reset_children was two-fold.  First, I added a new warp type called reset_children.  Then, I added a parameter to Warp_EPoint so that it could know if it was warping the parent or the children patterns.   If Warp_EPoint is warping a child texture and it hits a reset_children warp, it will stop.  Since warps are applied in reverse order, this means that only the warps after the reset_children warp are used, which appears to the user as the child textures getting reset.

 

This page was last updated March 02, 1999.

If you have any comments, please email me. My email address is Nathan at Kopp dot Com.