POV-Ray : Newsgroups : povray.general : procedural texture as a bump map? Server Time
30 Jul 2024 18:20:34 EDT (-0400)
  procedural texture as a bump map? (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: Dave VanHorn
Subject: procedural texture as a bump map?
Date: 3 Nov 2008 16:45:00
Message: <web.490f6fef945e846aa08ed15e0@news.povray.org>
I thought there was a way to do this, so that my wood would have apparent
surface rippling, but I don't seem to be finding it.  I've done "embossing"
before, where I used a BMP of the text, applied it as a bump map, and then as a
texture, to "paint" the object..

I'd like to be able to turn this:
#declare Floor_Texture = texture { pigment { P_WoodGrain18A color_map {
M_Wood18A }}}
                         texture { pigment { P_WoodGrain12A color_map {
M_Wood18B }}}
                         texture { pigment { P_WoodGrain12B color_map {
M_Wood18B }}
                                 }
into apparent disturbance of the normal so that the wood surface does not appear
to be a perfectly flat surface, up close.


Post a reply to this message

From: Tim Attwood
Subject: Re: procedural texture as a bump map?
Date: 3 Nov 2008 18:05:30
Message: <490f83ba$1@news.povray.org>
"Dave VanHorn" <mic### [at] gmailcom> wrote in message 
news:web.490f6fef945e846aa08ed15e0@news.povray.org...
>
> I thought there was a way to do this, so that my wood would have apparent
> surface rippling, but I don't seem to be finding it.  I've done 
> "embossing"
> before, where I used a BMP of the text, applied it as a bump map, and then 
> as a
> texture, to "paint" the object..
>
> I'd like to be able to turn this:
> #declare Floor_Texture = texture { pigment { P_WoodGrain18A color_map {
> M_Wood18A }}}
>                         texture { pigment { P_WoodGrain12A color_map {
> M_Wood18B }}}
>                         texture { pigment { P_WoodGrain12B color_map {
> M_Wood18B }}
>                                 }
> into apparent disturbance of the normal so that the wood surface does not 
> appear
> to be a perfectly flat surface, up close.

#declare N_WoodGrain12a = normal {
    bozo
    turbulence 0.04
    lambda 2.5
    omega 0.1
    octaves 7
    scale <0.5, 0.05, 0.05>
};

#declare N_WoodGrain12b = normal {
   wood
   turbulence <0.1, 0.04, 1>
   scale <0.15, 0.5, 1>
   rotate x*2
};

#declare N_WoodGrain18a = normal {
    wood
    turbulence 0.02
    octaves 4
    lambda 4
    scale 0.1
    rotate <2, 0, 0>
};

#declare Floor_Texture = material {
   texture { pigment { P_WoodGrain18A color_map {M_Wood18A }}}
   texture { pigment { P_WoodGrain12A color_map {M_Wood18B }}}
   texture { pigment { P_WoodGrain12B color_map {M_Wood18B }}
      normal {
         average
         normal_map {
            [1  N_WoodGrain18a]
            [1  N_WoodGrain12a]
            [1  N_WoodGrain12b]
         }
      }
      finish {Shiny}
   }
};


Post a reply to this message

From: Dave VanHorn
Subject: Re: procedural texture as a bump map?
Date: 3 Nov 2008 19:15:01
Message: <web.490f93deb3807db2a08ed15e0@news.povray.org>
> #declare N_WoodGrain12a = normal {
>     bozo
>     turbulence 0.04
>     lambda 2.5
>     omega 0.1
>     octaves 7
>     scale <0.5, 0.05, 0.05>
> };

Ok, but how did you arrive at that?
I looked through the docs on normal, but didn't see any way to apply the pigment
or texture as a normal.


Post a reply to this message

From: Zeger Knaepen
Subject: Re: procedural texture as a bump map?
Date: 3 Nov 2008 19:44:01
Message: <490f9ad1@news.povray.org>
"Dave VanHorn" <mic### [at] gmailcom> wrote in message 
news:web.490f93deb3807db2a08ed15e0@news.povray.org...
>
>> #declare N_WoodGrain12a = normal {
>>     bozo
>>     turbulence 0.04
>>     lambda 2.5
>>     omega 0.1
>>     octaves 7
>>     scale <0.5, 0.05, 0.05>
>> };
>
> Ok, but how did you arrive at that?
> I looked through the docs on normal, but didn't see any way to apply the 
> pigment
> or texture as a normal.

that's because there isn't.

a pigment defines the color of the surface and has nothing to do with the 
normals of the surface (there are exceptions, eg. when you use the slope 
pattern)
a texture is a combination of (implicitly or explicitly defined) pigment, 
normal and finish, or other textures.

what you should be looking at, is using patterns as a normal.  You might 
also want to look at pigment_pattern.

cu!
-- 
#macro G(b,e)b+(e-b)*C/50#end#macro _(b,e,k,l)#local C=0;#while(C<50)
sphere{G(b,e)+3*z.1pigment{rgb G(k,l)}finish{ambient 1}}#local C=C+1;
#end#end _(y-x,y,x,x+y)_(y,-x-y,x+y,y)_(-x-y,-y,y,y+z)_(-y,y,y+z,x+y)
_(0x+y.5+y/2x)_(0x-y.5+y/2x)            // ZK http://www.povplace.com


Post a reply to this message

From: nemesis
Subject: Re: procedural texture as a bump map?
Date: 3 Nov 2008 19:51:07
Message: <490f9c7b$1@news.povray.org>
Dave VanHorn wrote:
>> #declare N_WoodGrain12a = normal {
>>     bozo
>>     turbulence 0.04
>>     lambda 2.5
>>     omega 0.1
>>     octaves 7
>>     scale <0.5, 0.05, 0.05>
>> };
> 
> Ok, but how did you arrive at that?
> I looked through the docs on normal, but didn't see any way to apply the pigment
> or texture as a normal.

Other than experience and a lot of RTFM, you should read more closely 
and realize there's no such a thing as "any way to apply the pigment or 
texture as a normal", I think you got that wrong.

A normal features a pattern, just like a pigment.  In fact, you can use 
pretty much the same pattern and options for one and the other, the only 
main differences are that pigment can have color_map and normal, a 
bump_size property.


Post a reply to this message

From: Christian Froeschlin
Subject: Re: procedural texture as a bump map?
Date: 4 Nov 2008 04:56:35
Message: <49101c53@news.povray.org>
Zeger Knaepen wrote:

 > "Dave VanHorn" <mic### [at] gmailcom> wrote in message
 >
>>I looked through the docs on normal, but didn't see any way to apply the 
>>pigment or texture as a normal.
 >
> that's because there isn't.

well, as you mentioned yourself, you can use pigment_pattern
to treat the average gray value of the pigment as normal:

texture
{
   pigment {P}
   normal  {pigment_pattern {P}}
}

Or, to use a different channel:

texture
{
   #local f_P = function { pigment {P} };

   pigment {P}
   normal  {function{ f_P(x,y,z).red } }
}

Whether that makes sense probably depends on the pigment ;)


Post a reply to this message

From: Zeger Knaepen
Subject: Re: procedural texture as a bump map?
Date: 4 Nov 2008 05:40:19
Message: <49102693$1@news.povray.org>
"Christian Froeschlin" <chr### [at] chrfrde> wrote in message 
news:49101c53@news.povray.org...
> Zeger Knaepen wrote:
>
> > "Dave VanHorn" <mic### [at] gmailcom> wrote in message
> >
>>>I looked through the docs on normal, but didn't see any way to apply the 
>>>pigment or texture as a normal.
> >
>> that's because there isn't.
>
> well, as you mentioned yourself, you can use pigment_pattern
> to treat the average gray value of the pigment as normal:

yes, but it's no longer a pigment then, it's a pattern

cu!
-- 
#macro G(b,e)b+(e-b)*C/50#end#macro _(b,e,k,l)#local C=0;#while(C<50)
sphere{G(b,e)+3*z.1pigment{rgb G(k,l)}finish{ambient 1}}#local C=C+1;
#end#end _(y-x,y,x,x+y)_(y,-x-y,x+y,y)_(-x-y,-y,y,y+z)_(-y,y,y+z,x+y)
_(0x+y.5+y/2x)_(0x-y.5+y/2x)            // ZK http://www.povplace.com


Post a reply to this message

From: Tim Attwood
Subject: Re: procedural texture as a bump map?
Date: 5 Nov 2008 05:41:10
Message: <49117846$1@news.povray.org>
>> #declare N_WoodGrain12a = normal {
>>     bozo
>>     turbulence 0.04
>>     lambda 2.5
>>     omega 0.1
>>     octaves 7
>>     scale <0.5, 0.05, 0.05>
>> };
>
> Ok, but how did you arrive at that?
> I looked through the docs on normal, but didn't see any way to apply the 
> pigment
> or texture as a normal.

It's just the pattern from the P_WoodGrain12a pigment,
modified to be a normal, you can look it up in woods.inc,
that's in the POV/include directory.

The normal patterns look best if they match the color patterns,
if you dislike the resulting normal you can tweak the weighting
of the average.

The next step up in realism is to switch to isosurfaces.
http://www.imagico.de/pov/iw/docu03.html


Post a reply to this message

From: Dave VanHorn
Subject: Re: procedural texture as a bump map?
Date: 7 Nov 2008 09:50:00
Message: <web.491454efb3807db2a08ed15e0@news.povray.org>
> It's just the pattern from the P_WoodGrain12a pigment,
> modified to be a normal, you can look it up in woods.inc,
> that's in the POV/include directory.


Ok, that worked great!  I had to distort the patterns a bit to get the grain the
way I wanted it, but it worked nicely.

I made a floor of boards,

#declare Floor = object { union { object { Board1  translate <-15, 0, 0>}
                                  object { Board2  translate <-12, 0, 0>}
                                  object { Board3  translate < -9, 0, 0>}
                                  object { Board4  translate < -6, 0, 0>}
                                  object { Board5  translate < -3, 0, 0>}
                                  object { Board6  translate <  0, 0, 0>}
                                  object { Board7  translate <  3, 0, 0>}
                                  object { Board8  translate <  6, 0, 0>}
                                  object { Board9  translate <  9, 0, 0>}
                                  object { Board10 translate < 12, 0, 0>}
                                  object { Board11 translate < 15, 0, 0>}
                                }
                          scale <0.5, 1, 1>
                        }

Each board has the same texture, but slid back and forth so that they don't look
like "clones".

#declare Board1 = object { Board
                           material { Floor_Texture
                                      translate <1, 0, 10>
                                    }
                         }


The actual board is pretty simple, I position them at 3 unit intervals, so they
are 2.9 wide, which gives a fair looking gap between.

#declare Board = object { box { <-0.5, -0.5, -0.5>  // one corner position <X1
Y1 Z1>
                                < 0.5,  0.5,  0.5>  // other corner position <X2
Y2 Z2>
                                scale <2.95, 1.0, 100.0> //2.9" wide, 100" long,
1" thick
                                translate <0, -0.5, 0> //Move the top back down
to 0,0,0
                              }
                        }


And here's how the texture ended up.

#declare Floor_Texture = material { texture { pigment { P_WoodGrain18A color_map
{M_Wood18A }}}
                                    texture { pigment { P_WoodGrain12A color_map
{M_Wood18B }}}
                                    texture { pigment { P_WoodGrain12B color_map
{M_Wood18B }}
                                              normal  { average normal_map {
[0.5  N_WoodGrain18a]

[0.5  N_WoodGrain12a]

[0.5  N_WoodGrain12b]
                                                                           }
                                                      }
                                              finish {reflection 0.05}
                                            }
                                    scale <0.5, 1.0, 2.0> // stretch and
compress for finer "grain"
                                  }


Post a reply to this message

From: Dan Connelly
Subject: Re: procedural texture as a bump map?
Date: 7 Nov 2008 11:18:09
Message: <49146a41$1@news.povray.org>
Dave VanHorn wrote:

> I made a floor of boards,
> 
> #declare Floor = object { union { object { Board1  translate <-15, 0, 0>}
>                                   object { Board2  translate <-12, 0, 0>}
>                                   object { Board3  translate < -9, 0, 0>}
>                                   object { Board4  translate < -6, 0, 0>}
>                                   object { Board5  translate < -3, 0, 0>}
>                                   object { Board6  translate <  0, 0, 0>}
>                                   object { Board7  translate <  3, 0, 0>}
>                                   object { Board8  translate <  6, 0, 0>}
>                                   object { Board9  translate <  9, 0, 0>}
>                                   object { Board10 translate < 12, 0, 0>}
>                                   object { Board11 translate < 15, 0, 0>}
>                                 }
>                           scale <0.5, 1, 1>
>                         }
> 
> Each board has the same texture, but slid back and forth so that they don't look
> like "clones".


You can also use a repeat warp to get the same effect on a single floor object.

Nice example with a brick wall:
http://www.shipbrook.com/jeff/raytrace/bricks.html


Post a reply to this message

Goto Latest 10 Messages Next 1 Messages >>>

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