POV-Ray : Newsgroups : povray.general : Cubic syntax pb : Re: Cubic syntax pb Server Time
25 Apr 2024 23:25:23 EDT (-0400)
  Re: Cubic syntax pb  
From: clipka
Date: 17 May 2018 04:18:24
Message: <5afd3ad0$1@news.povray.org>
Am 17.05.2018 um 01:11 schrieb lelama:
> Hi,
> If I understand the documentation, the following code for the texture shoulde be
> OK, as it is a identifier + a pigment. However I have the following error
> message :Parse Error: No matching } in 'texture',
>  pigment found instead
> 
> Any idea of the pb ?
> Thanks,
> 
> 
> #declare cubicOak = texture {cubic texture{pigment {image_map {png "chene.png"
> }} rotate -90*y } ,texture{pigment {image_map {png "chene.png"  }} rotate -90*x
> } ,texture{pigment {image_map {png "chene.png"  }}  } ,texture{pigment
> {image_map {png "chene.png"  }} rotate -90*y } ,texture{pigment {image_map {png
> "chene.png"  }} rotate -90*x } ,texture{pigment {image_map {png "chene.png"  }}
> } ,  }
> light_source {<-3.0,-4.0,10.0>color rgb <0.3864,0.3864,0.3864> spotlight }
> 
> //Unnamed Object
> box {
> <0.0,0.0,0.0>,<1.0,1.0,1.0> matrix <0.3 , 0.0 , 0.0 , 0.0 , 0.4 , 0.0 , 0.0 ,
> 0.0 , 0.5 , 0.0 , 0.0 , 0.0>texture {cubicOak pigment {White  }}}

Wow, that's wild.
I highly recommend adding some more structure to your scene code, by
making use of indentation, for example like so:

    #declare cubicOak = texture {
      cubic
      texture{
        pigment {
          image_map { png "chene.png" }
        }
        rotate -90*y
      },
      texture {
        pigment {
          image_map { png "chene.png" }
        }
        rotate -90*x
      },
      texture {
        pigment {
          image_map { png "chene.png" }
        }
      },
      texture {
        pigment {
          image_map { png "chene.png" }
        }
        rotate -90*y
      },
      texture {
        pigment {
          image_map { png "chene.png" }
        }
        rotate -90*x
      },
      texture {
        pigment {
          image_map { png "chene.png" }
        }
      },
    }

Also, another word of wisdon: Avoid using the same image over and over
again, as it unnecessarily eats memory and parsing time. Instead, use
something like:

    #declare OakBase = pigment {
      image_map { png "chene.png" }
    }
    #declare cubicOak = texture {
      cubic
      texture{
        pigment { OakBase }
        rotate -90*y
      },
      texture {
        pigment { OakBase }
        rotate -90*x
      },
      texture {
        pigment { OakBase }
      },
      texture {
        pigment { OakBase }
        rotate -90*y
      },
      texture {
        pigment { OakBase }
        rotate -90*x
      },
      texture {
        pigment { OakBase }
      },
    }

This way, the image gets loaded only once, and is shared between the
different textures that make use of it.

But your problem is of a different kind:

    box {
      <0.0,0.0,0.0>,<1.0,1.0,1.0>
      matrix <0.3 , 0.0 , 0.0 ,
              0.0 , 0.4 , 0.0 ,
              0.0 , 0.0 , 0.5 ,
              0.0 , 0.0 , 0.0>
      texture {
        cubicOak
        pigment { White }
      }
    }

According to the documentation, section 3.4.6 "Texture", the
`PLAIN_TEXTURE` syntax is as follows:

    texture {
      [TEXTURE_IDENTIFIER]
      [PNF_IDENTIFIER...]
      [PNF_ITEMS...]
    }

with `PNF_ITEMS` being either of:

    PIGMENT | NORMAL | FINISH | TRANSFORMATION

Thus, the construct

    texture {
      TEXTURE_IDENTIFIER
      PIGMENT
    }

should be valid according to these rules.

However, in `cubicOak` you're using a pattern, so the variable does
/not/ qualify as a regular `TEXTURE_IDENTIFIER`, but rather as a
`PATTERNED_TEXTURE_ID`, and thus the `PATTERNED_TEXTURE` syntax applies:

    texture {
      [PATTERNED_TEXTURE_ID]
      [TRANSFORMATIONS...]
    }

(or some other variants that don't fit here)

Note that this syntax only allows for transformations, not pigment (or
normal or finish) overrides.


Post a reply to this message

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