non-repeating, random, textures ...

  • Follow


Would someone be able to tell me if
it's possible (preferably with some
sample code showing how) to create a
two dimensional, non-repeating texture
and/or one whose colour components vary
randomly and smoothly over those
dimensions, rather than having
a colour or colours that jump when
,crossing texel boundaries?  I'm
thinking, here, of stuff like wood
grain, which I;m *sure* must be
possible, but which I don't know how
to do

Sorry if thus question sounds a bit
confused, but I;m quite new to
"OpenGL"

Russell
0
Reply Russell 9/29/2007 1:39:00 AM

On 2007-09-29, Russell Potter <"russellpotter AT optusnet DOT com DOT
au"> wrote:
>
> Would someone be able to tell me if it's possible (preferably with
> some sample code showing how) to create a two dimensional,
> non-repeating texture and/or one whose colour components vary randomly
> and smoothly over those dimensions, rather than having a colour or
> colours that jump when ,crossing texel boundaries?  I'm thinking,
> here, of stuff like wood grain, which I;m *sure* must be possible, but
> which I don't know how to do
>
> Sorry if thus question sounds a bit confused, but I;m quite new to
> "OpenGL"

It does, I can't decide exactly what your question really is, I'll try a
few of the most probable versions of what I think you mean...

First of all, regarding texel boundaries. Texture maps are discrete as
you probably already understand. In the most common senario, you have a
rectangular image, which of course is made of pixels (or texels when we
speak about texture pixels). As you might know, the only way to reduce
the apparent discetization of a signal is to increase the sampling
frequency. Thus, a higher resolution texture image will provide less
visible "texel boundarys". Also, important to the reconstruction of a
discrete signal is filtering. OpenGL will perform linear filtering on
texels if you set GL_MIN_FILTER and GL_MAG_FILTER to GL_LINEAR through
calls to glTexParameter.

As for randomly varying textures, you might want to look into
"procedural textures", "perlin noise", and similar topics. A google
search will probably produce some good articles about the subject, and
there is a book that I have heard is quite detailed on the matter,
called "modelling and texturing: a procedural approach", can't give any
more details, or a real recommendation, since I don't have said book.

Finally, since you are as you said, new to OpenGL, I advise you to get a
copy of the "OpenGL Programming Guide" (the red book).

-- 
John Tsiombikas (Nuclear / Mindlapse)
http://nuclear.sdf-eu.org/
0
Reply John 9/29/2007 2:07:42 AM


On Sep 29, 3:39 am, Russell Potter <"russellpotter AT optusnet DOT com
DOT au"> wrote:
> Would someone be able to tell me if
> it's possible (preferably with some
> sample code showing how) to create a
> two dimensional, non-repeating texture
> and/or one whose colour components vary
> randomly and smoothly over those
> dimensions, rather than having
> a colour or colours that jump when
> ,crossing texel boundaries?  I'm
> thinking, here, of stuff like wood
> grain, which I;m *sure* must be
> possible, but which I don't know how
> to do
>

To do it properly you'll need to use pixel shaders
for "procedural textures". All graphics text books
have procedures for wood, marble, etc.

You can also do a lot by having multiple textures,
each at different resolutions. One for fine "noise"
which you only see close up, another medium level
which gives the overall look, another stretched
out texture which varies the color over a wider area
and helps disguise the repeating pattern of the
medium texture.


--
<\___/>
/ O O \
\_____/  FTB.     Remove my socks for email address.



0
Reply fungus 9/29/2007 6:22:32 AM

fungus,

> To do it properly you'll need to use pixel shaders
> for "procedural textures". All graphics text books
> have procedures for wood, marble, etc.

So how does one install a "pixel shader"? (assuming
"installation" is even the right verb :-)

For that matter, do you know if and, if so,
the URL of a location where these wood, marble
etc generation algorithms are available on-
line? (my finances are a bit too tight for me
to be buying potentially very-thick-and-very-
expensive graphics text books, you see - or
not without mt wife divorcing me first,
anyway :-)

Russell
0
Reply Russell 9/29/2007 9:00:35 AM

Russell Potter wrote:
> 
> Would someone be able to tell me if
> it's possible (preferably with some
> sample code showing how) to create a
> two dimensional, non-repeating texture
> and/or one whose colour components vary

not sure if this is exactly what you asked for, but surely, this 
algorithm produces aperiodic textures. take a look at the bottom of the 
page, there are couple of "pdfs"  that explain the algorithm in detail.

http://en.wikipedia.org/wiki/Wang_tile
0
Reply Leclerc 9/29/2007 10:42:50 AM

On Sep 29, 11:00 am, Russell Potter <"russellpotter AT optusnet DOT
com DOT au"> wrote:
>
> So how does one install a "pixel shader"? (assuming
> "installation" is even the right verb :-)
>

A pixel shader is a small program executed by
the graphics card at each pixel. Most graphics
cards made in the last few years can do this.
You write it as a text file and the graphics driver
compiles it for you.

> For that matter, do you know if and, if so,
> the URL of a location where these wood, marble
> etc generation algorithms are available on-
> line? (my finances are a bit too tight for me
> to be buying potentially very-thick-and-very-
> expensive graphics text books, you see - or
> not without mt wife divorcing me first,
> anyway :-)
>

As I said before... learn to use google.

Go to www.google.com and type "procedural texture"
into the little box.

Also try "opengl pixel shader", "cloud rendering", etc.


--
<\___/>
/ O O \
\_____/  FTB.     Remove my socks for email address.

0
Reply fungus 9/29/2007 5:08:42 PM

5 Replies
296 Views

(page loaded in 0.078 seconds)

Similiar Articles:













7/24/2012 3:17:33 PM


Reply: