POV-Ray : Newsgroups : povray.general : Cubic syntax pb Server Time
24 Nov 2024 16:50:28 EST (-0500)
  Cubic syntax pb (Message 1 to 8 of 8)  
From: lelama
Subject: Cubic syntax pb
Date: 16 May 2018 19:15:01
Message: <web.5afcbab9b0bae1867a63dc9f0@news.povray.org>
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  }}}


Post a reply to this message

From: Jim Holsenback
Subject: Re: Cubic syntax pb
Date: 16 May 2018 20:59:42
Message: <5afcd3fe$1@news.povray.org>
On 05/16/2018 07:11 PM, lelama wrote:
> 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"  }}
> } ,  }

one more closing brace after the comma

> 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  }}}
> 
> 
>


Post a reply to this message

From: Jim Holsenback
Subject: Re: Cubic syntax pb
Date: 16 May 2018 21:00:54
Message: <5afcd446$1@news.povray.org>
On 05/16/2018 08:59 PM, Jim Holsenback wrote:
> On 05/16/2018 07:11 PM, lelama wrote:
>> 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"  }}
>> } ,  }
> 
> one more closing brace after the comma

after the /last/ comma

> 
>> 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  }}}
>>
>>
>>
>


Post a reply to this message

From: lelama
Subject: Re: Cubic syntax pb
Date: 17 May 2018 04:00:01
Message: <web.5afd358e884f5cc97a63dc9f0@news.povray.org>
Thank you Jim for the answer. However, the parenthesis seem correct to me.
Here is the same example in a simpler form to avoid checking parenthesis.

The problem seems specific to cubic since when I replace the first box by the
second the code works perfectly.



#declare pb = pigment {Blue}
#declare pw = pigment {White}
#declare cubicOak = texture {cubic texture{pb} ,texture{pb} ,texture{pb }
,texture{pb } ,texture{pb} ,texture{pb}   }
#declare myGlass = texture { Glass3 }

box {
<0.0,0.0,0.0>,<1.0,1.0,1.0> texture {cubicOak  pw }}

//box {
//<0.0,0.0,0.0>,<1.0,1.0,1.0> texture {myGlass  pw }}


Post a reply to this message

From: clipka
Subject: Re: Cubic syntax pb
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

From: Jim Holsenback
Subject: Re: Cubic syntax pb
Date: 17 May 2018 06:12:28
Message: <5afd558c$1@news.povray.org>
On 05/17/2018 03:55 AM, lelama wrote:
> 
> Thank you Jim for the answer. However, the parenthesis seem correct to me.

well for sure your example wouldn't parse as is ... when i added that 
last closing brace it /did/ ... found it by (as suggested) structuring 
things ;-)


Post a reply to this message

From: lelama
Subject: Re: Cubic syntax pb
Date: 17 May 2018 06:30:01
Message: <web.5afd592b884f5cc97a63dc9f0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
>
> 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...]
>     }
>
>

Thank you, this is very clear !

Sorry for the indentation, this was output from python.


Post a reply to this message

From: clipka
Subject: Re: Cubic syntax pb
Date: 17 May 2018 06:32:02
Message: <5afd5a22$1@news.povray.org>
Am 17.05.2018 um 12:12 schrieb Jim Holsenback:
> On 05/17/2018 03:55 AM, lelama wrote:
>>
>> Thank you Jim for the answer. However, the parenthesis seem correct to
>> me.
> 
> well for sure your example wouldn't parse as is ... when i added that
> last closing brace it /did/ ... found it by (as suggested) structuring
> things ;-)

That's odd, because my structuring attempts ended up with well-balanced
braces.

I guess this only goes to show how important it is to structure things
-- ideally right from the beginning, because sometimes errors occur even
in the process of trying to structure stuff later.


Post a reply to this message

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