POV-Ray : Newsgroups : povray.binaries.images : Wood grain Server Time
21 Jul 2024 13:42:08 EDT (-0400)
  Wood grain (Message 6 to 15 of 15)  
<<< Previous 5 Messages Goto Initial 10 Messages
From: ingo
Subject: Re: Wood grain
Date: 29 Apr 2023 02:10:00
Message: <web.644cb49e6808bc7717bac71e8ffb8ce3@news.povray.org>
"Chris R" <car### [at] comcastnet> wrote:
> Maybe this is an obvious trick to some of the veterans here, but I thought it
> was an interesting way to get good color maps for wood, so here it goes.

They look good.

A way to colorize wood is to use the same technique that is used in printing. A
wood is not printed in ymck but in spot colours on a coloured base. In general
only three ink colours are needed.

It starts with how the design is built. The first layer is just density
modulation without detail. The second layer give the general idea of the design
and the last layer gives the fine detail like the grain. All inks are lasure
inks, they are transparent.

The main colour of the design is defined by the base film colour. The first
layer is printed "tone in tone" and darker than the base colour, and has the
opposite "temperature". Cool gray vs warm gray. The next layer can be more
contrasting and the grain layer can be even more contrasting. For an oak you can
go very dark brown or even white for a white wash effect. The mixing of all the
colours, as they are transparent, gives a very rich and natural look.

To make a floor all that one needs to do to get some variation is to slightly
randomize the base colour per board.

ingo


Post a reply to this message

From: Chris R
Subject: Re: Wood grain
Date: 1 May 2023 11:00:00
Message: <web.644fd30a6808bc7793c0941a5cc1b6e@news.povray.org>
"Mike Miller" <mil### [at] gmailcom> wrote:
> "Chris R" <car### [at] comcastnet> wrote:
> > Maybe this is an obvious trick to some of the veterans here, but I thought it
> > was an interesting way to get good color maps for wood, so here it goes.
> >
> > I was working on some wood flooring for a scene and found a site called
> > wood-database.com that has images and information on lots of different types of
> > wood, including images of lumber made from the types of wood.
> >
> > I downloaded an image of the wood I wanted to replicate in my scene, (the lower
> > left inset in the image below), and imported it into GIMP.  In the Colors/Info
> > menu there is a "Smooth Palette" option that creates a palette of the colors in
> > the image, (seen to the right of the inset).  I exported that as a JPEG and then
> > used some macros I created to pull out the POV-ray colors from the image.  I
> > have used both interpolation and non-interpolation for different effects.  I
> > then use those colors, in the order given, to create the color map for the wood
> > texture.
> >
> > Coming up with the wood pigment and warps is still mostly trial and error, but
> > the sample is actually pretty close.
> >
> > The three boards are rendered using variations on the color map.  The center one
> > is non-translated and unaltered.  The right has been lightened, and the grain
> > was selected randomly from a normal-sized pine tree.  The left was grayed by
> > aging, and also randomly selected.
> >
> > In this particular example, I only sampled the colors from a single ring of the
> > wood pattern.  For others, the colors vary across rings, so it works better to
> > use all of the colors in the color map, but scale the pigment so the ring sizes
> > stay the same.
> >
> > Anyway, I'm finding this is a lot easier than my usual hit or miss method of
> > creating a wood colormap, and allows for greater variation in the colors, which
> > enhances realism.
> >
> >
> > -- Chris R.
>
>
> That's excellent Chris. Nice work. I came close to writing a macro to do the
> same - generate a pov color_map from a given image. Mind sharing the macro? :)
> Mike.

I am doing some more experiments and cleaning up the code.  I'll get around to
posting it eventually after I look at some of the suggestions from below as
well.  The version I have right now just creates a pigment function using an
image_map from the palette jpeg, and then scans it from <0,0,0> to <1,0,0> in
steps based on the size of the color map I want to generate.  It then just dumps
the colors it found using #debug as a color_map {} and I copy and paste from the
message window into my code.

There's a bunch of things to clean up based on failed experiments.

-- Chris R.


Post a reply to this message

From: Chris R
Subject: Re: Wood grain
Date: 1 May 2023 11:00:00
Message: <web.644fd3d26808bc7793c0941a5cc1b6e@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:
> That a really clever technique, and your results speak for themselves-- the wood
> looks very natural! I assume you used eval_pigment in your macro, to pick out
> the colors from the color-palette JPEG.
>
> My go-to app for image editing is the freebie paint.net; unfortunately, it does
> not have such a palette producer built-in, like GIMP does. I need to search for
> a similar plug-in for it.
>
> Nice work, and inspiring!

Actually, I rolled my own version of eval_pigment by creating a pigment function
and then just calling it repeatedly as I moved along the palette jpeg.  I wasn't
worried about speed since this is something I do in the modeling stage rather
than the rendering stage.  (To be honest, I didn't look to see if there was
something built in to do this already...)

-- Chris R.


Post a reply to this message

From: Chris R
Subject: Re: Wood grain
Date: 1 May 2023 11:05:00
Message: <web.644fd4816808bc7793c0941a5cc1b6e@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> Very nice.
>
>
> I wrote some similar macro stuff way back:
>
>
http://news.povray.org/povray.binaries.images/thread/%3C58cfcd53%241%40news.povray.org%3E/
>
> I also made some numerical patterns to see what parts of each pattern correspond
> to what values in the color map
>
>
http://news.povray.org/povray.binaries.images/thread/%3Cweb.5a7774f01a0c102c5cafe28e0@news.povray.org%3E/
>
> as well as the recent color map editor thing:
>
>
>
http://news.povray.org/povray.advanced-users/thread/%3Cweb.63ed381961f8e3fb1f9dae3025979125%40news.povray.org%3E/
>
>
> Hope some of that helps / inspires...
>
> - BW

Thanks, I will look into this.  I should probably make it a habit to just search
the newsgroups for your posts before I start writing code.  :-)

-- Chris R.


Post a reply to this message

From: Bald Eagle
Subject: Re: Wood grain
Date: 1 May 2023 13:25:00
Message: <web.644ff5b76808bc771f9dae3025979125@news.povray.org>
"Chris R" <car### [at] comcastnet> wrote:

> Thanks, I will look into this.  I should probably make it a habit to just search
> the newsgroups for your posts before I start writing code.  :-)


:D  tbh, I do the same thing a lot.
Heck, I even wind up rewriting a lot of my own code.

It _IS_ a good thing when people make their own attempts, since they might solve
things that I got wrong or others thought "impossible".  "I didn't know I
couldn't do that - - - so I just did it."

Also, you might wind up doing the same thing but approaching the end goal in a
different way, which might lead to improvements in speed / efficiency /
photorealism.

I generally find that the difficult part is not acquiring the pallette of colors
to interpolate with the color_map, but doing it in such a way that it winds up
resembling what I'm trying to model with a procedural pattern.

If you look into optical illusions, it becomes immediately apparent that the
actual color value employed matters far less than the visual context that your
brain interprets it in.

And that's where things get challenging, and it becomes more art and less math,
science, and engineering.

I DO particularly like the suggestion to use layered textures with filter - some
sort of commercial algorithm to make laminated faux woodgrain would be a great
basis for a realistic wood texture.


- BW


Post a reply to this message

From: Chris R
Subject: Re: Wood grain
Date: 2 May 2023 08:55:00
Message: <web.6451071f6808bc7793c0941a5cc1b6e@news.povray.org>
"Chris R" <car### [at] comcastnet> wrote:
> "Mike Miller" <mil### [at] gmailcom> wrote:
> > "Chris R" <car### [at] comcastnet> wrote:
> > > Maybe this is an obvious trick to some of the veterans here, but I thought it
> > > was an interesting way to get good color maps for wood, so here it goes.
> > >
> > > I was working on some wood flooring for a scene and found a site called
> > > wood-database.com that has images and information on lots of different types of
> > > wood, including images of lumber made from the types of wood.
> > >
> > > I downloaded an image of the wood I wanted to replicate in my scene, (the lower
> > > left inset in the image below), and imported it into GIMP.  In the Colors/Info
> > > menu there is a "Smooth Palette" option that creates a palette of the colors in
> > > the image, (seen to the right of the inset).  I exported that as a JPEG and then
> > > used some macros I created to pull out the POV-ray colors from the image.  I
> > > have used both interpolation and non-interpolation for different effects.  I
> > > then use those colors, in the order given, to create the color map for the wood
> > > texture.
> > >
> > > Coming up with the wood pigment and warps is still mostly trial and error, but
> > > the sample is actually pretty close.
> > >
> > > The three boards are rendered using variations on the color map.  The center one
> > > is non-translated and unaltered.  The right has been lightened, and the grain
> > > was selected randomly from a normal-sized pine tree.  The left was grayed by
> > > aging, and also randomly selected.
> > >
> > > In this particular example, I only sampled the colors from a single ring of the
> > > wood pattern.  For others, the colors vary across rings, so it works better to
> > > use all of the colors in the color map, but scale the pigment so the ring sizes
> > > stay the same.
> > >
> > > Anyway, I'm finding this is a lot easier than my usual hit or miss method of
> > > creating a wood colormap, and allows for greater variation in the colors, which
> > > enhances realism.
> > >
> > >
> > > -- Chris R.
> >
> >
> > That's excellent Chris. Nice work. I came close to writing a macro to do the
> > same - generate a pov color_map from a given image. Mind sharing the macro? :)
> > Mike.
>
> I am doing some more experiments and cleaning up the code.  I'll get around to
> posting it eventually after I look at some of the suggestions from below as
> well.  The version I have right now just creates a pigment function using an
> image_map from the palette jpeg, and then scans it from <0,0,0> to <1,0,0> in
> steps based on the size of the color map I want to generate.  It then just dumps
> the colors it found using #debug as a color_map {} and I copy and paste from the
> message window into my code.
>
> There's a bunch of things to clean up based on failed experiments.
>
> -- Chris R.

For what it's worth, here's the new macro I defined.  It now actually generates
a color_map so you can include it as part of modeling, but gives the option of
dumping it to #debug so you can copy and paste it and modify it for artistic
purposes.

I updated it to take any pigment as input to represent the color palette, as
well as allowing you to specify a range other than 0.0 to 1.0 for the range to
sample colors from.  This makes it easier to select a subset of the palette.

I'm sure there's a better way to ignore the alpha channel, but this was quick
and dirty so I didn't hunt for one.

#macro Wood_colormap(PalettePigment,MaxEntries,Start,End)
    #ifdef (Wood_colormap_debug) #debug "color_map {\n" #end
    #local _cm  = color_map {
        #local _cur_pt      = Start;
        #local _cur_offset  = 0.0;
        #local _step        = (End-Start)/MaxEntries;
        #local _step_offset = 1/MaxEntries;
        #while (_cur_pt <= End)
            #local _cur_color   = eval_pigment(PalettePigment,<_cur_pt, 0, 0>);
            #local _scolor      = <_cur_color.red, _cur_color.green,
_cur_color.blue>;
            #ifdef (Wood_colormap_debug) #debug concat("   [", str(_cur_offset,
0, 3), ", rgb <", vstr(3, _scolor, ",", 0, 4), ">]\n") #end
            [_cur_offset, rgb _scolor]
            #local _cur_pt      = _cur_pt + _step;
            #local _cur_offset  = _cur_offset + _step_offset;
        #end
    #ifdef (Wood_colormap_debug) #debug "}\n" #end
    }

    _cm
#end

The image uses this color_map directly:

#local _board_cm    = color_map { Wood_colormap(_colors_pigment, 24, 0.0, 0.9) }
#local _board_pigment   = pigment {
    wood
    warp { ... }
    color_map { _board_cm }
}

Here's the #debug output:

color_map {
   [0.000, rgb <0.9473,0.7682,0.5972>]
   [0.042, rgb <0.8815,0.6459,0.4811>]
   [0.083, rgb <0.8542,0.5965,0.4078>]
   [0.125, rgb <0.8364,0.6356,0.4650>]
   [0.167, rgb <0.8929,0.7560,0.5718>]
   [0.208, rgb <0.9048,0.7418,0.5618>]
   [0.250, rgb <0.8388,0.6732,0.4993>]
   [0.292, rgb <0.8236,0.6438,0.4899>]
   [0.333, rgb <0.7335,0.5126,0.3459>]
   [0.375, rgb <0.8308,0.6514,0.4851>]
   [0.417, rgb <0.8309,0.6514,0.5029>]
   [0.458, rgb <0.8574,0.6605,0.4905>]
   [0.500, rgb <0.8372,0.6424,0.4701>]
   [0.542, rgb <0.8276,0.5571,0.3510>]
   [0.583, rgb <0.8125,0.6235,0.4699>]
   [0.625, rgb <0.7305,0.5059,0.3492>]
   [0.667, rgb <0.8252,0.6073,0.4353>]
   [0.708, rgb <0.8156,0.6383,0.4741>]
   [0.750, rgb <0.8228,0.6445,0.4793>]
   [0.792, rgb <0.8308,0.6119,0.4425>]
   [0.833, rgb <0.9098,0.7310,0.5561>]
   [0.875, rgb <0.9140,0.7396,0.5553>]
   [0.917, rgb <0.7859,0.5887,0.4250>]
   [0.958, rgb <0.8085,0.5634,0.3648>]
   [1.000, rgb <0.8583,0.6620,0.5145>]
}


-- Chris R.


Post a reply to this message


Attachments:
Download 'woodgrains.png' (234 KB)

Preview of image 'woodgrains.png'
woodgrains.png


 

From: Chris R
Subject: Re: Wood grain
Date: 4 May 2023 08:30:00
Message: <web.6453a47d6808bc7793c0941a5cc1b6e@news.povray.org>
Here are a few elements of the scene I'm working on that sent me down the wood
texture rabbit hole...

-- Chris Rath


Post a reply to this message


Attachments:
Download 'blocks.png' (1276 KB)

Preview of image 'blocks.png'
blocks.png


 

From: jr
Subject: Re: Wood grain
Date: 6 May 2023 06:40:00
Message: <web.64562dad6808bc7758c093306cde94f1@news.povray.org>
hi,

"Chris R" <car### [at] comcastnet> wrote:
> Here are a few elements of the scene I'm working on that sent me down the wood
> texture rabbit hole...

"purrrty"  ;-)


regards, jr.


Post a reply to this message

From: Mike Miller
Subject: Re: Wood grain
Date: 6 May 2023 08:00:00
Message: <web.645640e16808bc7759197626dabc9342@news.povray.org>
"Chris R" <car### [at] comcastnet> wrote:
> Here are a few elements of the scene I'm working on that sent me down the wood
> texture rabbit hole...
>
> -- Chris Rath

Really nice job on the textures and model. love the detail.
Mike.


Post a reply to this message

From: And
Subject: Re: Wood grain
Date: 14 Jul 2023 02:50:00
Message: <web.64b0ef456808bc77ee1d8e88aa81652d@news.povray.org>
"Chris R" <car### [at] comcastnet> wrote:
> Maybe this is an obvious trick to some of the veterans here, but I thought it
> was an interesting way to get good color maps for wood, so here it goes.
>
> I was working on some wood flooring for a scene and found a site called
> wood-database.com that has images and information on lots of different types of
> wood, including images of lumber made from the types of wood.
>

Thanks for the information.
I browse wood-database.com and found that is a good reference.

> I downloaded an image of the wood I wanted to replicate in my scene, (the lower
> left inset in the image below), and imported it into GIMP.  In the Colors/Info
> menu there is a "Smooth Palette" option that creates a palette of the colors in
> the image, (seen to the right of the inset).  I exported that as a JPEG and then
> used some macros I created to pull out the POV-ray colors from the image.  I
> have used both interpolation and non-interpolation for different effects.  I
> then use those colors, in the order given, to create the color map for the wood
> texture.
>
> Coming up with the wood pigment and warps is still mostly trial and error, but
> the sample is actually pretty close.
>


I have developed (but still not complete all features) a Java program to warp/
countrol the wood shape.

http://news.povray.org/povray.binaries.utilities/thread/%3Cweb.62b9d31097c0f8e9cf20f667aa81652d%40news.povray.org%3E/

It can edit the curve using mouse to create the shape.
I will continue the development.


> The three boards are rendered using variations on the color map.  The center one
> is non-translated and unaltered.  The right has been lightened, and the grain
> was selected randomly from a normal-sized pine tree.  The left was grayed by
> aging, and also randomly selected.
>
> In this particular example, I only sampled the colors from a single ring of the
> wood pattern.  For others, the colors vary across rings, so it works better to
> use all of the colors in the color map, but scale the pigment so the ring sizes
> stay the same.
>
> Anyway, I'm finding this is a lot easier than my usual hit or miss method of
> creating a wood colormap, and allows for greater variation in the colors, which
> enhances realism.
>
>
> -- Chris R.


color is another question when I conceive developing my program. So I will
consult your method.


Post a reply to this message

<<< Previous 5 Messages Goto Initial 10 Messages

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