Better Fluid Rendering ...
by Melv May · 03/16/2002 (1:10 pm) · 25 comments
Download Code File
Damn, I think I've said it all in the synopsis!
The liquid medium effect in Torque is good but I just felt that it wasn't doing the core engine justice at the moment. There is an awful lot of potential in there for it and this is my humble attempt at exposing some of that functionality.
I've tried to do this without breaking any existing links, so I was kind of limited in certain areas such as the submersion effect which takes place outside of the fluid surface rendering stage.
With that said, I think it now looks cool and I thought I'd share it with you nice folk.
I plan to remove the boring "wave-pool" effect and replace it with a wind->chop / collision->wave system, throw a rock onto the surface and hey presto waves/ripples. Also, if an object is moving around near the surface then it's possible to disturb it with very little calculation.
Boy this is fun ...
Enjoy everyone.
Damn, I think I've said it all in the synopsis!
The liquid medium effect in Torque is good but I just felt that it wasn't doing the core engine justice at the moment. There is an awful lot of potential in there for it and this is my humble attempt at exposing some of that functionality.
I've tried to do this without breaking any existing links, so I was kind of limited in certain areas such as the submersion effect which takes place outside of the fluid surface rendering stage.
With that said, I think it now looks cool and I thought I'd share it with you nice folk.
I plan to remove the boring "wave-pool" effect and replace it with a wind->chop / collision->wave system, throw a rock onto the surface and hey presto waves/ripples. Also, if an object is moving around near the surface then it's possible to disturb it with very little calculation.
Boy this is fun ...
Enjoy everyone.
About the author
#2
Take a look @ Water in air
Emo1313
03/18/2002 (4:43 pm)
Major problems here... Well not major but... I noticed after adding my jet pack into the code and the water effects that you posted here... If you fly up very far then look down you get the underwater texture effect...Take a look @ Water in air
Emo1313
#3
ALL you have to do is copy the texture filepath you had previously (which should appear as the old fieldname in your old waterblock at the bottom of the editor fields) into one/both of the new texture fields. The fact that you are getting white indicates that the texture is referenced incorrectly, nothing else. This procedure does work without problem and takes around 10 seconds so not much of a problem really.
Taylor: The rendering of the underwater texture effect in the air is strange as the actual decision to render the water stuff is not in my code! There always was a flag (that I use) that marks whether the player is immersed.
My rendering of the effect then becomes a simple "if (underwater) rendereffect()". Previously, all you would get was a haze effect underwater. I would suggest that you remove my code and try moving to the same position. Do you then get the 'haze' effect then? I would be VERY suprised if you don't.
Please let me know on that one. If there is anything else I can do then let me know.
Could you send me a test level/code I could reproduce it with?
03/19/2002 (1:23 am)
TheMartian: You can't really make the radical changes work on existing levels with having to touch the keyboard! The only thing I could have done is leave the existing field-names the same but I was attempting to make the fieldnames more understandble.ALL you have to do is copy the texture filepath you had previously (which should appear as the old fieldname in your old waterblock at the bottom of the editor fields) into one/both of the new texture fields. The fact that you are getting white indicates that the texture is referenced incorrectly, nothing else. This procedure does work without problem and takes around 10 seconds so not much of a problem really.
Taylor: The rendering of the underwater texture effect in the air is strange as the actual decision to render the water stuff is not in my code! There always was a flag (that I use) that marks whether the player is immersed.
My rendering of the effect then becomes a simple "if (underwater) rendereffect()". Previously, all you would get was a haze effect underwater. I would suggest that you remove my code and try moving to the same position. Do you then get the 'haze' effect then? I would be VERY suprised if you don't.
Please let me know on that one. If there is anything else I can do then let me know.
Could you send me a test level/code I could reproduce it with?
#4
The very first thing I tried was copying the location of the water which for the demo is
fps/data/water/water
Even after puting that in for surface texture
A and B(in fact I put it everywhere trying to get it to work) then hit apply, nothing happens.
If I exit the mission and relaunch the mission and hit f11 to enter the editor it crashes.
However this all works fine without all the fluid changes. Rerun the standard unmolested torque demo and I can change the texture with no problems.
So it may still be something on my side but could you try it yourself to make sure it works? thanks.
03/19/2002 (7:44 am)
of course I realized that especially since I made your changes manually, piece by piece so I would see all the changes.The very first thing I tried was copying the location of the water which for the demo is
fps/data/water/water
Even after puting that in for surface texture
A and B(in fact I put it everywhere trying to get it to work) then hit apply, nothing happens.
If I exit the mission and relaunch the mission and hit f11 to enter the editor it crashes.
However this all works fine without all the fluid changes. Rerun the standard unmolested torque demo and I can change the texture with no problems.
So it may still be something on my side but could you try it yourself to make sure it works? thanks.
#5
If I try to use the editor to change the texture from my problematic white to water.
Nothing happens, as mentioned before.
But when I edit the mission file by hand I can get the texture back and it looks like its suppose to on the other demo maps.
However, even on the test map with the cool slime pit it will not let me change the texture through the editor.
Try it yourself just to make sure I'm not drinking too much mountain dew.
03/19/2002 (8:37 am)
update, k here is what I found.If I try to use the editor to change the texture from my problematic white to water.
Nothing happens, as mentioned before.
But when I edit the mission file by hand I can get the texture back and it looks like its suppose to on the other demo maps.
However, even on the test map with the cool slime pit it will not let me change the texture through the editor.
Try it yourself just to make sure I'm not drinking too much mountain dew.
#6
Initially the waterworld level textures are white but then I copy the old fields details into the new ones and it works.
If you are only using a single layer, make sure you have got layer B turned off otherwise you will get it rendered as white!
This could be your problem??
Please let me know, I would like to help.
03/19/2002 (1:39 pm)
I've just tried it on another machine with a different spec on a clean Release_1_1_1 with my modifications added and it works fine.Initially the waterworld level textures are white but then I copy the old fields details into the new ones and it works.
If you are only using a single layer, make sure you have got layer B turned off otherwise you will get it rendered as white!
This could be your problem??
Please let me know, I would like to help.
#7
To prove it, download realmwars, run the level, go into the editor and move something and then save the mission. Quit the mission but don't exit and reload the mission.
... now try going into the editor ...
... not my fault, honest!!!
03/19/2002 (1:43 pm)
... also, the editor crash problem is not me ... I didn't write the editor!!To prove it, download realmwars, run the level, go into the editor and move something and then save the mission. Quit the mission but don't exit and reload the mission.
... now try going into the editor ...
... not my fault, honest!!!
#8
Its seems to be all happy now.
That and I think your right I had both layers on so I got white.
I've played around with the camera pitch and yaw that controls the movement of the texture tied to the camera.
If you face different directions it doesnt move the texture correctly because you are only using one vector. It still looks fine with the slime but if you use a more patterned texture you can see that it doesnt move as expected as you move the camera around.
No big deal really, since the effect still looks really good.
Its actually not simple to fix either.
In english, if I move the camera down I expect the texture to move up and it doesnt, try facing n,e,s,w and move the camera up and down the texture in front of the camera moves differently in each direction.
still looks cool though :)
03/19/2002 (4:35 pm)
um copying the files over worked for me as well :)Its seems to be all happy now.
That and I think your right I had both layers on so I got white.
I've played around with the camera pitch and yaw that controls the movement of the texture tied to the camera.
If you face different directions it doesnt move the texture correctly because you are only using one vector. It still looks fine with the slime but if you use a more patterned texture you can see that it doesnt move as expected as you move the camera around.
No big deal really, since the effect still looks really good.
Its actually not simple to fix either.
In english, if I move the camera down I expect the texture to move up and it doesnt, try facing n,e,s,w and move the camera up and down the texture in front of the camera moves differently in each direction.
still looks cool though :)
#9
I will try to correct it this week for you.
Thanx.
03/20/2002 (12:25 am)
You are correct about the underwater texture translation. As you may have noticed, I use an existing function within the engine to return me pitch/yaw. It doesn't seem to work as I would have expected.I will try to correct it this week for you.
Thanx.
#11
After editing a mission, you must completely exit and re-enter the game to successfully play your level. else face the wrath of the Server Gods!!!!!!!!
03/27/2002 (7:57 pm)
Ever since Tribes 2 was that mapping thing a problem. NOTE TO EVERYONE:After editing a mission, you must completely exit and re-enter the game to successfully play your level. else face the wrath of the Server Gods!!!!!!!!
#12
in an other tutorial the water is WHITE
Why??
Eric
04/04/2002 (9:14 am)
it is very realistic but nowin an other tutorial the water is WHITE
Why??
Eric
#13
Things to try are ...
- Ensure the image path is correct.
- Ensure you don't use an extension on the image name.
- If you're using the new fluid rendering then ensure you have a texture entered if you select the surface to render.
If it still fails then I will help if you provide more details.
Hope this helps.
04/05/2002 (10:44 am)
Eric,Things to try are ...
- Ensure the image path is correct.
- Ensure you don't use an extension on the image name.
- If you're using the new fluid rendering then ensure you have a texture entered if you select the surface to render.
If it still fails then I will help if you provide more details.
Hope this helps.
#14
04/05/2002 (7:18 pm)
This looks really good, much better than the default demo water, the only thing i noticed was that the sea roof while inside water looked somewhat fake, but i guess i can fix it to my likes using flags. Good Work.
#15
You are correct, my demo exaggerates the 'sea-roof' environment mapping so as to show it off. I didn't want to make it that subtle that people said "what's the difference". It uses the same UV mapping as the top-side. With the right balance of opacity and the correct texture, it looks pretty good.
You are correct though, their is no substitute for real internal reflections!
04/06/2002 (3:17 am)
Marcelo,You are correct, my demo exaggerates the 'sea-roof' environment mapping so as to show it off. I didn't want to make it that subtle that people said "what's the difference". It uses the same UV mapping as the top-side. With the right balance of opacity and the correct texture, it looks pretty good.
You are correct though, their is no substitute for real internal reflections!
#17
04/26/2002 (5:49 pm)
now if only i can get rain to make ripples .....
#18
05/02/2002 (11:37 am)
Thanks a lot for this, it looks awesome and works like a charm.
#20
However, I've discovered a problem - it may be unique to my circumstances. I've got a water block, its scale size is set to 2048 x 2048. But when I first enter the game, the water blocks are truncated - they look to be about 3/4 of full size. If I exit the server (but don't quit) and rejoin, the water is fine, and will stay fine after that. If I'm hosting, then I don't have to quit, just hit F11, select the water block, and hit apply (no changes made), then the water block fills out.
This problem does not occur with the stock fluid code.
Now, my terrain tile size is set to 96 (wayyyy stretched terrain), and this scaling may be part of the issue. Is there any mechanism in your fluid code that you can think of off-hand that might contribute to this ?
05/20/2002 (7:24 pm)
Melvin, I finally got a round to trying this out, and I like what it does, well done! Can't wait for the new stuff.However, I've discovered a problem - it may be unique to my circumstances. I've got a water block, its scale size is set to 2048 x 2048. But when I first enter the game, the water blocks are truncated - they look to be about 3/4 of full size. If I exit the server (but don't quit) and rejoin, the water is fine, and will stay fine after that. If I'm hosting, then I don't have to quit, just hit F11, select the water block, and hit apply (no changes made), then the water block fills out.
This problem does not occur with the stock fluid code.
Now, my terrain tile size is set to 96 (wayyyy stretched terrain), and this scaling may be part of the issue. Is there any mechanism in your fluid code that you can think of off-hand that might contribute to this ?
Torque Owner TheMartian
Conundrum Studios
It did break all the other demos though, I dont get water on the other maps(scorched, water world) I fittled with it but all I get is white(even pointing to the right textures)
anyone else get this?
Should this be backward compatible with the previous water?