POV-Ray : Newsgroups : povray.newusers : Simple Repeating Material definition Server Time
5 Sep 2024 06:15:40 EDT (-0400)
  Simple Repeating Material definition (Message 1 to 5 of 5)  
From: Jong
Subject: Simple Repeating Material definition
Date: 28 Nov 2001 22:44:55
Message: <3c05af37$1@news.povray.org>
Dear all,

 I have imported POV file from a Rhino3D modeller file, which contain a lot
of cylinder-like objects, say 50 of them. Actually, I have given the objects
the same material property. But the imported objects have separate almost
identical -- except for the number identifiers--statements of the material.
I'd like to simplify them.
My simple thought was :

#declare ObjectCommonMaterial= material {
  something_I_want
  }
#declare Object1Material = ObjectCommonMaterial;
.... (repeating #declares here)
....
#declare Object49Material= ObjectCommonMaterial;
#declare Object50Material= ObjectCommonMaterial;

However, I know this is not an elegant way to do the work, since I might
have for example two hundreds more of the same objects.

I wish you could help me in this regard.
Thanks in advance,

Jong

// Partial copy of the scene file --
// Object1
 --- deleted --
// Object49
#declare Object49Material = material {
texture {
  pigment { color rgbf <0, 0.478431, 1, 0.85> }
  finish  { ambient 1 diffuse 1 phong 1 phong_size 191 }
  }
}
#declare Object49 = object {
   #include "Cylinder_49.inc"
}
object { Object49 material { Object49Material }}


// Object50
#declare Object50Material = material {
texture {
  pigment { color rgbf <0, 0.478431, 1, 0.85> }
  finish  { ambient 1 diffuse 1 phong 1 phong_size 191 }
  }
}
#declare Object50 = object {
   #include "Cylinder_50.inc"
}
object { Object50 material { Object50Material }}

--- end of the file --


Post a reply to this message

From: Steve
Subject: Re: Simple Repeating Material definition
Date: 28 Nov 2001 23:49:03
Message: <slrna0bfgt.99o.steve@zero-pps.localdomain>
On Thu, 29 Nov 2001 12:45:30 +0900, Jong wrote:
>Dear all,
>
> I have imported POV file from a Rhino3D modeller file, which contain a lot
>of cylinder-like objects, say 50 of them. Actually, I have given the objects
>the same material property. But the imported objects have separate almost
>identical -- except for the number identifiers--statements of the material.
>I'd like to simplify them.
>My simple thought was :
>
>#declare ObjectCommonMaterial= material {
>  something_I_want
>  }
>#declare Object1Material = ObjectCommonMaterial;
>.... (repeating #declares here)
>....
>#declare Object49Material= ObjectCommonMaterial;
>#declare Object50Material= ObjectCommonMaterial;
>
>However, I know this is not an elegant way to do the work, since I might
>have for example two hundreds more of the same objects.
>
>I wish you could help me in this regard.
>Thanks in advance,

How about putting all of your cylinders inside a union and 
then giving the union one material, leav out any cylinders
that you would like to be different. 

#declare CommonMaterial =
material{
         material directives in there......

        }


#declare Most_Of_The_Cylinders =
union{
      cylinder....   rotate... translate...
      cylinder....   rotate... translate...

      material{CommonMaterial}
     }

object{Most_Of_The_Cylinders rotate... translate... }

Hope some of that helps. 

--
Cheers
Steve              email mailto:ste### [at] zeroppsuklinuxnet

%HAV-A-NICEDAY Error not enough coffee  0 pps. 

web http://www.zeropps.uklinux.net/

or  http://start.at/zero-pps

  4:40am  up 51 days, 20:24,  1 user,  load average: 1.00, 1.04, 1.00


Post a reply to this message

From: Jong
Subject: Re: Simple Repeating Material definition
Date: 29 Nov 2001 00:53:19
Message: <3c05cd4f$1@news.povray.org>
Dear Steve,

 Thank you for your prompt help to my problem.
When I add the statements as you described, could I simply add those to the
end of the union block without removing the previous material statements--
more than 50 of them in the scene file --?

My newbie question is that:
Does the most recent material definition take effect ignoring those more
than fifty previous statements?

Thank you so much for your help.

Jong


"Steve" <ste### [at] zeroppsuklinuxnet> wrote in message
news:slr### [at] zero-ppslocaldomain...
> On Thu, 29 Nov 2001 12:45:30 +0900, Jong wrote:
> >Dear all,
> How about putting all of your cylinders inside a union and
> then giving the union one material, leav out any cylinders
> that you would like to be different.
>
> #declare CommonMaterial =
> material{
>          material directives in there......
>
>         }
>
>
> #declare Most_Of_The_Cylinders =
> union{
>       cylinder....   rotate... translate...
>       cylinder....   rotate... translate...
>
>       material{CommonMaterial}
>      }
>
> object{Most_Of_The_Cylinders rotate... translate... }
>
> Hope some of that helps.
>
> --
> Cheers
> Steve              email mailto:ste### [at] zeroppsuklinuxnet
>
> %HAV-A-NICEDAY Error not enough coffee  0 pps.
>
> web http://www.zeropps.uklinux.net/
>
> or  http://start.at/zero-pps
>
>   4:40am  up 51 days, 20:24,  1 user,  load average: 1.00, 1.04, 1.00


Post a reply to this message

From: bob h
Subject: Re: Simple Repeating Material definition
Date: 29 Nov 2001 05:26:27
Message: <3c060d53@news.povray.org>
"Jong" <jjk### [at] mmewhaackr> wrote in message
news:3c05cd4f$1@news.povray.org...
> Dear Steve,
>
>  Thank you for your prompt help to my problem.
> When I add the statements as you described, could I simply add those to
the
> end of the union block without removing the previous material statements--
> more than 50 of them in the scene file --?
>
> My newbie question is that:
> Does the most recent material definition take effect ignoring those more
> than fifty previous statements?


Not entirely, and basically the answer in this case is no.

Only way things are changed from previous object textures is when none
existed before.  The originals are kept.  This is so you can texture
anything which was previously left untextured and yet still leave the
already textured things in place.

However, material (texture, pigment, normal, finish, interior, etc.)
statements themselves can be changed or modifed when you put new statements
or items into them.
For example:

#declare M0=
material {
    texture {
        pigment {
                    rgb <1,1,0>
                    }
            finish {specular 1}
                }
     }
 }

sphere {
    0,1
material {
    M0
    texture {
        pigment {
            rgb <1,0,1> filter 0.5
        }
            normal {wrinkles 1}
        }
    }
}

Color is changed, finish is same, normal added.  Any variation like that.

--
text{ttf"arial","bob h",.1,0pigment{rgb 9}translate<-1,-.2,3>}


Post a reply to this message

From: Steve
Subject: Re: Simple Repeating Material definition
Date: 29 Nov 2001 10:54:22
Message: <slrna0cmf4.ai9.steve@zero-pps.localdomain>
On Thu, 29 Nov 2001 14:53:53 +0900, Jong wrote:
>Dear Steve,
>
> Thank you for your prompt help to my problem.
>When I add the statements as you described, could I simply add those to the
>end of the union block without removing the previous material statements--
>more than 50 of them in the scene file --?
>
>My newbie question is that:
>Does the most recent material definition take effect ignoring those more
>than fifty previous statements?
>
>Thank you so much for your help.

One idea would be to get Rhino to export the objects without any material or
texture, that would make things a bit easier for you. 

Keep a copy of your original file so that you can see when the materials 
contain. 

If you have no material on anything then you can set a default material
at the top of your POV scene file and every object in the scene that 
doesn't have a material will be given the default material.  

--
Cheers
Steve              email mailto:ste### [at] zeroppsuklinuxnet

%HAV-A-NICEDAY Error not enough coffee  0 pps. 

web http://www.zeropps.uklinux.net/

or  http://start.at/zero-pps

  3:49pm  up 52 days,  7:33,  1 user,  load average: 1.00, 1.00, 1.00


Post a reply to this message

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