POV-Ray : Newsgroups : povray.general : Modify already created object Server Time
24 Dec 2024 20:50:12 EST (-0500)
  Modify already created object (Message 1 to 10 of 15)  
Goto Latest 10 Messages Next 5 Messages >>>
From: bublible
Subject: Modify already created object
Date: 28 Aug 2014 12:40:01
Message: <web.53ff5aa416956db3b91df8500@news.povray.org>
Is there any option how to modify some attributes of some already created
object...like changing scale of some polygon instance named "PODKLAD"?

Because this example from another post makes three new objects instead of 3x
modifying the one existing object:

#declare ball = sphere {
 1, <0, 1, 0>
 pigment {rgb <1, 0, 0>}
 //... and so on
}

object {
 ball
 translate <0, 1, 0>
}

object {
 ball
 pigment {rgb <1, 0, 0>}
//not sure that this will override the pigment statement in the #define'd ball
}

object {
 ball scale <10, 10, 10>
}


Post a reply to this message

From: clipka
Subject: Re: Modify already created object
Date: 28 Aug 2014 14:14:21
Message: <53ff717d$1@news.povray.org>
Am 28.08.2014 18:36, schrieb bublible:
> Is there any option how to modify some attributes of some already created
> object...like changing scale of some polygon instance named "PODKLAD"?

What you can do is:

- override textures or interiors
- translate, scale, rotate or apply some other linear transformation

(Strictly speaking, you still don't modify an existing object; instead, 
you create a /copy/ of an object with the respective modifications.)

What you can /not/ do is modify other object properties such as the 
radii of a torus.


Post a reply to this message

From: bublible
Subject: Re: Modify already created object
Date: 28 Aug 2014 14:35:01
Message: <web.53ff73b9af00b5afb91df8500@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 28.08.2014 18:36, schrieb bublible:
> > Is there any option how to modify some attributes of some already created
> > object...like changing scale of some polygon instance named "PODKLAD"?
>
> What you can do is:
>
> - override textures or interiors
> - translate, scale, rotate or apply some other linear transformation
>
> (Strictly speaking, you still don't modify an existing object; instead,
> you create a /copy/ of an object with the respective modifications.)
>
> What you can /not/ do is modify other object properties such as the
> radii of a torus.

Fine, but you did not tell me how to do it cos my sample above is not modifying
existing object but creating 3 new instances of it so I have all of them in the
place at once (basically what I am trying to achieve is obtain objects
coordinates to know where it remains - gradient polygon simulating base plane -
and then do some mathematics including camera position having my object facing
the camera at the same distance and angle every time I render something
independently from what camera position and angle are)...so? Please, can you
tell me the trick? :)


Post a reply to this message

From: clipka
Subject: Re: Modify already created object
Date: 28 Aug 2014 14:50:55
Message: <53ff7a0f$1@news.povray.org>
Am 28.08.2014 20:30, schrieb bublible:
> clipka <ano### [at] anonymousorg> wrote:
>> Am 28.08.2014 18:36, schrieb bublible:
>>> Is there any option how to modify some attributes of some already created
>>> object...like changing scale of some polygon instance named "PODKLAD"?
>>
>> What you can do is:
>>
>> - override textures or interiors
>> - translate, scale, rotate or apply some other linear transformation

Remembering this: ...
---------------------------------------
>> (Strictly speaking, you still don't modify an existing object; instead,
>> you create a /copy/ of an object with the respective modifications.)
---------------------------------------

>>
>> What you can /not/ do is modify other object properties such as the
>> radii of a torus.
>
> Fine, but you did not tell me how to do it cos my sample above is not modifying
> existing object but creating 3 new instances of it so I have all of them in the
> place at once (basically what I am trying to achieve is obtain objects
> coordinates to know where it remains - gradient polygon simulating base plane -
> and then do some mathematics including camera position having my object facing
> the camera at the same distance and angle every time I render something
> independently from what camera position and angle are)...so? Please, can you
> tell me the trick? :)

... is the trick.

So what you would have to do is

   #declare ball0 = sphere { ... }
   #declare ball1 = object { ball1 translate ... }
   #declare ball2 = object { ball2 pigment ... }
   #declare ball3 = object { ball3 scale ... }

and finally actually place the object into the scene:

   object { ball3 }

If you find it more convenient, you can re-use the same name:

   #declare ball = sphere { ... }
   #declare ball = object { ball translate ... }
   #declare ball = object { ball pigment ... }
   #declare ball = object { ball scale ... }
   object { ball }

Note that in each step "ball" is a different object.

Of course you can also modify multiple things at once:

   #declare ball = sphere { ... }
   #declare ball = object { ball pigment ... translate ... scale ... }
   object { ball }


Post a reply to this message

From: Alain
Subject: Re: Modify already created object
Date: 28 Aug 2014 16:31:42
Message: <53ff91ae@news.povray.org>

> Is there any option how to modify some attributes of some already created
> object...like changing scale of some polygon instance named "PODKLAD"?
>
> Because this example from another post makes three new objects instead of 3x
> modifying the one existing object:
>
> #declare ball = sphere {
>   1, <0, 1, 0>
>   pigment {rgb <1, 0, 0>}
>   //... and so on
> }
>
> object {
>   ball
>   translate <0, 1, 0>
> }
>
> object {
>   ball
>   pigment {rgb <1, 0, 0>}
> //not sure that this will override the pigment statement in the #define'd ball
> }
The pigment IS overriden, but by an identical one. Try pigment{rgb<0, 
0.5, 1>} to see the difference.
>
> object {
>   ball scale <10, 10, 10>
> }
>
>

You can always redefine any object:
#declare Ball=sphere{0, 1 pigment{rgb<1,0,0>}}
#declare Ball=object{Ball scale 10 translate <5,12,1> pigment{bozo}}

The original Ball object no longer exist after been replaced by a 
scalled, translated and retextured version of itself.


Alain


Post a reply to this message

From: Thomas de Groot
Subject: Re: Modify already created object
Date: 29 Aug 2014 03:44:52
Message: <54002f74$1@news.povray.org>
On 28-8-2014 20:50, clipka wrote:

>    #declare ball0 = sphere { ... }
>    #declare ball1 = object { ball1 translate ... }
>    #declare ball2 = object { ball2 pigment ... }
>    #declare ball3 = object { ball3 scale ... }


I suppose you mean:

    #declare ball0 = sphere { ... }
    #declare ball1 = object { ball0 translate ... }
    #declare ball2 = object { ball1 pigment ... }
    #declare ball3 = object { ball2 scale ... }

Thomas


Post a reply to this message

From: clipka
Subject: Re: Modify already created object
Date: 29 Aug 2014 09:27:53
Message: <54007fd9$1@news.povray.org>
Am 29.08.2014 09:44, schrieb Thomas de Groot:
> On 28-8-2014 20:50, clipka wrote:
>
>>    #declare ball0 = sphere { ... }
>>    #declare ball1 = object { ball1 translate ... }
>>    #declare ball2 = object { ball2 pigment ... }
>>    #declare ball3 = object { ball3 scale ... }
>
>
> I suppose you mean:
>
>     #declare ball0 = sphere { ... }
>     #declare ball1 = object { ball0 translate ... }
>     #declare ball2 = object { ball1 pigment ... }
>     #declare ball3 = object { ball2 scale ... }
>
> Thomas

Uh... yes, thanks for spotting this.


Post a reply to this message

From: bublible
Subject: Re: Modify already created object
Date: 29 Aug 2014 10:25:01
Message: <web.54008c68af00b5afb91df8500@news.povray.org>
Alain <kua### [at] videotronca> wrote:

> > Is there any option how to modify some attributes of some already created
> > object...like changing scale of some polygon instance named "PODKLAD"?
> >
> > Because this example from another post makes three new objects instead of 3x
> > modifying the one existing object:
> >
> > #declare ball = sphere {
> >   1, <0, 1, 0>
> >   pigment {rgb <1, 0, 0>}
> >   //... and so on
> > }
> >
> > object {
> >   ball
> >   translate <0, 1, 0>
> > }
> >
> > object {
> >   ball
> >   pigment {rgb <1, 0, 0>}
> > //not sure that this will override the pigment statement in the #define'd ball
> > }
> The pigment IS overriden, but by an identical one. Try pigment{rgb<0,
> 0.5, 1>} to see the difference.
> >
> > object {
> >   ball scale <10, 10, 10>
> > }
> >
> >
>
> You can always redefine any object:
> #declare Ball=sphere{0, 1 pigment{rgb<1,0,0>}}
> #declare Ball=object{Ball scale 10 translate <5,12,1> pigment{bozo}}
>
> The original Ball object no longer exist after been replaced by a
> scalled, translated and retextured version of itself.
>
>
> Alain

Yea, seems to me that should do the "trick", simple re-declare declared and only
then place it into the scene, haha, exactly - why this has not come to my mind
automaticaly? :D Appriciate guys your help.

BTW some other question: how can I access some array values? I mean vector
values like ldd_camera_position variable consists of 3 values of x, y and z. Now
how can I access them individually? I come from FLASH ActioScript2 scene and
there you would do it easily like "ldd_camera_position[x]" where "x" is the
index number beginning with 0...so how it is made in PovRay, please?


Post a reply to this message

From: clipka
Subject: Re: Modify already created object
Date: 29 Aug 2014 12:12:04
Message: <5400a654$1@news.povray.org>
Am 29.08.2014 16:21, schrieb bublible:

> BTW some other question: how can I access some array values? I mean vector
> values like ldd_camera_position variable consists of 3 values of x, y and z. Now
> how can I access them individually? I come from FLASH ActioScript2 scene and
> there you would do it easily like "ldd_camera_position[x]" where "x" is the
> index number beginning with 0...so how it is made in PovRay, please?

You can access the components of some vector MyVector as follows:

   MyVector.x
   MyVector.y
   MyVector.z


Post a reply to this message

From: bublible
Subject: Re: Modify already created object
Date: 29 Aug 2014 16:50:01
Message: <web.5400e71eaf00b5afb91df8500@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 29.08.2014 16:21, schrieb bublible:
>
> > BTW some other question: how can I access some array values? I mean vector
> > values like ldd_camera_position variable consists of 3 values of x, y and z. Now
> > how can I access them individually? I come from FLASH ActioScript2 scene and
> > there you would do it easily like "ldd_camera_position[x]" where "x" is the
> > index number beginning with 0...so how it is made in PovRay, please?
>
> You can access the components of some vector MyVector as follows:
>
>    MyVector.x
>    MyVector.y
>    MyVector.z

Thanx a lot.

Another problem: I am not able find pattern that would do "radial gradient",
that is circle blending (normal gradient transform linear on x or y axis). I was
trying: onion, planar, wood...with all there is one big problem: I need to apply
it to polygon (simple square) STARTING FROM THE CENTER, but all those patterns
starting from a corner??? Being webdesigner I never saw anything like that cos
when I apply circle/radial gradient those are centric circles, not ones having
their center in a corner. I was trying to transalte its center but it did not do
what I was expecting...please, help again my friend if you can. :(


Post a reply to this message

Goto Latest 10 Messages Next 5 Messages >>>

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