POV-Ray : Newsgroups : povray.advanced-users : Pigment along a sphere_sweep Server Time
8 Jul 2024 18:38:25 EDT (-0400)
  Pigment along a sphere_sweep (Message 1 to 8 of 8)  
From: Florian Brucker
Subject: Pigment along a sphere_sweep
Date: 18 Feb 2007 11:59:07
Message: <45d885db$1@news.povray.org>
Hi!

Is it possible to color a sphere_sweep along the spline? I.e. with a
gradient that follows the spline instead of fixed direction. As the
spline twists in all directions I can't fake it by using a standard
gradient. I tried to transform the spline coordinates to something more
accessible, but that fails because one has no possibility to know how
far on the spline a given point (x,y,z) is. But perhaps I'm missing
something :)


Regards,
Florian


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Pigment along a sphere_sweep
Date: 18 Feb 2007 15:53:23
Message: <45d8bcc3@news.povray.org>
Florian Brucker wrote:

> Is it possible to color a sphere_sweep along the spline? I.e. with a
> gradient that follows the spline instead of fixed direction. As the
> spline twists in all directions I can't fake it by using a standard
> gradient. I tried to transform the spline coordinates to something more
> accessible, but that fails because one has no possibility to know how
> far on the spline a given point (x,y,z) is. But perhaps I'm missing
> something :)

I don't think there is an easy solution for this. Actually you'd
like to have uv_mapping which does not seem to be supported by
the sphere_sweep object.

Possible workarounds include:

o Split your sweep into multiple shorter sweeps, for each of which a
   linear gradient may be a good enough approximation for texturing

o Switch to an object which supports uv_mapping such as "parametric"

o Implement uv_mapping for sphere_sweep and publish a patch ;)


Post a reply to this message

From: Tim Attwood
Subject: Re: Pigment along a sphere_sweep
Date: 18 Feb 2007 16:29:07
Message: <45d8c523$1@news.povray.org>
> ... I tried to transform the spline coordinates to something more
> accessible, but that fails because one has no possibility to know how
> far on the spline a given point (x,y,z) is.

This macro can estimate the distance between points on a spline
by summing the linear distance between a number of sub-points.

#macro Len_Spline(Espl begin_at stop_at num)
   #local c = 1/num;
   #local V1 = Espl(begin_at);
   #local result = 0;
   #while (c <= 1)
      #local V2 = Espl( c*(stop_at - begin_at) + begin_at);
      #local result = result + vlength(V2-V1);
      #local V1 = V2;
      #local c = c + 1/num;
   #end
   (result)
#end

#declare sample = Len_Spline(ABC_spl, 0, 0.5, 2000);

You might also want to look at the MSM macro in
Ingo's meshmaker stuf. http://members.home.nl/seedseven/


Post a reply to this message

From: Mark Birch
Subject: Re: Pigment along a sphere_sweep
Date: 20 Feb 2007 20:20:01
Message: <web.45db9d5f564aa52a4daddc090@news.povray.org>
Florian Brucker <tor### [at] torfboldcom> wrote:
> Hi!
>
> Is it possible to color a sphere_sweep along the spline? I.e. with a
> gradient that follows the spline instead of fixed direction. As the
> spline twists in all directions I can't fake it by using a standard
> gradient. I tried to transform the spline coordinates to something more
> accessible, but that fails because one has no possibility to know how
> far on the spline a given point (x,y,z) is. But perhaps I'm missing
> something :)
>
>
> Regards,
> Florian

I wrote a macro to generate a mesh2 object based on a spline path.
It doesn't allow for varying radius along the sweep, and the ends aren't
capped so it's just a hollow tube (no CSG).  It was written specifically
for doing texture-mapped hoses, so the UV mapping is worked out.  I'll post
it in binaries later.

Another simple method is to build the object with spheres & cylinders, and
apply the pigment individually to each object.

Mark


Post a reply to this message

From: Florian Brucker
Subject: Re: Pigment along a sphere_sweep
Date: 24 Feb 2007 06:19:03
Message: <45e01f27@news.povray.org>
Mark Birch wrote:
> I wrote a macro to generate a mesh2 object based on a spline path.
> It doesn't allow for varying radius along the sweep, and the ends aren't
> capped so it's just a hollow tube (no CSG).  It was written specifically
> for doing texture-mapped hoses, so the UV mapping is worked out.  I'll post
> it in binaries later.

Thanks, I'll see if it solves my problem. But as I'm having lots of
those tubes (around 1000) which are all pretty curvy I'm afraid I might
run into memory problems. We'll see :)

> Another simple method is to build the object with spheres & cylinders, and
> apply the pigment individually to each object.

That's what I'm doing right now, but you need an awful lot of cylinders
to make it look right. And the sweep thingy would be more elgant, too ;)


Regards,
Florian


Post a reply to this message

From: Florian Brucker
Subject: Re: Pigment along a sphere_sweep
Date: 24 Feb 2007 06:20:53
Message: <45e01f95$1@news.povray.org>
Tim Attwood wrote:
>> ... I tried to transform the spline coordinates to something more
>> accessible, but that fails because one has no possibility to know how
>> far on the spline a given point (x,y,z) is.
> 
> This macro can estimate the distance between points on a spline
> by summing the linear distance between a number of sub-points.

Yep, at parse time, that is. Unfortunately I'd need that information at
render time in the pigment function. Perhaps I'll be able to put
something together from it, though. Thanks!


Regards,
Florian


Post a reply to this message

From: Florian Brucker
Subject: Re: Pigment along a sphere_sweep
Date: 24 Feb 2007 06:22:57
Message: <45e02011$1@news.povray.org>
Christian Froeschlin wrote:
> Possible workarounds include:
> 
> o Split your sweep into multiple shorter sweeps, for each of which a
>    linear gradient may be a good enough approximation for texturing

Ah, wouldn't work all too good in my case I'm afraid.

> o Switch to an object which supports uv_mapping such as "parametric"

Is there an object that's slower than parametric? ;) Seriously, the
cylinder/sphere method I'm using now is IMHO better suited (but still
not optimal).

> o Implement uv_mapping for sphere_sweep and publish a patch ;)

Uh, nice idea. Now if I just had any idea about uv mapping :)


Thanks for your tips!
Florian


Post a reply to this message

From: Alain
Subject: Re: Pigment along a sphere_sweep
Date: 24 Feb 2007 11:16:55
Message: <45e064f7$1@news.povray.org>
Florian Brucker nous apporta ses lumieres en ce 24-02-2007 08:41:
> Mark Birch wrote:
>> I wrote a macro to generate a mesh2 object based on a spline path.
>> It doesn't allow for varying radius along the sweep, and the ends aren't
>> capped so it's just a hollow tube (no CSG).  It was written specifically
>> for doing texture-mapped hoses, so the UV mapping is worked out.  I'll post
>> it in binaries later.

> Thanks, I'll see if it solves my problem. But as I'm having lots of
> those tubes (around 1000) which are all pretty curvy I'm afraid I might
> run into memory problems. We'll see :)

>> Another simple method is to build the object with spheres & cylinders, and
>> apply the pigment individually to each object.

> That's what I'm doing right now, but you need an awful lot of cylinders
> to make it look right. And the sweep thingy would be more elgant, too ;)


> Regards,
> Florian
In some cases, you can use sections of torus for the curved parts. It can enable 
you to dramaticaly reduce the number of components that you need.

-- 
Alain
-------------------------------------------------
A day for firm decisions!!!!!  Or is it?


Post a reply to this message

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