PDA

View Full Version : turbulence image distortion



okapota
09-07-2002, 12:47 PM
hi there. i want to aplly a turbulence noise filter to a rendered image. i know how to generate noise tetxures, but i dont understand how they are used to distort the image. am i making my self clear? i intend to use nv30 hardware, and i want to aplly the filter per-pixel. if someone can explain the method, or point me to a paper, i would be gratefull. i dont want implementaions code, i want to figure that one myslef. just knowing how this is done in software is enough.

thnx.

davepermen
09-07-2002, 12:52 PM
you need 2 noise values, one for x-distortion and one for y-distortion. just add them per pixel to the current texcoords (simply the screencoords for example) and then look the texvalue from the displaced texture up..

why nv30 hw? it still takes so long till its there..

okapota
09-07-2002, 10:06 PM
hi. thank you you very much ill try that.
i need it for the shader contest, just for fun. i need to apply different amount of turbulence for each pixel. but i will find a way. just to make sure, u say i need two 2d noise (turbulence) tetures to distort the image?

jwatte
09-08-2002, 02:25 PM
Turbulence texture: 2 components, screen size, each component range from -1 to 1.

Scene texture: the actual rendered scene, screen size, any format.

Turbulence pass: read turbulence texture for pixel position x, y into tx, ty. Scale by whatever your max turbulence range is. Read the screen texture at (x+tx, y+ty). That's your output value.

Note that each pixel will get a different amount of turbulence disturbance, because your 2-valued noise texture contains noise, not a flat color :-)

okapota
09-09-2002, 03:31 AM
ok, thnx. sadly, it is much simpler than i hoped, but i will find a way to complicate it. thnx anyway.

Tom Nuydens
09-09-2002, 03:51 AM
Originally posted by okapota:
sadly, it is much simpler than i hoped, but i will find a way to complicate it.

I'd call you a total nutcase if you hadn't mentioned you were working on an entry for the shader contest http://www.opengl.org/discussion_boards/ubb/smile.gif

What you're describing is actually perfectly possible on NV2x. To make things more interesting, you could generate the noise texture procedurally on the GPU.

-- Tom

okapota
09-09-2002, 05:12 AM
i thought of that, but-
a. its not very original, although per-pixel noise does sound nice.

b. i need a turbulance map which, as far as i understand, is the sum of several noise maps. generating those procedurally is too expensive i think. but i have an idea to make it both "fast" enough and will fit only to the nv30, i think.

but it looks like the method was invented to the nv30 and vise-versa, u see what i mean?

tweakoz
09-09-2002, 09:02 AM
Originally posted by okapota:
<clip>
b. i need a turbulance map which, as far as i understand, is the sum of several noise maps. generating those procedurally is too expensive i think. but i have an idea to make it both "fast" enough and will fit only to the nv30, i think.


The map is not too expensive if you only do
2 or 3 octaves of perlin noise procedurally.
(Im doing it in our XBox Game applied to 3D
Objects)

use 1 or more pregenerated noise 'kernels'
composited together with independant
time-shifting texture matrices.

The OpenGL SDK / NVBrowser has an example of this.

if NV30 supports dependant
texture reads (1.4 DX-PS style) then it should be able to generate the distortion texture AND apply it to another textures
UV's all in one vertex/pixel shader.

you could also noise-distort the texture
being applied to an object as opposed to
the entire rendered image.

//////////////////////////////

Michael T. Mayers
Senior Graphics Programmer
VR1 Entertainment.

okapota
09-10-2002, 02:08 AM
thank you. although i didnt ask for implementaion details, thats exactly what i thought to do, so no harm done http://www.opengl.org/discussion_boards/ubb/smile.gif.