POV-Ray : Newsgroups : povray.animations : How to fix texture to moving part Server Time
23 Nov 2024 06:01:12 EST (-0500)
  How to fix texture to moving part (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: Janc
Subject: How to fix texture to moving part
Date: 7 Oct 2013 07:55:00
Message: <web.52529e927ce0c7bc1a5bae550@news.povray.org>
Hi, all!
I have a code with a cylinder that tilt both sides like an inverted pendulum and
it is textured with rust iron.
The problem is that when it tilts, each picture has a diferent rust texture.
This is the texture used in the cylinder:
#declare Rust =
texture {
    pigment {
        granite
        color_map {
            [0.0 rgb <0.4, 0.3, 0.18>]
            [0.4 rgb <0.3, 0.0, 0.00>]
            [0.5 rgb <0.3, 0.2, 0.04>]
            [0.6 rgb <0.1, 0.1, 0.14>]
            [1.0 rgb <0.4, 0.3, 0.14>]
        }
    }
    finish { ambient 0.1 diffuse 0.3 }
}
cylinder{
    <0, 0, 0>, <0, 50, 0>, 1
    texture{Rust scale 10 finish{roughness 100 ambient 0.2 }
    rotate Ang*z // Ang = tilting degree
}
Question: Is there any code so the cylinder has the same texture in all frames?

Thanks in advanced for your help.


Post a reply to this message

From: MichaelJF
Subject: Re: How to fix texture to moving part
Date: 7 Oct 2013 15:40:00
Message: <web.52530d075b3e3e64ef0c5fed0@news.povray.org>
"Janc" <jan### [at] telefonicanet> wrote:
> Hi, all!
> I have a code with a cylinder that tilt both sides like an inverted pendulum and
> it is textured with rust iron.
> The problem is that when it tilts, each picture has a diferent rust texture.
> This is the texture used in the cylinder:
> #declare Rust =
> texture {
>     pigment {
>         granite
>         color_map {
>             [0.0 rgb <0.4, 0.3, 0.18>]
>             [0.4 rgb <0.3, 0.0, 0.00>]
>             [0.5 rgb <0.3, 0.2, 0.04>]
>             [0.6 rgb <0.1, 0.1, 0.14>]
>             [1.0 rgb <0.4, 0.3, 0.14>]
>         }
>     }
>     finish { ambient 0.1 diffuse 0.3 }
> }
> cylinder{
>     <0, 0, 0>, <0, 50, 0>, 1
>     texture{Rust scale 10 finish{roughness 100 ambient 0.2 }
>     rotate Ang*z // Ang = tilting degree
> }
> Question: Is there any code so the cylinder has the same texture in all frames?
>
> Thanks in advanced for your help.

You have a missing bracket "}" to close the texture before the rotate I think.
So the texture is rotated and not the cylinder what seems to be your intent.

Best regards,
Michael


Post a reply to this message

From: Janc
Subject: Re: How to fix texture to moving part
Date: 7 Oct 2013 16:10:01
Message: <web.525314f35b3e3e64b9bbbc460@news.povray.org>
"MichaelJF" <mi-### [at] t-onlinede> wrote:
> "Janc" <jan### [at] telefonicanet> wrote:
> > Hi, all!
> > I have a code with a cylinder that tilt both sides like an inverted pendulum and
> > it is textured with rust iron.
> > The problem is that when it tilts, each picture has a diferent rust texture.
> > This is the texture used in the cylinder:
> > #declare Rust =
> > texture {
> >     pigment {
> >         granite
> >         color_map {
> >             [0.0 rgb <0.4, 0.3, 0.18>]
> >             [0.4 rgb <0.3, 0.0, 0.00>]
> >             [0.5 rgb <0.3, 0.2, 0.04>]
> >             [0.6 rgb <0.1, 0.1, 0.14>]
> >             [1.0 rgb <0.4, 0.3, 0.14>]
> >         }
> >     }
> >     finish { ambient 0.1 diffuse 0.3 }
> > }
> > cylinder{
> >     <0, 0, 0>, <0, 50, 0>, 1
> >     texture{Rust scale 10 finish{roughness 100 ambient 0.2 }
> >     rotate Ang*z // Ang = tilting degree
> > }
> > Question: Is there any code so the cylinder has the same texture in all frames?
> >
> > Thanks in advanced for your help.
>
> You have a missing bracket "}" to close the texture before the rotate I think.
> So the texture is rotated and not the cylinder what seems to be your intent.
>
> Best regards,
> Michael

Hi! Michael.
Thanks for your help, but it was a problem of copy and paste, I missed the last
}.
Any way, povray should refuse to work if there is a lost }

cylinder{
    <0, 0, 0>, <0, 50, 0>, 1
    texture{Rust scale 10 finish{roughness 100 ambient 0.2 } }
    rotate Ang*z // Ang = tilting degree
}


Post a reply to this message

From: MichaelJF
Subject: Re: How to fix texture to moving part
Date: 7 Oct 2013 16:50:00
Message: <web.52531de35b3e3e64ef0c5fed0@news.povray.org>
"Janc" <jan### [at] telefonicanet> wrote:

> Hi! Michael.
> Thanks for your help, but it was a problem of copy and paste, I missed the last
> }.
> Any way, povray should refuse to work if there is a lost }

Usually it does. But in some cases the placement of the brackets determines the
structure the transforms are to be applied. Textures can be transformed as well
as objects. So if you have a transform (like rotate, translate or scale or the
totally confusing matrix transforms) within a texture, it will be applied to the
texture and not to the object which the texture is to be applied.

>
> cylinder{
>     <0, 0, 0>, <0, 50, 0>, 1
>     texture{Rust scale 10 finish{roughness 100 ambient 0.2 } }
>     rotate Ang*z // Ang = tilting degree
> }

In this case the rotation is applied to the object (the cylinder) and not to the
texture.

Best regards,
Michael


Post a reply to this message

From: Christian Froeschlin
Subject: Re: How to fix texture to moving part
Date: 8 Oct 2013 06:51:01
Message: <5253e395@news.povray.org>
Janc wrote:

> Any way, povray should refuse to work if there is a lost }

Actually, with the code you posted it would have complained

   "Parse Error: No matching } in 'cylinder', End of File found instead"

So you probably "fixed" it at the wrong place by adding a "}" later.


Post a reply to this message

From: Janc
Subject: Re: How to fix texture to moving part
Date: 8 Oct 2013 07:00:01
Message: <web.5253e57d5b3e3e64bbbff5b50@news.povray.org>
"MichaelJF" <mi-### [at] t-onlinede> wrote:
> "Janc" <jan### [at] telefonicanet> wrote:
>
> > Hi! Michael.
> > Thanks for your help, but it was a problem of copy and paste, I missed the last
> > }.
> > Any way, povray should refuse to work if there is a lost }
>
> Usually it does. But in some cases the placement of the brackets determines the
> structure the transforms are to be applied. Textures can be transformed as well
> as objects. So if you have a transform (like rotate, translate or scale or the
> totally confusing matrix transforms) within a texture, it will be applied to the
> texture and not to the object which the texture is to be applied.
>
> >
> > cylinder{
> >     <0, 0, 0>, <0, 50, 0>, 1
> >     texture{Rust scale 10 finish{roughness 100 ambient 0.2 } }
> >     rotate Ang*z // Ang = tilting degree
> > }
>
> In this case the rotation is applied to the object (the cylinder) and not to the
> texture.
>
> Best regards,
> Michael

Hi! Michael.

I tried with various position of "rotate<x,y,z>" but it never seem to rotate my
Rust texture.

#declare MyRust =
    texture{ Rust
        normal { agate 1.5 scale 0.25 }
        finish { phong 0.1  }
        scale 0.1
    }

#declare Mastil =
    union{
        cone {
            <0, 0, 0>, radio_inferior_mastil   // Centro y radio inferior.
            <0, 320, 0>, radio_superior_mastil    // Centro y radio superior.
            open
        }
        cylinder{ // Lower end closer.
            <0, -.5, 0>, <0, .5, 0>, radio_inferior_mastil
        }
    }

Test 1
object{
    Mastil
    #local Ang_Mastil = -( ((ClockZ-Fase_2)*90)/(Fase_3-Fase_2) );
    rotate <0, 0, Ang_Mastil> // OK
    texture{ MyRust rotate <0, 0, Ang_Mastil> } // <<<<<< it seems not rotate.
}

Test 2
object{
    Mastil
    #local Ang_Mastil = -( ((ClockZ-Fase_2)*90)/(Fase_3-Fase_2) );
    texture{ MyRust } // <<<<<< it seems not rotate.
    rotate <0, 0, Ang_Mastil>
}


I upload a gif with the result at:
http://news.povray.org/povray.binaries.animations/thread/%3Cweb.5253e42b5b3e3e64bbbff5b50@news.povray.org%3E/

There you can see how texture change each frame.

Regards.


Post a reply to this message

From: MichaelJF
Subject: Re: How to fix texture to moving part
Date: 8 Oct 2013 13:10:00
Message: <web.52543bb75b3e3e64f1cbbe240@news.povray.org>
"Janc" <jan### [at] telefonicanet> wrote:
 Hi Janc,

see your p.b.a for my idea what happens here.

Best regards,
Michael


Post a reply to this message

From: Janc
Subject: Re: How to fix texture to moving part
Date: 8 Oct 2013 15:50:01
Message: <web.525460d25b3e3e64a9639f950@news.povray.org>
"MichaelJF" <mi-### [at] t-onlinede> wrote:
> "Janc" <jan### [at] telefonicanet> wrote:
>  Hi Janc,
>
> see your p.b.a for my idea what happens here.
>
> Best regards,
> Michael

I'm sorry, Michael, I don't understand you about:

"see your p.b.a for my idea what happens here."

I keep testing with rotate.

Regards.


Post a reply to this message

From: MichaelJF
Subject: Re: How to fix texture to moving part
Date: 9 Oct 2013 02:20:01
Message: <web.5254f4805b3e3e64b47623b00@news.povray.org>
"Janc" <jan### [at] telefonicanet> wrote:
> "MichaelJF" <mi-### [at] t-onlinede> wrote:
> > "Janc" <jan### [at] telefonicanet> wrote:
> >  Hi Janc,
> >
> > see your p.b.a for my idea what happens here.
> >
> > Best regards,
> > Michael
>
> I'm sorry, Michael, I don't understand you about:
>
> "see your p.b.a for my idea what happens here."
>
> I keep testing with rotate.
>
> Regards.

Sorry,

I meant your p.b.a.-thread where you posted your animation.

Best regards,
Michael


Post a reply to this message

From: MichaelJF
Subject: Re: How to fix texture to moving part
Date: 9 Oct 2013 02:20:02
Message: <web.5254f5365b3e3e64b47623b00@news.povray.org>
"Janc" <jan### [at] telefonicanet> wrote:
> "MichaelJF" <mi-### [at] t-onlinede> wrote:
> > "Janc" <jan### [at] telefonicanet> wrote:
> >  Hi Janc,
> >
> > see your p.b.a for my idea what happens here.
> >
> > Best regards,
> > Michael
>
> I'm sorry, Michael, I don't understand you about:
>
> "see your p.b.a for my idea what happens here."
>
> I keep testing with rotate.
>
> Regards.

Sometimes I'm stupid: p.b.a. = povray-binary-animation. We often use
abreviations like this for the different sections of the newsgroups. Other
examples p.b.i. (povray binary Images) p.o.t. (povray off Topic) and so on.


Post a reply to this message

Goto Latest 10 Messages Next 1 Messages >>>

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