Realistic water tutorial

Post topics regarding Level Building/Design and Entity Usage with Reality Factory
User avatar
federico
RF Dev Team
Posts: 443
Joined: Tue Jul 05, 2005 3:14 pm
Contact:

Realistic water tutorial

Post by federico »

The starting point of this tutorial is the default RF entity triad (envinronmentSetup/PlayerSetup/PlayerStart). This tutorial is aimed to have an estethic, non functional, water effect. I won't attach any liquid entity to this water nor I will flag the brush content as water. I only want to suggest you how to make a static water effect that works best when your camera is outside the water.

1. Create the room where you want to have the water. Let's make a simple hollow box.
Image

2. The water will be composed by two brushes with two different textures. They could the the same textures but they have to be named differently. Add these textures to the txl archive you are using.
Image

3. Create the first water brush. It has to be a 'solid' brush. It has to be contained by your room and it has to be a little smaller than the room. This will avoid a bad effect because we have to flag this brush as "wavy" (otherwise the wavy effect will "eat" the room brush). Use the first of the two water textures.
Image

4. Create the second brush. It has t be 'solid'. Use the same X and Z dimension of the first water brush. Place it exactly on the top of previous brrush and make it high only a couple of texel. Use the violet 'transparent' texture. Then switch to 'face attributes' (PgDown) and select in the render view only the top face of the second brush, then apply to only this face the second water texture.
Another method that I suggest is to flag this brush as 'sheet'. The top will become yellow. Flip the brush using the "right click/Rotate45°" xommand until the yellow face is on the bottom, then move the brush 3-4 texel up. This should make the work of the engine easier.
Image

5. Let's tune this water! select the first brush and flag it as 'empty' and 'wavy'. The second one must be only 'empty.'
Select again the first brush and go to the 'face attributes'section. this brush must be 'transparent' with a 'transparent value' of about 150. I use a draw scale of about 0.5 and I flag it as light with a value of 3000 (this could be optional). Click 'Apply'.
The second brush instead must be 'transparent with a value of 90. The draw scale is fundamental: I set a value of about 10. This will affect the wavy effect in the surface so changing this paramenter the waves will be larger or smaller (I suggest a value between 4 and 15 for a texture of 128x128). Click 'Apply'.
I didn't find a way to have a correct mirror effect with this attributes so I simply don't use any mirror effect and I suggest you to do the same.
Image

6. Create an Echaos Entity and a Textureproc Entity.

7. Echaos Entity.In the AttachBmp parameter put the name of the first water texture.
MaxXSway:20
MaxYSway:20
XStep:2
YStep:2
I used this parameters to have a water fast enough to match the textureProc effect. If you set a lower value for the 'draw scale' of the two textures you will probably need a different Sway/Step value to have a faster or slower effect and larger or smaller. If you set the sway asimmetrically you can simulate the direction of the fluid.
Image


8. TextureProc Entity. In the szTextureName put the name of the second texture.
szProcName: Water
Setting a DistanceFlag is up to you.
This Procedural effect takes no paramenter. To control it, change the 'draw scale' of the second texture and his transparency. For the scale is so high, consider to use a clone of the first texture scaled down to a size of 64x64 (no more than 128x128). I hacked the source to have a longer effect, changing in PrecWater.cpp, but with the existing parameter it should work well.

Code: Select all

CalcRippleData(Page1, Page2, 6, Water->Width, Water->Height);
9. Create an Island for your player and put the PlayerStart over it. Create also some artifacts and put in the water. Be careful to not extend them over the bottom of the first water brush or it would be cut by the wavy effect.I flagged this artifacts as detail. This water works good with little-medium water extension, when all the elements (wavy border of the brush, procedural, and Echaos effect) are visible at the same time.
Image


10. Put some lights in the level. Choose a blue color for the lights on the water. The water looks better if it isn't completely lighted. I suggest you also to place an Audio3d entity with a water sound.

11. Compile and enjoy!


Screens.

Image Image
Image

Video:
http://www.youtube.com/watch?v=TrocWUnVvpQ and http://www.youtube.com/watch?v=CPnDsm2q07U
Last edited by federico on Sat Nov 18, 2006 8:23 am, edited 2 times in total.
User avatar
Spyrewolf
Posts: 450
Joined: Tue Jul 05, 2005 4:53 am
Location: Wellington::New Zealand

Post by Spyrewolf »

HOLY CRAP!

thats some awsome looking water fed' that is such a clever idea, Thanks sooo much for sharing this

this is unbeleivable this thread should be a sticky!
User avatar
AndyCR
Posts: 1449
Joined: Wed Jul 06, 2005 5:08 pm
Location: Colorado, USA
Contact:

Post by AndyCR »

WOOOOOOOOOOOW!! :shock:

That's absolutely insane!! GREAT job! :o
dodger
Posts: 74
Joined: Sat Sep 23, 2006 10:16 pm
Location: England. u.k
Contact:

water.

Post by dodger »

Hi federico,

This is just what i need........
it,s a great tut .... simple to follow and to the point ....
i have been looking around the forum for something like this with no success until now.

Thank you so much for this ..
regards ....
Dodger :D
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Post by Juutis »

Wow, amazing. Good thing you posted this tutorial... when I first saw the water effect in your Back In The Dark video, I was stunned and wanted to have the same effect in my game too! So thank you very much!! :D

***EDIT***
Oh and yeah, this should absolutely be stickied.
Pain is only psychological.
User avatar
psYco
Posts: 782
Joined: Wed Mar 15, 2006 10:55 am
Location: England

Post by psYco »

OMG! this is one of the best tutes ive seen and that effect is just well mindblowing! Its actually better than the water effects Ive seen in some commercial games! :D

Thanks Sooooo Much Fed you are the MAN! :D :D
User avatar
paradoxnj
RF2 Dev Team
Posts: 1328
Joined: Wed Mar 01, 2006 7:37 pm
Location: Brick, NJ
Contact:

Post by paradoxnj »

Excellent work federico!! I wonder how it would look if you bump mapped the water? Can that be done?
GD1
Posts: 413
Joined: Tue Jul 05, 2005 2:33 pm

Post by GD1 »

Amazing! Turning up the scale on that textureproc really makes it 10x better than the small little ripples. I'd never tried using it with wavy either. Brilliant! :)

I tried bumpmapped water when i was doing my BloodWake clone. It won't work because the bumpmap can't be transparant and won't work with echaos or textureproc properly.
Check out my band
Tougher Than Fort Knox
Image
User avatar
federico
RF Dev Team
Posts: 443
Joined: Tue Jul 05, 2005 3:14 pm
Contact:

Post by federico »

Thanks guys for the nice comments.
A framerate-friendly version of the water:

1b. Delete the EChaos Entity.

2b. Switching to 'face attributes' editing, select only the top face of the first water brush and flag it as sky.

The wavy brush still makes the other faces flow.


it is different but still interesting.
User avatar
scott
Posts: 1151
Joined: Tue Jul 05, 2005 1:59 am
Location: United Kingdom

Post by scott »

it looks amazing :D indeed it does look better than some comercial games, im wondering tho, would you be able to adapt the 'wavy' function for something like a cape an a character or something? just a thought as im not sure if any of this can be attached to actors.
*GD*
User avatar
BLACK_PHOENIX
Posts: 126
Joined: Wed Sep 27, 2006 6:42 am

Post by BLACK_PHOENIX »

can someone pleeez giv me a level with that water inside it

i think its looks amazing but im too busy to do it.
vegas WP
Posts: 41
Joined: Sun Nov 26, 2006 7:47 pm

Post by vegas WP »

This is pretty awesome. I used the same effect to create a motion wall.

[/img]
Attachments
rfscreen2.jpg
rfscreen2.jpg (44.03 KiB) Viewed 7434 times
#11. Thou Shalt Not Use Cut Brushes.
User avatar
federico
RF Dev Team
Posts: 443
Joined: Tue Jul 05, 2005 3:14 pm
Contact:

Post by federico »

good idea!
like a time warp or a plasma teleport! Something like Alice Through the Looking-Glass...
User avatar
psYco
Posts: 782
Joined: Wed Mar 15, 2006 10:55 am
Location: England

Post by psYco »

Yeah thats awsome!!!! You can even get it to act like one of those wall things in half life 2 so you cant walk through but you can see and its not just boring and flat :D
vegas WP
Posts: 41
Joined: Sun Nov 26, 2006 7:47 pm

Post by vegas WP »

I imagine it would be tough to try and do an entire level like this, but it could be good for an acid-trip or dream sequence type of environment. Everywhere you walk, it feels like the walls are moving in on you.

You could probably make the walls clippable and put a teleport entity in and attach it to the wall. Then your actor goes toward the wall, makes contact and is swished away somewhere else.

This wall actually looks like liquid sand swirling about. I have thought about using it in a quicksand effect placed in the middle of several floor brushes that were just solid textures.

BTW, I used the texture in the second pic for the wall:

The first pic is similar to the liquid wall, except this is more of a pitfall to avoid falling into. I enhanced it with four foglight entities positioned just above the pitfall with 200 brightness and 200 radius and 200RGB. I might try a molten lava texture for the next one.
Attachments
RFscreen2.jpg
(50.33 KiB) Downloaded 266 times
Diamond.jpg
Diamond.jpg (11.91 KiB) Viewed 7335 times
#11. Thou Shalt Not Use Cut Brushes.
Post Reply