Difference between revisions of "Reference:Normal"

From POV-Wiki
Jump to navigation Jump to search
m (overlooked addition)
m (Precision about 40 char limited version number)
 
(One intermediate revision by one other user not shown)
Line 19: Line 19:
 
pattern. The default value if none is specified is 0.5.</p>
 
pattern. The default value if none is specified is 0.5.</p>
 
<p>There are four basic types of <em>NORMAL_TYPE</em>s. They are block pattern normals, continuous pattern normals, specialized normals and bump maps. They differ in the types of modifiers you may use with them. The pattern type is optionally followed by one or more normal modifiers. In addition to general pattern modifiers such as transformations, turbulence, and warp modifiers, normals may also have a <em>NORMAL_LIST</em>, <code>[[Reference:Slope Map|slope_map]]</code>, <code>[[Reference:Normal Map|normal_map]]</code>, and <code>bump_size</code> which are specific to normals. See <!--<linkto "Pattern Modifiers">Pattern Modifiers</linkto>--->[[Reference:Pattern Modifiers|Pattern Modifiers]] for information on general modifiers. The normal-specific modifiers are described in sub-sections which follow. Normal modifiers of any kind apply only to the normal and not to other parts of the texture. Modifiers must be specified last.</p>
 
<p>There are four basic types of <em>NORMAL_TYPE</em>s. They are block pattern normals, continuous pattern normals, specialized normals and bump maps. They differ in the types of modifiers you may use with them. The pattern type is optionally followed by one or more normal modifiers. In addition to general pattern modifiers such as transformations, turbulence, and warp modifiers, normals may also have a <em>NORMAL_LIST</em>, <code>[[Reference:Slope Map|slope_map]]</code>, <code>[[Reference:Normal Map|normal_map]]</code>, and <code>bump_size</code> which are specific to normals. See <!--<linkto "Pattern Modifiers">Pattern Modifiers</linkto>--->[[Reference:Pattern Modifiers|Pattern Modifiers]] for information on general modifiers. The normal-specific modifiers are described in sub-sections which follow. Normal modifiers of any kind apply only to the normal and not to other parts of the texture. Modifiers must be specified last.</p>
<p>Originally POV-Ray had some patterns which were exclusively used for pigments while others were exclusively used for normals. Since POV-Ray 3.0 you can use any pattern for either pigments or normals. For example it is now valid to use <code>ripples</code> as a pigment or <code>wood</code> as a normal type. The patterns <code>bumps</code>, <code>dents</code>, <code>ripples</code>, <code>waves</code>, <code> wrinkles</code>, and <code>[[Reference:Bump Map|bump_map]]</code> were once exclusively normal patterns which could not be used as pigments. Because these six types use specialized normal modification calculations they cannot have <code>[[Reference:Slope Map|slope_map]]</code>, <code>[[Reference:Normal Map|normal_map]]</code> or wave shape modifiers. All other normal pattern types may use them. Because block patterns <code> checker</code>, <code>hexagon</code>, <code>object</code> and <code>brick</code> do not return a continuous series of values, they cannot use these modifiers either. See [[Reference:Pattern|:Pattern|Patterns]] for details about specific patterns.</p>
+
<p>Originally POV-Ray had some patterns which were exclusively used for pigments while others were exclusively used for normals. Since POV-Ray v3.0 you can use any pattern for either pigments or normals. For example it is now valid to use <code>ripples</code> as a pigment or <code>wood</code> as a normal type. The patterns <code>bumps</code>, <code>dents</code>, <code>ripples</code>, <code>waves</code>, <code> wrinkles</code>, and <code>[[Reference:Bump Map|bump_map]]</code> were once exclusively normal patterns which could not be used as pigments. Because these six types use specialized normal modification calculations they cannot have <code>[[Reference:Slope Map|slope_map]]</code>, <code>[[Reference:Normal Map|normal_map]]</code> or wave shape modifiers. All other normal pattern types may use them. Because block patterns <code> checker</code>, <code>hexagon</code>, <code>object</code> and <code>brick</code> do not return a continuous series of values, they cannot use these modifiers either. See [[Reference:Pattern|:Pattern|Patterns]] for details about specific patterns.</p>
 
<p>A <code> normal</code> statement is part of a <code>texture</code> specification. However it can be tedious to use a <code>texture</code> statement just to add bumps to an object. Therefore you may attach a normal directly to an object without explicitly specifying that it as part of a texture. For example instead of this:</p>
 
<p>A <code> normal</code> statement is part of a <code>texture</code> specification. However it can be tedious to use a <code>texture</code> statement just to add bumps to an object. Therefore you may attach a normal directly to an object without explicitly specifying that it as part of a texture. For example instead of this:</p>
 
<pre>
 
<pre>
Line 36: Line 36:
 
</pre>
 
</pre>
 
<p>Where <em>IDENTIFIER</em> is the name of the identifier that is at least one character long and <em>NORMAL</em> is any valid <code>normal</code> statement. See <!--<linkto "#declare vs. #local">#declare vs. #local</linkto>--->[[Reference:Declare and Local Directives#declare vs. local|#declare vs. #local]] for information on identifier scope.</p>
 
<p>Where <em>IDENTIFIER</em> is the name of the identifier that is at least one character long and <em>NORMAL</em> is any valid <code>normal</code> statement. See <!--<linkto "#declare vs. #local">#declare vs. #local</linkto>--->[[Reference:Declare and Local Directives#declare vs. local|#declare vs. #local]] for information on identifier scope.</p>
<p class="Note"><strong>Note:</strong> In previous versions identifier names <em>were</em> limited to 40 characters. There has been a {{Change}} removing that restriction.</p>
+
<p class="Note"><strong>Note:</strong> In versions prior to 3.6.2 identifier names <em>were</em> limited to 40 characters. There has been a {{Change}} removing that restriction.</p>

Latest revision as of 20:33, 2 July 2021

Ray-tracing is known for the dramatic way it depicts reflection, refraction and lighting effects. Much of our perception depends on the reflective properties of an object. Ray tracing can exploit this by playing tricks on our perception to make us see complex details that are not really there.

Suppose you wanted a very bumpy surface on the object. It would be very difficult to mathematically model lots of bumps. We can however simulate the way bumps look by altering the way light reflects off of the surface. Reflection calculations depend on a vector called a surface normal vector. This is a vector which points away from the surface and is perpendicular to it. By artificially modifying (or perturbing) this normal vector you can simulate bumps. This is done by adding an optional normal statement.

Note: Attaching a normal pattern does not really modify the surface. It only affects the way light reflects or refracts at the surface so that it looks bumpy.

The syntax is:

NORMAL:
  normal { [NORMAL_IDENTIFIER] [NORMAL_TYPE] [NORMAL_MODIFIER...] }
NORMAL_TYPE:
  PATTERN_TYPE Amount |
  bump_map { BITMAP_TYPE "bitmap.ext" [BUMP_MAP_MODS...]}
NORMAL_MODIFIER:
  PATTERN_MODIFIER | NORMAL_LIST | normal_map { NORMAL_MAP_BODY } |
  slope_map{ SLOPE_MAP_BODY } | bump_size Amount |
  no_bump_scale Bool | accuracy Float

Each of the items in a normal are optional but if they are present, they must be in the order shown. Any items after the NORMAL_IDENTIFIER modify or override settings given in the identifier. If no identifier is specified then the items modify the normal values in the current default texture. The PATTERN_TYPE may optionally be followed by a float value that controls the apparent depth of the bumps. Typical values range from 0.0 to 1.0 but any value may be used. Negative values invert the pattern. The default value if none is specified is 0.5.

There are four basic types of NORMAL_TYPEs. They are block pattern normals, continuous pattern normals, specialized normals and bump maps. They differ in the types of modifiers you may use with them. The pattern type is optionally followed by one or more normal modifiers. In addition to general pattern modifiers such as transformations, turbulence, and warp modifiers, normals may also have a NORMAL_LIST, slope_map, normal_map, and bump_size which are specific to normals. See Pattern Modifiers for information on general modifiers. The normal-specific modifiers are described in sub-sections which follow. Normal modifiers of any kind apply only to the normal and not to other parts of the texture. Modifiers must be specified last.

Originally POV-Ray had some patterns which were exclusively used for pigments while others were exclusively used for normals. Since POV-Ray v3.0 you can use any pattern for either pigments or normals. For example it is now valid to use ripples as a pigment or wood as a normal type. The patterns bumps, dents, ripples, waves, wrinkles, and bump_map were once exclusively normal patterns which could not be used as pigments. Because these six types use specialized normal modification calculations they cannot have slope_map, normal_map or wave shape modifiers. All other normal pattern types may use them. Because block patterns checker, hexagon, object and brick do not return a continuous series of values, they cannot use these modifiers either. See Patterns for details about specific patterns.

A normal statement is part of a texture specification. However it can be tedious to use a texture statement just to add bumps to an object. Therefore you may attach a normal directly to an object without explicitly specifying that it as part of a texture. For example instead of this:

object  {My_Object texture { normal { bumps 0.5 } } }

you may shorten it to:

object { My_Object normal { bumps 0.5 } }

Doing so creates an entire texture structure with default pigment and finish statements just as if you had explicitly typed the full texture {...} around it. Normal identifiers may be declared to make scene files more readable and to parameterize scenes so that changing a single declaration changes many values. An identifier is declared as follows.

NORMAL_DECLARATION:
  #declare IDENTIFIER = NORMAL |
  #local IDENTIFIER = NORMAL

Where IDENTIFIER is the name of the identifier that is at least one character long and NORMAL is any valid normal statement. See #declare vs. #local for information on identifier scope.

Note: In versions prior to 3.6.2 identifier names were limited to 40 characters. There has been a Change removing that restriction.