  | 
  | 
 | 
  | 
 | 
  | 
 |   | 
 |   | 
 | 
  | 
 | 
  | 
 |   | 
 |   | 
 | 
  | 
On 13/02/2010 4:44 AM, Anthony D. Baye wrote:
> Most Excellent.  I tried to come up with something similar a while back,
> but failed. This works great.
ha! a little 9. that's very cute.
 
 Post a reply to this message 
 | 
  | 
 |   | 
 |   | 
 | 
  | 
 | 
  | 
 |   | 
 |   | 
 | 
  | 
Warp <war### [at] tag povray org> 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 
 | 
  | 
 |   | 
 |   | 
 | 
  | 
 | 
  | 
 |   | 
 |   | 
 | 
  | 
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 
 | 
  | 
 |   | 
 |   | 
 | 
  | 
 | 
  | 
 |   | 
 |   | 
 | 
  | 
"Christian Froeschlin" <chr### [at] chrfr de> 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 
 | 
  | 
 |   | 
 |   | 
 | 
  | 
 | 
  | 
 |   | 
 |   | 
 | 
  | 
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 
 | 
  | 
 |   | 
 |   | 
 | 
  | 
 | 
  | 
 |   | 
 |   | 
 | 
  | 
>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 
 | 
  | 
 |   | 
 |   | 
 | 
  | 
 | 
  | 
 |   | 
 |   | 
 | 
  | 
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 
 | 
  | 
 |   | 
 |   | 
 | 
  | 
 | 
  | 
 |   | 
 |   | 
 | 
  | 
"Ive" <"ive### [at] lilysoft org"> 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'
   
   
 | 
  | 
 |   | 
 |   | 
 | 
  | 
 | 
  | 
 |   | 
 |   | 
 | 
  | 
"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 
 | 
  | 
 |   | 
 |   | 
 | 
  | 
 | 
  | 
 |   | 
 |   | 
 | 
  | 
Christian Froeschlin <chr### [at] chrfr de> 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 
 | 
  | 
 |   | 
 |   | 
 | 
  | 
 | 
  | 
 |   |