Difference between revisions of "Reference:Default Directive"

From POV-Wiki
Jump to navigation Jump to search
m (cleanup round 2)
m (1 revision: reference layout changes)
(No difference)

Revision as of 13:11, 8 August 2012

POV-Ray creates a default texture when it begins processing. You may change those defaults as described below. Every time you specify a texture statement, POV-Ray creates a copy of the default texture. Anything you put in the texture statement overrides the default settings. If you attach a pigment, normal, or finish to an object without any texture statement then POV-Ray checks to see if a texture has already been attached. If it has a texture then the pigment, normal or finish will modify the existing texture. If no texture has yet been attached to the object then the default texture is copied and the pigment, normal or finish will modify that texture.

You may change the default texture, pigment, normal or finish using the language directive #default as follows:

DEFAULT_DIRECTIVE:
  #default {DEFAULT_ITEM }
DEFAULT_ITEM:
  TEXTURE | PIGMENT | NORMAL | FINISH

For example:

#default {
  texture {
    pigment { rgb <1,0,0> }
    normal { bumps 0.3 }
    finish { ambient 0.4 }
    }
  }

This means objects will default to red bumps and slightly high ambient finish. You may also change just part of it like this:

#default {
  pigment {rgb <1,0,0>}
  }

This still changes the pigment of the default texture. At any time there is only one default texture made from the default pigment, normal and finish. The example above does not make a separate default for pigments alone.

Note: The special textures tiles and material_map or a texture with a texture_map may not be used as defaults.

You may change the defaults several times throughout a scene as you wish. Subsequent #default statements begin with the defaults that were in effect at the time. If you wish to reset to the original POV-Ray defaults then you should first save them as follows:

//At top of file
#declare Original_Default = texture {}

later after changing defaults you may restore it with...

#default {texture {Original_Default}}

If you do not specify a texture for an object then the default texture is attached when the object appears in the scene. It is not attached when an object is declared.

For example:

#declare My_Object =
sphere{ <0,0,0>, 1 } // Default texture not applied
object{ My_Object }        // Default texture added here

You may force a default texture to be added by using an empty texture statement as follows:

#declare My_Thing =
sphere { <0,0,0>, 1 texture {} } // Default texture applied

The original POV-Ray defaults for all items are given throughout the documentation under each appropriate section.