POV-Ray : Newsgroups : povray.programming : colour and texture Server Time
18 Apr 2024 02:38:39 EDT (-0400)
  colour and texture (Message 1 to 9 of 9)  
From: The FD
Subject: colour and texture
Date: 8 Dec 2008 07:55:01
Message: <web.493d185b4236b443d3bf6faf0@news.povray.org>
Hello,

I am a beginner in povray. For instance I have a problem of texture and color
for very simple objects that I cannot handle with. Here is how it goes:

The square is made out of 4 sphere_sweep for the corners and cylinders for the
straight parts. The top and bottom cylinders are made out of 20 short
successive cylinders to deal with the color of each separately. Everywhere I am
using the rgbt tool to display the colors, however the 4 sphere_sweep look whity
and faded compared to the rest of the figure. Anyone has an idea how to make the
sphere_sweep look like the cylinders? (Maybe I am not using the clipped_by thing
accurately)

here is the code:


  #include "colors.inc"
  #include "textures.inc"
  #include "vaisseaux.inc"


  background { color Cyan }

light_source { <0, 15, -15> color White}

  camera {
    location <0, 0, -40>
    look_at  <0, 0, 0>
  }

  plane {<0,0,1>, 10
        pigment {color Grey}
        }

//cap(xcap,ycap,zcap,Size,r,g,b,xrot,yrot,zrot)
#local i=0;
#while (i<20) //to manage the color of the 20 cylinders
    #local r=i/20;
    #local g=0;
    #local b=1-i/20;
    cap(-10+i,10,0,2,r,g,b,0,0,0)
    #local i=i+1;
#end

//anglcap(xpos,ypos,zpos,Size,xrot,yrot,zrot,r,g,b)
anglcap(10,10,0,2,0,0,0,1,0,0)

cylinder{<10+2,10-2,0><10+2,-10,0> 2 open
    texture{pigment{colour rgbt<1,0,0,0.7>}}no_shadow}

anglcap(12,-10,0,2,0,0,270,1,0,0)

#local i=0;
#while (i<20)
    #local r=i/20;
    #local g=0;
    #local b=1-i/20;
    cap(-10+i,-12,0,2,r,g,b,0,0,0)
    #local i=i+1;
#end

anglcap(-10,-12,0,2,0,0,180,0,0,1)

cylinder{<-10-2,-10,0><-10-2,10-2,0> 2 open
    texture{pigment{colour rgbt<0,0,1,0.7>}}no_shadow}

anglcap(-12,8,0,2,0,0,90,0,0,1)

**************************************************************************
**************************************************************************
Here comes the vaisseaux.inc file:

//vaisseaux.inc

#macro cap(xcap,ycap,zcap,Size,r,g,b,xrot,yrot,zrot)

    cylinder{<xcap,ycap,zcap><xcap+1,ycap,zcap> Size open
        texture{pigment{colour rgbt<r,g,b,0.7>}} no_shadow
        rotate<xrot,yrot,zrot>}

#end

#macro anglcap(xpos,ypos,zpos,Size,xrot,yrot,zrot,r,g,b)
        sphere_sweep{ linear_spline 3,<0,0,0>,Size <2,0,0>,Size <2,-2,0>,Size
            texture{pigment{colour rgbt<r,g,b,0.7>}}
            clipped_by{box{<0,-2,0><10,10,-20>}}no_shadow
            rotate<xrot,yrot,zrot>
            translate<xpos,ypos,zpos>}
#end

*****************************************************************************
*****************************************************************************

I apologize for my poor English
Any advice is welcomed

The_FD


Post a reply to this message

From: clipka
Subject: Re: colour and texture
Date: 8 Dec 2008 08:10:00
Message: <web.493d1c37a54ca8e0540144e00@news.povray.org>
"The_FD" <nicolas dot bourdillon at gmail dot com> wrote:
> Hello,
>
> I am a beginner in povray. For instance I have a problem of texture and color
> for very simple objects that I cannot handle with. Here is how it goes:

I didn't have time to go into the details of your code, but obviously you're
using transparency with different colors, and from your description I gather
that your objects probably touch and intersect.

This effectively makes your scene a CSG scene; but doing CSG with transparent
objects of *different* colors is not really what I'd call a beginner thing.

Try pulling all the components of your scene apart (far enough so they don't
touch anymore), and see if the problem with the washed-out colors still
persists. If not, it is a CSG related effect. In that case, encapsulating all
your single elements in a "merge" object could help.


Post a reply to this message

From: The FD
Subject: Re: colour and texture
Date: 8 Dec 2008 08:50:00
Message: <web.493d2491a54ca8e0d3bf6faf0@news.povray.org>
"clipka" <nomail@nomail> wrote:
> Try pulling all the components of your scene apart (far enough so they don't
> touch anymore), and see if the problem with the washed-out colors still
> persists. If not, it is a CSG related effect. In that case, encapsulating all
> your single elements in a "merge" object could help.

Thank you for the quick reply clipka

From your advice :  when I only display the form from the "anglcap" macro and
when it is the only object in the scene, the problem is still here. So I have
reduced the code to its smaller part possible that encompasses the problem. (and
yes my objects do touch each others and are somehow connected through invisible
parts)

Part of the code that gives the whity undesired color:

***********************************************************************
***********************************************************************
  #include "colors.inc"   // Standard Color definitions
  #include "textures.inc"   // Standard Texture definitions
  #include "vaisseaux.inc"

  background { color Cyan }

light_source { <0, 15, -15> color White}

  camera {
    location <0, 0, -40>
    look_at  <0, 0, 0>
  }

  plane {<0,0,1>, 10
        pigment {color Grey}
        }

//anglcap(xpos,ypos,zpos,Size,xrot,yrot,zrot,r,g,b)
anglcap(10,10,0,2,0,0,0,1,0,0)

************************************************************************
************************************************************************
also reduced vaisseaux.inc from above:

//vaisseaux.inc

#macro anglcap(xpos,ypos,zpos,Size,xrot,yrot,zrot,r,g,b)
        sphere_sweep{ linear_spline 3,<0,0,0>,Size <2,0,0>,Size <2,-2,0>,Size
            texture{pigment{colour rgbt<r,g,b,0.7>}}
            clipped_by{box{<0,-2,0><10,10,-20>}}no_shadow
            rotate<xrot,yrot,zrot>
            translate<xpos,ypos,zpos>}
#end

************************************************************************
************************************************************************

I'll check what comes out of the merge thing.
again thank you
and sorry for being a beginner with a non-beginner problem :p


Post a reply to this message

From: Roman Reiner
Subject: Re: colour and texture
Date: 8 Dec 2008 08:55:00
Message: <web.493d26caa54ca8e08505d0040@news.povray.org>
"The_FD" <nicolas dot bourdillon at gmail dot com> wrote:
>(Maybe I am not using the clipped_by thing
> accurately)

That seems indeed to be the case. I rendered it from another perspective with
the clipped_by boxes added in transparent yellow:

http://img384.imageshack.us/my.php?image=test2cx0.jpg

obviously not what you intended.
i'll leave the correction of the box dimensions to you. as an exercise so to say
:D

Regards Roman


Post a reply to this message

From: The FD
Subject: Re: colour and texture
Date: 8 Dec 2008 09:05:01
Message: <web.493d28c0a54ca8e0d3bf6faf0@news.povray.org>
"Roman Reiner" <lim### [at] gmxde> wrote:
> That seems indeed to be the case. I rendered it from another perspective with
> the clipped_by boxes added in transparent yellow:

Got it:
clipped_by{box{<0,-2,0><10,10,-20>}} should be substituted by
clipped_by{box{<0,-2,2><10,10,-20>}} and that does it.

Merci Roman!


Post a reply to this message

From: Roman Reiner
Subject: Re: colour and texture
Date: 8 Dec 2008 09:05:01
Message: <web.493d28eaa54ca8e08505d0040@news.povray.org>
btw, the way you color the whole thing (the vertical cylinders in particular) is
in this case unnecessarily circuitous. a simple gradient applied to the whole
union is the faster and simpler solution.

Regards Roman


Post a reply to this message

From: Roman Reiner
Subject: Re: colour and texture
Date: 8 Dec 2008 10:45:00
Message: <web.493d4051a54ca8e08505d0040@news.povray.org>
"Roman Reiner" <lim### [at] gmxde> wrote:
> btw, the way you color the whole thing (the vertical cylinders in particular) is
> in this case unnecessarily circuitous. a simple gradient applied to the whole
> union is the faster and simpler solution.
>
> Regards Roman

Also spheres as opposed to sphere sweeps are fine too.
There you go:

***************************************************************
#include "colors.inc"
#include "textures.inc"

background { color Cyan }

light_source { <0, 15, -15> color White}

camera {
  location <0, 0, -40>
  look_at  <0, 0, 0>
}

plane {<0,0,1>, 10
  pigment {color Grey}
}

merge {
  cylinder { < 12, 10,0>,< 12,-12,0> 1.95 }
  cylinder { <-12, 10,0>,<-12,-12,0> 1.95 }
  cylinder { <-12, 10,0>,< 12, 10,0> 1.95 }
  cylinder { <-12,-12,0>,< 12,-12,0> 1.95 }
  sphere { <-12, 10,0>, 1.95 }
  sphere { < 12, 10,0>, 1.95 }
  sphere { <-12,-12,0>, 1.95 }
  sphere { < 12,-12,0>, 1.95 }
  pigment {
    gradient x
    color_map {
      [0.00 rgbt <0,0,1,0.7>]
      [1.00 rgbt <1,0,0,0.7>]
    }
    scale 28
    translate <-14,0,0>
  }
  no_shadow
}
*******************************************************

Not sure if that's wanted, but when doing this i also noticed your object isn't
centered at <0,0,0> (my version aligns with yours atm).

If you have questions concerning my version please go ahead!
Happy coding!
Regards Roman


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: colour and texture
Date: 8 Dec 2008 11:01:25
Message: <493d44d5@news.povray.org>
"The_FD" <nicolas dot bourdillon at gmail dot com> wrote:
> I am a beginner in povray. For instance I have a problem of texture and
> color for very simple objects that I cannot handle with. Here is how it
> goes:

This is the wrong group for this question.  This group is for discussion of
the POV-Ray source code, not general questions of using POV-Ray.  Questions
about using POV-Ray should be asked/made in either povray.general or
povray.newusers.

-- saying it before Thorsten has to :)


Post a reply to this message

From: The FD
Subject: Re: colour and texture
Date: 8 Dec 2008 11:30:00
Message: <web.493d4a98a54ca8e0d3bf6faf0@news.povray.org>
Nicolas Alvarez <nic### [at] gmailcom> wrote:
> This is the wrong group for this question.  This group is for discussion of
> the POV-Ray source code, not general questions of using POV-Ray.  Questions
> about using POV-Ray should be asked/made in either povray.general or
> povray.newusers.


I am sorry for misposting, I will post elswhere next time I have to.

Thank you Roman for your tips, indeed the figure you built is what I wanted as a
basic. Now this going to be part of an animation and the color of the top and
bottom cylinders may vary from the left end to the right end in a "non-linear
manner", which is why I may need to act directly on given short cylinder.
Moreover the top cylinder and the bottom one way not be reciprocal.
I will probably mix up your version and mine, thank you for this.

Anyway I guess I have a lot more to do with povray before I get to the final
version of my thing. You will probably hear again from me before long... in the
right forum next time hopefully.


Post a reply to this message

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