Game Development Community

dev|Pro Game Development Curriculum

Fluid Improvements

by Melv May · 07/11/2002 (10:29 am) · 78 comments

Download Code File

If you've not already seen it then you can see it here:

Shoreline#1
Shoreline#2
Shoreline#3
Shoreline#4
Shoreline#5
Dev Snapshot
Forum Thread

Some major improvements are:-

- Takes advantage of multiple texturing units on cards. Will reconfigure surface/environment/fog rendering for 2 TMU's or 4 TMU's automagically.
- No longer need to exit editor to change waterblock textures for surface/environment.
- Can move waterblock and apply alpha-map on the fly using the editor.
- Shallow/Depth alpha configurable.
- Water Surface Distortion function.
- Surface Parallax.
- Fluid Flow control.
- Seperate fluid Environment map for over/under surface

Please note that this superceeds the previous code snipit Improved Fluid Rendering and includes all of it's functionality except the underwater distortion texture.

You can also find some textures which I used in the "Dev Snapshot" here:

Wash#1
Wash#2

Enjoy everyone,

- Melv.

[EDIT] 27/08/2002
Completely revamped engine to include features listed above.

[EDIT] 31/08/2002
Removed some WIP code that was left in and was causing a texture manager error. Thanks to Chris Wilson for kindly pointing it out.

[EDIT] 8/9/2002
Fixed bug causing disconnect when *any* texture resources are not found.

[EDIT] 1/2/2003
Moved hosting web-site.
Page «Previous 1 2 3 4 Last »
#1
07/11/2002 (11:32 am)
Really great!!! Thx man.
#2
07/11/2002 (11:56 am)
Just tried compiling it on linux, but i seem to have come across some sort of error...
Quote:
--> Compiling terrain/fluidSupport.cc
terrain/fluidSupport.cc:174: parse error before `{'
terrain/fluidSupport.cc:174: stray '\' in program
terrain/fluidSupport.cc:175: stray '\' in program
terrain/fluidSupport.cc:176: stray '\' in program
terrain/fluidSupport.cc:177: stray '\' in program
terrain/fluidSupport.cc:178: stray '\' in program
terrain/fluidSupport.cc:179: stray '\' in program
terrain/fluidSupport.cc:180: `Count' was not declared in this scope
terrain/fluidSupport.cc:180: syntax error before `.'
terrain/fluidSupport.cc:180: stray '\' in program
terrain/fluidSupport.cc:181: `Count' was not declared in this scope
terrain/fluidSupport.cc:181: syntax error before `.'
terrain/fluidSupport.cc:181: stray '\' in program
terrain/fluidSupport.cc:182: `Count' was not declared in this scope
terrain/fluidSupport.cc:182: syntax error before `.'
terrain/fluidSupport.cc:182: stray '\' in program
terrain/fluidSupport.cc:183: syntax error before `++'
terrain/fluidSupport.cc:183: stray '\' in program
terrain/fluidSupport.cc:184: stray '\' in program
terrain/fluidSupport.cc:185: stray '\' in program
terrain/fluidSupport.cc:186: stray '\' in program
terrain/fluidSupport.cc:187: stray '\' in program
terrain/fluidSupport.cc:188: stray '\' in program
terrain/fluidSupport.cc:189: stray '\' in program
terrain/fluidSupport.cc:193: stray '\' in program
terrain/fluidSupport.cc:194: stray '\' in program
terrain/fluidSupport.cc:195: ANSI C++ forbids declaration `Y' with no type
terrain/fluidSupport.cc:195: `Stack' was not declared in this scope
terrain/fluidSupport.cc:195: `Count' was not declared in this scope
terrain/fluidSupport.cc:195: `Stack' was not declared in this scope
terrain/fluidSupport.cc:195: `Count' was not declared in this scope
terrain/fluidSupport.cc:195: confused by earlier errors, bailing out
make[1]: *** [out.GCC2.DEBUG/terrain/fluidSupport.obj] Error 1
make: *** [default] Error 2
#3
07/11/2002 (12:05 pm)
Not sure what's causing that as I have only made a minor change in that file.

Also, the line it's reporting is original code that has not changed. Basically on that line is a macro '#define PUSH(y,x0,x1,dy)'.

I don't know much about linux or the compiler issues that may come with it.

Sorry I can't be much help here.

- Melv.
#4
07/11/2002 (12:09 pm)
It certainly looks like your compiler does not like the macro line-continuation operator '\'!

Did it compile before? If it did then I am completely at a loss.

- Melv.
#5
07/11/2002 (12:23 pm)
Yes it did.
When making a fresh torque copy with my cvs source, it compiles =/

When manually adding the stuff for that file, it compiles.
#6
07/11/2002 (12:25 pm)
#7
07/11/2002 (12:25 pm)
#8
07/11/2002 (12:25 pm)
Sorry, but for some unknown reason, the edit resource comment tool isn't working as it should (aka the extra posts)
#9
07/11/2002 (1:26 pm)
Stuart,

I'm a little confused. Does that mean you got this to work? Was it just a build problem?

- Melv.
#10
07/11/2002 (1:58 pm)
I get it to compile, but get an error whilst loading a map :

Quote:
Fatal:(platform/platformMemory.cc @ 909)
Not an allocated block!
#11
07/11/2002 (2:04 pm)
Have you done a clean and complete build. It seems everytime I release something I always get these kinds of posts only to find that it's solved by a clean build rather than an incremental one.

I've got confirmation that it runs from 7 people now plus the three pc's here. None of them though are running on a linux compiler so I cannot check this for you.

This smacks of a bad compilation/link problem though.

- Melv.
#12
07/11/2002 (3:05 pm)
I did a make clean and it made no apparent difference.
I'll try it on a clean head later maybe.
#13
07/12/2002 (4:31 am)
Works like a charm... HUGE improvement over the hard edged water... thanks!

-J
#14
07/12/2002 (11:30 am)
Thanks a bunch... It looks beautiful. Thanks.!!

Daniel
#15
07/12/2002 (1:46 pm)
I'd look beautiful if i could even get it to compile properly... I don't really understand why its chugging up the errors.
Unless theres some "typo" somewhere that gcc doesn't like...

And yes, i did try a fresh new head copy. =)
#16
07/12/2002 (1:53 pm)
Stuart,

This is definately a compiler problem otherwise it would of shown up elsewhere by now. That doesn't help you but I was curious as to how/what resolved the original compilation errors you were getting.

The errors were indicating that it didn't like the '\' operator. What solved this as this may give an indication as to what is wrong.

I would like to help but I'm not sure what the compiler doesn't like. 8(

- Melv.
#17
07/12/2002 (2:51 pm)
I "fixed" the errors by attempting to manually copy the modified bits from the affected sourcecode manually to a fresh copy.
Doing this seems to fix the compiler errors.

I've done it again and it still doesn't work at runtime though. (I still get the same crash)
#18
07/13/2002 (12:50 am)
I just get a crash while loading the mission. I made a clean build of head with CodeWarrior/Mac. When debugging I get an "access fault exception" in GBitmap destructor that comes from WaterBlock::BlurDepthMap last line

delete [] pTempBitmap;

At a lost about what to do (not that used to Torque code, u know =)
#19
07/13/2002 (10:48 am)
Miguel,

Take out the "[]". That should not be there. I am not sure why I put that in!!!

Hope this helps.

- Melv.
#20
07/13/2002 (2:58 pm)
It now compiles and runs fine on linux...
All except for fluidSupport.cc - but as i said before, i fixed that by manually copying the changes into it.

Proof :

www.kitsuneaye.co.uk/torque/test.jpg (Using default settings, whatever they are :D)

The effect looks great far away, but when i get up close like this in shallow areas, the water seems to be floating because the shallow bit is very transparent.
Page «Previous 1 2 3 4 Last »