POV-Ray : Newsgroups : povray.general : Can't rotate texture? Server Time
3 Aug 2024 04:16:29 EDT (-0400)
  Can't rotate texture? (Message 1 to 3 of 3)  
From: gonzo
Subject: Can't rotate texture?
Date: 24 May 2004 03:49:32
Message: <40b1a90c$1@news.povray.org>
I created a texture to put lighter edges on an object using the slope
pattern. Applied the texture at the origin, but when I rotate the object
into position the texture doesn't rotate with it. Can't create the texture
already rotated because I will have many instances of the object in
different positions.

Is this normal behavior for slope pattern?  I thought that once applied a
texture transforms with the object, no?

Here's a sample scene, how do I make this work?

// slope pattern sample
global_settings{
 assumed_gamma 1
}

#declare Ft=1;
#declare In=Ft/12;

camera {
    location <-3,2.5,-3.5>
    look_at <0,.5,0>
    angle 60
}

light_source { <-5,15,-15> rgb 1.35 }
light_source { <-10,8,-5> rgb 1.35 }
background { rgb <.5,.6,.7> }

#declare T_Dark_Lite = texture {
    pigment {
        slope -y
        pigment_map {
            [0.00 rgb .15 ]
            [0.20 rgb .95 ]
            [0.80 rgb .95 ]
            [1.00 rgb .15 ]
        }
    }
    finish { ambient 0 diffuse .55 phong .7 phong_size 75 metallic 1 }
}

#declare W_Rad = 1.55*Ft;
#declare C_Rad = W_Rad*.65;
#declare L_Rad = .85*In;
#declare W_Wid = 2.5*In;

#declare Wheel = difference {
    cylinder { 0 <0,W_Wid,0> W_Rad }
    torus { C_Rad C_Rad*.425 scale <1,.15,1> translate y*W_Wid }
    torus { W_Rad L_Rad scale <1,2.35,1> translate y*W_Wid }
    texture { T_Dark_Lite }
}

object { Wheel  // as is, texture looks fine
     //rotate -x*90 // after rotate, texture is wrong
}
// end slope pattern sample

Thanks, RG


Post a reply to this message

From: Vincent LE CHEVALIER
Subject: Re: Can't rotate texture?
Date: 24 May 2004 06:05:54
Message: <40b1c902$1@news.povray.org>
gonzo wrote:
> I created a texture to put lighter edges on an object using the slope
> pattern. Applied the texture at the origin, but when I rotate the object
> into position the texture doesn't rotate with it. Can't create the texture
> already rotated because I will have many instances of the object in
> different positions.
> 
> Is this normal behavior for slope pattern?  I thought that once applied a
> texture transforms with the object, no?
> 

I think the slope pattern is indeed rotated, but it does not produce the 
effect you expected. No matter the transform applied to it, slope always 
compute the value returned with the dot product of the object's normal 
and the direction specified. The problem is that the slope's direction 
vector does not get transformed. And thus the color repartition after 
the transformation does change. This is what is needed most of the time, 
when you use slope to mimic a layer deposed on the object, such as snow 
on heightfield,...
Even if you rotate the texture at its creation, the results will be the 
same.
The only way I can think of, to get the effect you want, would be to 
turn your whole texture statement into a macro, with the direction of 
the slope as an argument. Then for each object, you could pass a 
different direction to this macro, depending on the object's transform.
I have not tested it though, so I cannot assure you it works fine...

Hope this will help

-- 
Vincent


Post a reply to this message

From: gonzo
Subject: Re: Can't rotate texture?
Date: 24 May 2004 16:50:00
Message: <web.40b25fbab3392ae9a0c272b50@news.povray.org>
Vincent LE CHEVALIER <lec### [at] ctiecpfr> wrote:

> The only way I can think of, to get the effect you want, would be to
> turn your whole texture statement into a macro, with the direction of
> the slope as an argument. Then for each object, you could pass a
> different direction to this macro, depending on the object's transform.
> I have not tested it though, so I cannot assure you it works fine...
>

Thanks for the reply. After further experimentation, I think you're right,
the texture rotates but the slope vector doesn't change.

I had also thought of doing it as a macro, but by my understanding of how
textures are stored, that would essentially mean creating a new texture
definition for every object.  As the actual texture I'm using is a lot more
complex than the one in the sample, and since the object is a wheel for a
railroad car, by the time I build a 60 car train I'll be out of memory.

Well, on to plan b...

RG


Post a reply to this message

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