convolution limits in OpenGL imaging

convolution limits in OpenGL imaging

Post by Wolfgang Draxinge » Wed, 20 Mar 2002 07:52:13



Hi there, maybe has somebody out there a solution to my problem:
I have a texture, I want to put through the following convolution

R
[ 0, 0, 1]
[-1, 1, 1]
[-1, 0, 0]

G
[ 0, 1, 1]
[ 0, 1, 0]
[-1,-1, 0]

B
[-0.1,-0.1,-0.1]
[-0.1, 1.0,-0.1]
[-0.1,-0.1,-0.1]

I want to this using OpenGL imaging ( see the Red Book ).
Now I've the problem, that OpenGL clamps values to [0, 1]
what make's it impossible to work with a texture with
values in the range of [-1, 1], for that the convolution
was designed. My idea was, to compress values to range of
[0, 1], and adopt the convolution accordingly. All my
trials in this direction were unsuccesfully.

The basic idea behind the convolution is to aproximate
an normal map from a bump map without pixel shader
capabilities. In software all works fine, but on HW...

--
+------------------------------------------------+
| +----------------+ WOLFGANG DRAXINGER          |
| | ,-.   DARKSTAR | lead programmer             |

| | `-' / GAMES /                                |
| +----+''''''''     http://www.darkstargames.de |
+------------------------------------------------+

 
 
 

convolution limits in OpenGL imaging

Post by Hans-Bernhard Broeke » Wed, 20 Mar 2002 19:56:40


[...]

Quote:> Now I've the problem, that OpenGL clamps values to [0, 1]
> what make's it impossible to work with a texture with
> values in the range of [-1, 1], for that the convolution
> was designed. My idea was, to compress values to range of
> [0, 1], and adopt the convolution accordingly. All my
> trials in this direction were unsuccesfully.

It'd be helpful if you showed at least one such trial of yours, here.

In principle, this would probably most easily done by expressing the
range transformation:

        designdata --> opengldata := 0.5 + 0.5 * designdata
        [-1 .. 1]      [0 : 1]

and its inverse

        opengldata --> designdata := 2 * (opengldata - 0.5)

as convolution operations, too, and then find the combined convolution
by mathematical means (probably has to be done in Fourier space).
Note that you'll have to describe a filtering operation by more than
just a matrix to get this working: you need the constant offset, too.

--

Even if all the snow were burnt, ashes would remain.