POV-Ray : Newsgroups : povray.general : Layered texture question Server Time
4 Nov 2024 13:33:44 EST (-0500)
  Layered texture question (Message 1 to 7 of 7)  
From: Thomas de Groot
Subject: Layered texture question
Date: 21 Jun 2007 10:23:49
Message: <467a89f5$1@news.povray.org>
I feel rather stupid  :-(
I am unable to discover what is wrong in the following piece of code (a 
variation of Rune's Grasstex macro use, adapted for a mesh2 object embedded 
in a macro using MyTexture):

//---start code---
   #declare MyTexture =
      texture {
         #declare gt_groundcolors =
         color_map {
            [0.0, color <0.70,0.55,0.40>]
            [0.5, color <0.50,0.40,0.30>]
            [1.0, color <0.30,0.25,0.20>]
         }
         gt_ground()
         normal {wrinkles 0.5 scale 1*gt_scale turbulence 1}
         finish {
           ambient 0            // ambient surface reflection color [0.1]
           diffuse 0.6          // amount [0.6]
           brilliance 1.0       // tightness of diffuse illumination [1.0]
           conserve_energy      // more realistic
         } // finish
         scale 1/ObjScale
      }
      texture {
         #declare gt_color   = <0.15,0.65,0.00>;
         #declare gt_offset  = -0.00;
         #declare gt_seed    = 0;
         gt_grass()
         normal {FurNormal scale gt_scale}
         finish {
           ambient 0            // ambient surface reflection color [0.1]
           diffuse 0.6          // amount [0.6]
           brilliance 1.0       // tightness of diffuse illumination [1.0]
           conserve_energy      // more realistic
         } // finish
         scale 1/ObjScale
      }

   object {Fur(MyTexture) scale ObjScale}
//---end code---

Individually, the textures work fine, but when I layer them, POV-Ray gives 
an error message at the second texture {  telling me "Parse error: No 
matching } in 'texture', # found instead". If I comment out the 
declarations, it is the macro call that is found instead...
As far as I can tell, all braces are accounted for (also earlier in the 
scene), so what is the problem?

Any bright idea is welcome!!!

Thomas


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Layered texture question
Date: 21 Jun 2007 10:32:50
Message: <467a8c12@news.povray.org>
Thomas de Groot wrote:

> Individually, the textures work fine, but when I layer them, POV-Ray gives 
> an error message at the second texture {  telling me "Parse error: No 
> matching } in 'texture', # found instead". 

Might be related to the following note in "3.5.6 Layered Textures":

No macros are allowed in layered textures. The problem is that if a
macro would contain a declare the parser could no longer guess that two
or more texture identifiers are supposed to belong to the layered
texture and not some other declare.


Post a reply to this message

From: Thomas de Groot
Subject: Re: Layered texture question
Date: 21 Jun 2007 10:39:12
Message: <467a8d90$1@news.povray.org>
"Christian Froeschlin" <chr### [at] chrfrde> schreef in bericht 
news:467a8c12@news.povray.org...
> Thomas de Groot wrote:
>
>> Individually, the textures work fine, but when I layer them, POV-Ray 
>> gives an error message at the second texture {  telling me "Parse error: 
>> No matching } in 'texture', # found instead".
>
> Might be related to the following note in "3.5.6 Layered Textures":
>
> No macros are allowed in layered textures. The problem is that if a
> macro would contain a declare the parser could no longer guess that two
> or more texture identifiers are supposed to belong to the layered
> texture and not some other declare.

However, Rune's Grasstex works perfectly this way! This code is even an 
exact copy, and his original code has no problems....

Thomas


Post a reply to this message

From: nemesis
Subject: Re: Layered texture question
Date: 21 Jun 2007 13:35:02
Message: <web.467ab6baaca8caf0773c9a3e0@news.povray.org>
I assume the macro calls return a pigment?  If so, just declare them and
call the macro from outside the texture definition and explicitely declare
the pigments...


Post a reply to this message

From: Samuel Benge
Subject: Re: Layered texture question
Date: 21 Jun 2007 15:22:09
Message: <467acfe1$1@news.povray.org>
Thomas de Groot wrote:
> 
> Any bright idea is welcome!!!
> 
> Thomas

I can't say I've had this exact problem, but I've had similar... Have 
you tried adding an extra closing curly bracket ( } ) before the macro's 
#end? It has helped me in the past. It didn't make sense to have more 
closing brackets than opening ones, but it worked nevertheless.

~Sam


Post a reply to this message

From: Tim Attwood
Subject: Re: Layered texture question
Date: 21 Jun 2007 20:41:41
Message: <467b1ac5$1@news.povray.org>
> However, Rune's Grasstex works perfectly this way! This code is even an 
> exact copy, and his original code has no problems....
I believe, if you go back and look, that Rune's samples had the texture
attached to the object instead of #declared.
It's fine to #declare the macro pigments first, or just #declare a texture
for both layers, then combine them.
#declare MyTexture = texture {MyTex1} texture {MyTex2};


Post a reply to this message

From: Thomas de Groot
Subject: Re: Layered texture question
Date: 22 Jun 2007 04:00:00
Message: <467b8180@news.povray.org>
Thank you all, my friends, for your helpful advise!
Tim's was the easiest to implement in the present test context, and it 
worked perfectly.
Additionally, I noted that putting a material{} around the layered texture 
worked also. In the end, because I want to use this with objects exported 
from Poser, that will be the final solution.

Thanks again!

Thomas


Post a reply to this message

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