POV-Ray : Newsgroups : povray.binaries.images : Woven Cloth Texture : Re: Woven Cloth Texture Server Time
31 Jul 2024 14:28:42 EDT (-0400)
  Re: Woven Cloth Texture  
From: Christian Froeschlin
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

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