POV-Ray : Newsgroups : povray.binaries.images : Woven Cloth Texture Server Time
31 Jul 2024 12:21:58 EDT (-0400)
  Woven Cloth Texture (Message 11 to 20 of 29)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 9 Messages >>>
From: Dave Blandston
Subject: Re: Woven Cloth Texture
Date: 15 Feb 2010 06:55:00
Message: <web.4b79354aadaa4c5ecba3fb0f0@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
>
>   I think it would be even more useful if it had a 'normal' block as
> well. That way it would interact with lighting, giving it depth.

My original goal was to make a normal to use for cloth, but I couldn't get that
to work and I had to settle for a texture. It would be great if this texture
could be made into a normal though.

Regards,
Dave Blandston


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Woven Cloth Texture
Date: 16 Feb 2010 18:46:08
Message: <4b7b2e40$1@news.povray.org>
Dave Blandston wrote:

> My original goal was to make a normal to use for cloth, but I couldn't get that
> to work and I had to settle for a texture. It would be great if this texture
> could be made into a normal though.

I redesigned this as a pigment by replacing the layered texture
with a pigment_map. Therefore, you can now define a pigment function
and use that as normal pattern. Nice texture BTW ;)

#local ClothScale = .5;
#local ThreadWidth = .2;
#local EdgeWidth = .08;

#declare P_Cloth = pigment
{
   gradient x
   color_map
   {
     [0 color Black]
     [.1 color Black]
     [.5 color White * 4]
     [.9 color Black]
     [1 color Black]
   }
}

#declare P_Cloth = pigment
{
   gradient y
   pigment_map
   {
     [0 color Black]
     [.5 - ThreadWidth / 2 - EdgeWidth color Black]
     [.5 - ThreadWidth / 2 P_Cloth]
     [.5 + ThreadWidth / 2 P_Cloth]
     [.5 + ThreadWidth / 2 + EdgeWidth color Black]
     [1 color Black]
   }
}

#declare P_Cloth = pigment
{
   average
   pigment_map
   {
     [1 P_Cloth]
     [1 P_Cloth translate <.5, .5, 0>]
     [1 P_Cloth rotate 90 * z translate <.5, 0, 0>]
     [1 P_Cloth rotate 90 * z translate <0, .5, 0>]
   }
   scale <ClothScale, ClothScale, 1>
}

#declare f_cloth = function {pigment {P_Cloth}}

#declare N_Cloth = normal {function {f_cloth(x,y,z).red}}


Post a reply to this message

From: Thomas de Groot
Subject: Re: Woven Cloth Texture
Date: 17 Feb 2010 03:48:08
Message: <4b7bad48@news.povray.org>
"Christian Froeschlin" <chr### [at] chrfrde> schreef in bericht 
news:4b7b2e40$1@news.povray.org...
> I redesigned this as a pigment by replacing the layered texture
> with a pigment_map. Therefore, you can now define a pigment function
> and use that as normal pattern. Nice texture BTW ;)

Christian, you rule!  :-)

Thomas


Post a reply to this message

From: Thomas de Groot
Subject: Re: Woven Cloth Texture
Date: 17 Feb 2010 04:27:08
Message: <4b7bb66c@news.povray.org>
Forgive my confusion/ignorance, but I see the same pigment name P_Cloth 
declared three times successively and still the result is correct. How is 
this possible without parse confusion?

Thomas


Post a reply to this message

From: Paolo Gibellini
Subject: Re: Woven Cloth Texture
Date: 17 Feb 2010 04:42:47
Message: <4b7bba17@news.povray.org>
>Christian Froeschlin  on date 17/02/2010 00:48 wrote:
>
> 
> I redesigned this as a pigment by replacing the layered texture
> with a pigment_map. Therefore, you can now define a pigment function
> and use that as normal pattern. Nice texture BTW ;)
>
Very cool!
;-)
Paolo


Post a reply to this message

From: Ive
Subject: Re: Woven Cloth Texture
Date: 17 Feb 2010 05:08:51
Message: <4b7bc033$1@news.povray.org>
On 17.02.2010 00:48, Christian Froeschlin wrote:
> I redesigned this as a pigment by replacing the layered texture
> with a pigment_map. Therefore, you can now define a pigment function
> and use that as normal pattern. Nice texture BTW ;)
>
> #local ClothScale = .5;
> #local ThreadWidth = .2;
> #local EdgeWidth = .08;
>
> #declare P_Cloth = pigment
> {
> gradient x
> color_map
> {
> [0 color Black]
> [.1 color Black]
> [.5 color White * 4]
> [.9 color Black]
> [1 color Black]
> }
> }
>
> #declare P_Cloth = pigment
> {
> gradient y
> pigment_map
> {
> [0 color Black]
> [.5 - ThreadWidth / 2 - EdgeWidth color Black]
> [.5 - ThreadWidth / 2 P_Cloth]
> [.5 + ThreadWidth / 2 P_Cloth]
> [.5 + ThreadWidth / 2 + EdgeWidth color Black]
> [1 color Black]
> }
> }
>
> #declare P_Cloth = pigment
> {
> average
> pigment_map
> {
> [1 P_Cloth]
> [1 P_Cloth translate <.5, .5, 0>]
> [1 P_Cloth rotate 90 * z translate <.5, 0, 0>]
> [1 P_Cloth rotate 90 * z translate <0, .5, 0>]
> }
> scale <ClothScale, ClothScale, 1>
> }
>
> #declare f_cloth = function {pigment {P_Cloth}}
>
> #declare N_Cloth = normal {function {f_cloth(x,y,z).red}}
>

sorry, but this will not work (as expected) as the function you feed 
into the normal statement needs to evaluate the *slope* and not the 
*height* at a specific point in 3d space.

-Ive


Post a reply to this message

From: Thomas de Groot
Subject: Re: Woven Cloth Texture
Date: 17 Feb 2010 08:23:30
Message: <4b7bedd2@news.povray.org>
"Ive" <"ive### [at] lilysoftorg"> schreef in bericht 
news:4b7bc033$1@news.povray.org...

> sorry, but this will not work (as expected) as the function you feed
> into the normal statement needs to evaluate the *slope* and not the
> *height* at a specific point in 3d space.
>

???
The image below only uses Christian's normal. I don't see a problem there 
(except that the object is ill chosen of course).

Thomas


Post a reply to this message


Attachments:
Download 'DB_WovenCloth.png' (137 KB)

Preview of image 'DB_WovenCloth.png'
DB_WovenCloth.png


 

From: Dave Blandston
Subject: Re: Woven Cloth Texture
Date: 17 Feb 2010 08:50:01
Message: <web.4b7bf3a8adaa4c5ecba3fb0f0@news.povray.org>
"Thomas de Groot" <tDOTdegroot@interDOTnlANOTHERDOTnet> wrote:
> Forgive my confusion/ignorance, but I see the same pigment name P_Cloth
> declared three times successively and still the result is correct. How is
> this possible without parse confusion?
>
> Thomas

Here's a simple computer programming example to show how and why this works:

   x = 1;
   .
   .
   .
   x = x + 1;

In this case, the variable "x" is assigned a value (1), then later it's assigned
a new value based on the old value. This works because when the new value is
assigned, a temporary copy is made of the old value, manipulated (in this case 1
is added), then re-stored in the original location and becomes "x" again.
"P_Cloth" is just a more complex variable that can be manipulated like any
simpler variable. The restriction would be that once "P_Cloth" is defined as a
pigment it must remain a pigment.

This can be a useful technique to make your scenes more readable, and also more
efficient by not leaving intermediate variables laying around.

Regards,
Dave Blandston


Post a reply to this message

From: Dave Blandston
Subject: Re: Woven Cloth Texture
Date: 17 Feb 2010 08:55:01
Message: <web.4b7bf49aadaa4c5ecba3fb0f0@news.povray.org>
Christian Froeschlin <chr### [at] chrfrde> wrote:

> I redesigned this as a pigment by replacing the layered texture
> with a pigment_map. Therefore, you can now define a pigment function
> and use that as normal pattern. Nice texture BTW ;)

Wow, that's fantastic! Thanks for taking the time to do that an post it!

Regards,
Dave Blandston


Post a reply to this message

From: Ive
Subject: Re: Woven Cloth Texture
Date: 17 Feb 2010 14:49:16
Message: <4b7c483c$1@news.povray.org>
On 17.02.2010 14:23, Thomas de Groot wrote:
> ???
> The image below only uses Christian's normal. I don't see a problem there
> (except that the object is ill chosen of course).
>

Oops. A few years ago I did a few experiments in creating lace patterns 
for poser lady dresses and it did not work this way. So either my memory 
is tricking me (I'm gettin' older and older) or something within 
POV-Ray's normal calculation has changed since then. I will investigate...

-Ive


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 9 Messages >>>

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