PDA

View Full Version : New Demo: VS3.0 Displacement Mapping


Pages : [1] 2

Abba Zabba
04-29-05, 03:05 AM
This demo written in OpenGL uses NV_vertex_program3 option on NVIDIA newest cards to perturb a grid mesh and simulate a water effect.

For those who are not too familiar with the OpenGL nomenclature, NV_vertex_program3 is what the DX folks refer to as Vertex Shaders 3.0.

If this demo fails to detect VS3.0 hardware support, it will still run but will only give the illusion of displacement (a 2D water effect instead of a full 3D), so ATi users might still enjoy this one.

There is no support for the FX cards (and I don't think I'll be inclined to add few lines necessary to detect and support float Texture Rectangles :p)

PS: Using the new FBO extension I can achieve about 3 folds the frame rate over the aging and slow pixel buffers.

PS2: The first one to mention Sobel filter will have a free a$$ beating :rolleyes:

http://www.realityflux.com/abba/C++/Displacement%20Mapping/displacementmap.jpg
Binaries (http://www.realityflux.com/abba/C++/Displacement%20Mapping/DisplacementMapping.zip)
Source (http://www.realityflux.com/abba/C++/Displacement%20Mapping/DisplacementMappingSRC.zip)
Engine source (http://www.realityflux.com/abba/C++/SXMLEngine/SXMLEngine.zip)

OWA
04-29-05, 03:19 AM
Like the stained shadow map demo, this appears to be another one that requires the later beta drivers to work properly (at least for me). I'd prefer to not have to change drivers again at the moment. Is there any way you can make it work under 71.89 or is it just too much trouble?

Abba Zabba
04-29-05, 03:25 AM
Like the stained shadow map demo, this appears to be another one that requires the later beta drivers to work properly (at least for me). I'd prefer to not have to change drivers again at the moment. Is there any way you can make it work under 71.89 or is it just too much trouble?

Should work with pretty much any driver with a fall back to PBuffers.
I take it this demo crashes on your system, mind passing me the log file so I can examine it?
Thanks

OWA
04-29-05, 07:50 AM
It seems to act like the stained shadow map demo in that after it crashes, it's like it has used all the available memory in the system. It takes the system a while to become responsive again.

<+>Registering data path -> Data/XML/
<+>Registering data path -> Data/Textures/
<+>Registering data path -> Data/Shaders/
<+>Registering data path -> Data/Models/
<+>Creating GL Window
<+>->width: 800, height: 600
<+>->XLocation: 240, YLocation: 212
<+>->Depth bits: 24, Alpha bits: 0
<+>->Color bits: 32, Stencil bits: 8
<+>Loaded Texture2D file at -> GUIElements.png
<!>GL_EXT_framebuffer_object not supported
<+>Successfully linked the shaders -> Data/Shaders/Velocity.xml
<+>Successfully linked the shaders -> Data/Shaders/Location.xml
<!>Shader Program Info Log:
Fragment info
-------------
(56) : fatal error C9999: *** exception during compilation ***

<!>Error while linking shaders <Data/Shaders/Normals.xml VERTEX SHADER>and <Data/Shaders/Normals.xml FRAGMENT SHADER>
<+>Loaded TextureCubeMap at ->Data/Textures/greecePX.png
<+>Adding shape to TransformGroup
<+>Adding Group to TransformGroup
<!>Couldn't locate the texture file at <sphereBu.tga>even with a look up
<!>invalid texID, Texture::setID(GLuint texID)

Abba Zabba
04-29-05, 09:28 AM
Yup, I remember something about an NVIDIA bug that generates files of size exceeding the GIG while compiling GLSL shaders.
That bug was fixed in the latest BETA drivers.

Knell2
04-29-05, 09:31 AM
It seems to use all the memory in my system then crash.

I have 6800gt, also my system has 1gb DDR.

Edit: By latest beta driver, which one(s) do you mean? Thanks.

Abba Zabba
04-29-05, 09:59 AM
76.44 seem to behave ok on my machine :)

fivefeet8
04-29-05, 11:19 AM
Nice Demo. Really shows off Vertex Shader 3 Displacement Mapping well. If you move close to the ripples in the water, the geometry is actually changed.

The demo runs about 300 fps at 1280x1024 w4xAA using FBO. Using PB(forced 2xAF), the framerate goes to about 90 fps with the same settings.

Here are a few screens up close to the ripples.
http://img7.echo.cx/img7/8352/screenshot0003tz.jpg (http://www.imageshack.us)
http://img7.echo.cx/img7/2011/screenshot0012ky.jpg (http://www.imageshack.us)
http://img7.echo.cx/img7/1258/screenshot0053vf.jpg (http://www.imageshack.us)

Danhill
04-29-05, 12:11 PM
Doesn't work for me either, I'm using 71,89.

The log;

<+>Registering data path -> Data/XML/
<+>Registering data path -> Data/Textures/
<+>Registering data path -> Data/Shaders/
<+>Registering data path -> Data/Models/
<+>Creating GL Window
<+>->width: 800, height: 600
<+>->XLocation: 240, YLocation: 212
<+>->Depth bits: 24, Alpha bits: 0
<+>->Color bits: 32, Stencil bits: 8
<+>Loaded Texture2D file at -> GUIElements.png
<!>GL_EXT_framebuffer_object not supported

Abba Zabba
04-29-05, 01:15 PM
THAT'S IT; SCREW GLSL :mad:
I'm converting all my shaders to using regular GPU assembly, enough is enough :rolleyes:
Gimmie 30 min

tomjscott
04-29-05, 01:22 PM
The demo ran with beta drivers, but no water effect at all. Anyway, here is my criticism from the images shown. It looks like a cool effect, but it doesn't look like water at all. It looks more like mercury. Water shouldn't look so silvery.

Danhill
04-29-05, 01:39 PM
THAT'S IT; SCREW GLSL :mad:
I'm converting all my shaders to using regular GPU assembly, enough is enough :rolleyes:
Gimmie 30 min

:naughty: :rofl

(popcorn)

fivefeet8
04-29-05, 01:57 PM
The demo ran with beta drivers, but no water effect at all. Anyway, here is my criticism from the images shown. It looks like a cool effect, but it doesn't look like water at all. It looks more like mercury. Water shouldn't look so silvery.

Yeah it does look like mercury. Maybe if the water was transparent and you could see to the bottom of the container. Also, the brown walls of the container aren't reflected in the liquid.

Abba Zabba
04-29-05, 03:54 PM
Fixed!!!!one1
No more GLSL for me, not until more mature compilers from ATI and NVIDIA are made officially available :rolleyes: .

I also fixed the mercury look a bit, and later on will be adding true dynamic reflection.
Thanks for the suggestions guys :)

fivefeet8
04-29-05, 03:58 PM
Nice. Looks more like water now. ;)

OWA
04-29-05, 03:58 PM
Hurray! Also works with 71.89 now. :) Thanks.

Abba Zabba
04-29-05, 04:00 PM
I'm sooooooooooo happy :cry:
/runs away for the night

tomjscott
04-29-05, 04:32 PM
Can you post a new screenshot of the improved look. I couldn't get it to run properly so couldn't see the effect in execution.

|-007-|
04-29-05, 04:44 PM
Hey, my compliments. This demo is really cool, and it runs great on my XPS Gen 2 laptop. I gotta show my roommate.

hornet
04-29-05, 06:12 PM
Abba Zappa - If you wan't to get around the vs3-dependency, you can use PBO to copy the FBO to a VBO (heheh, abbreviations rule!). You'll get an extra onboard-copy per update, but it'll run on everything and the kitchen sink! I get quite good results with regular displacementmapping using this technique.


\\hornet

smallSHEEP
04-29-05, 06:29 PM
Wow great demo. :afro:

Danhill
04-30-05, 12:16 PM
Wow, awesome demo, you did a great job. It works for me now using the 71.89!!

Keep at it!!

RpPRO
04-30-05, 01:36 PM
Forgive my lame question. What's the IQ difference between vs3 and vs2?
If I get close to the water it seems to be quite blocky.

It runs fine on my 9700pro.

Abba Zabba
04-30-05, 01:57 PM
In a vertex shader 3.0 you can fetch texture data and use it to modify your geometry whereas in previous shaders models you can't (well there is a work around like some have mentioned where you can render your geom to a pixel buffer object and then use it to read back the vertices etc...)

The only visual difference here is that on NV40 hardware, the water mesh actually has some height to it whereas on every other card it's just the illusion of height. An illusion that gets worse when you zoom up close to the water level.

I don't know about the blockiness artifact you're reporting on your Radeon, care to post a screenshot?

You can hit F8 to save an image in TGA format to your harddrive, then you probably should use some free image software like irfanview to compress it into a JPG.

RpPRO
04-30-05, 02:16 PM
Thanx, and there's your picture. Hope it helps.

picture (http://www.arpipro.fw.hu/javacooldude/screenShot000.jpg)