Weazel@Posted: Mon Aug 09, 2004 8:48 pm :
EDIT:

Here's my How-To on getting a liquid to work in Doom3. It's not the prettiest water, and the look from inside kinda sucks, but... It's a start to get other people started on some better looking water...

Take a look at this thread to see how-to make a vacuum area. A vacuum area is what is need to get the breath meter to work correctly.

Making a Vacuum area by TheCray_nz


1. Add the code below into a new material file named "water.mtr"

Place water.mtr into /base/materials

Code:
textures/water/water_blue
{
discrete // Not sure what this is used for
nonsolid // Makes it so you can walk through it
water // add this for water effect swimming etc...
twoSided // Makes it so water effects shows on both sides of the texture

diffusemap textures/water/water1.tga

{
vertexProgram heatHazeWithMask.vfp
vertexParm 0 time * 0.1 , time * 0.5 // texture scrolling
vertexParm 1 1.5 // magnitude of the distortion
fragmentProgram heatHazeWithMask.vfp
fragmentMap 0 _currentRender
fragmentMap 1 textures/sfx/vp1.tga // the normal map for distortion
fragmentMap 2 textures/sfx/vp_full.tga // the distortion blend map
} // End Heat Haze Effect

{
mirrorRenderMap      512   256  // size of the texture to draw the mirror view in
blend   blend

// give it a greenish tint
red      0.3
green   0.3
blue   0.1

// opacity
alpha   0.7

// these may not be necessary when I finish the code
translate   0.5 , 0.5
scale   0.5 , 0.5
} // End Mirror effect

} // End Shader


Add the above code into a new material file named "water.mtr"

Place water.mtr into /base/materials

Make sure to make textures for water1.tga and vp_full.tga

Place water1.tga into /base/textures/water

Place vp_full.tga into /base/textures/sfx

I've included a link to a zip file that has the mtr file and both tga's...

Water.zip



LMCTF-Vampire@Posted: Mon Aug 09, 2004 9:11 pm :
So far in my travels in single player (as well as all 6 multiplayer maps) I have not seen any water at all. This is making me rather nervous because alot of my map ideas require water in them... :(



rich_is_bored@Posted: Mon Aug 09, 2004 9:12 pm :
Are you familiar with material shaders because you'll have to write one and even still Doom 3 may not support it.

Write a material shader and add the command "water" to it. If you can swim around in a brush with this new custom material applied then yes, Doom 3 supports it.



Weazel@Posted: Mon Aug 09, 2004 11:24 pm :
I have a new MTR file [/base/materials/water.mtr] which includes the following code...

Code:
textures/water/water1
{
nonsolid
water // add this for water
translucent
twosided

{
vertexProgram heatHazeWithMask.vfp
vertexParm 0 time * 0.1 , time * 0.5 // texture scrolling
vertexParm 1 1.5 // magnitude of the distortion
fragmentProgram heatHazeWithMask.vfp
fragmentMap 0 _currentRender
fragmentMap 1 textures/sfx/vp1.tga // the normal map for distortion
fragmentMap 2 textures/sfx/vp1_alpha.tga // the distortion blend map
}
}


I made a temp texture for my water, named water1.tga under /base/textures/water

When looking for this new material in doom3ed, I cannot find it. What am I doing wrong?

Thanks in advance...



Weazel@Posted: Mon Aug 09, 2004 11:46 pm :
ok changed the mtr file around a little bit...

Code:
textures/water/
{
nonsolid
water // add this for water
translucent
twosided
diffusemap textures/water/water1.tga

{
vertexProgram heatHazeWithMask.vfp
vertexParm 0 time * 0.1 , time * 0.5 // texture scrolling
vertexParm 1 1.5 // magnitude of the distortion
fragmentProgram heatHazeWithMask.vfp
fragmentMap 0 _currentRender
fragmentMap 1 textures/sfx/vp1.tga // the normal map for distortion
fragmentMap 2 textures/sfx/vp1_alpha.tga // the distortion blend map
}
}


Next question is how can I apply a light or something to this material? It looks ok from the outside, but when you are swiming around in it, it's just looks like a normal room, and there is no breath meter, damage etc...

Any ideas guys?



RobD@Posted: Tue Aug 10, 2004 12:13 am :
For the breath meter you could use the oxygen meter you get in singleplayer when you go outside. The damage would probably be a check if(oxygen <= 0) DamagePlayer(). That's how I would do it but that's only theoretical since I never even looked at scripting or shaders yet. No idea how you would actually put that idea to use D:



rich_is_bored@Posted: Tue Aug 10, 2004 1:02 am :
@ Weazel: Whoa! The water keyword works in the retail game? I was almost certain they were going to remove it.

So is the oxygen problem the only real issue? The appearance from inside shouldn't be too hard to fix. You just need to make the material doublesided.

Quote:
For the breath meter you could use the oxygen meter you get in singleplayer when you go outside. The damage would probably be a check if(oxygen <= 0) DamagePlayer(). That's how I would do it but that's only theoretical since I never even looked at scripting or shaders yet. No idea how you would actually put that idea to use D:


That's the general idea but I don't think you'd include code to do that it in the material shader. This is functionality missing from the game.

Of course, this is no suprise because there have been interviews that clearly indicated id had no intention of including water in the game. Although, it is shocking to find that the water command still works.

Maybe there is something you could add to one of the definitions files to fix it?

EDIT: BTW, I'd really like to see a screenshot. I can't see the DX9 effects on my end because I'm running the game on a GeForce 3.



Weazel@Posted: Tue Aug 10, 2004 4:48 am :
Ok haven't figured out the breath meter thing yet, but I'm working on it... I was wonder why the scrolling texture stops working when I increase the texture size...

As it is now the textures are really small and don't look very realistic. So I want some larger textures...

Any idea?



rich_is_bored@Posted: Tue Aug 10, 2004 4:19 pm :
Have you tried this?

Code:
   {
      blend diffusemap
      map textures/water/water1.tga
      scale 4,4
   }



Weazel@Posted: Tue Aug 10, 2004 6:02 pm :
Can you explain a little more on the usage of that code to me?

The water image is fine, it the other two that are small, both are like 64x64

textures/sfx/vp1.tga
textures/sfx/vp1_alpha.tga

Because they are so small you cannot see the water rippling at a distance, only up close. If I could increase there size to 256x256 or maybe 512x512 I should be able to get some good detail at a normal distance.



rich_is_bored@Posted: Tue Aug 10, 2004 6:35 pm :
Hmmm... I'm not sure if it will work that way.

Basically instead of typing ...

Code:
diffusemap [name of texture]


you type...

Code:
{
  blend diffusemap
  map [name of texture]
}


It does the same thing but because there are brackets you can add extra commands like scale.

The problem is I'm not sure it would work with fragmentmap. You can try it. It might work.

Modified snippet of your material shader...

Code:
vertexParm 1 1.5 // magnitude of the distortion
fragmentProgram heatHazeWithMask.vfp
fragmentMap 0 _currentRender
{
  blend fragmentMap 1
  map textures/sfx/vp1.tga // the normal map for distortion
  scale 2,2
}
{
  blend fragmentMap 2
  map textures/sfx/vp1_alpha.tga // the distortion blend map
  scale 2,2
}
}
}


That's the only way I'm familiar with scaling them in a material shader but like I said, I don't know if it will work with a fragmentmap.

If it doesn't work you'll have to make resized copies of the two tgas manually.



Weazel@Posted: Tue Aug 10, 2004 6:44 pm :
thanks for the tip I'll keep that in mind for the future, I fixed my problem by just using the surface editor in doom3ed to scale the texture to a high value which fixed my issue...

Next step get the water to reflect like a mirror :) I'll keep you posted...

And again thanks for all your help...



Rayne@Posted: Tue Aug 10, 2004 7:10 pm :
The Mirror rendermap code...


;)


Code:
{
      mirrorRenderMap      512   256      // size of the texture to draw the mirror view in
      blend   blend

      // give it a greenish tint
      red      0.3
      green   0.3
      blue   0.1

      // opacity
      alpha   0.7

      // these may not be necessary when I finish the code
      translate   0.5 , 0.5
      scale   0.5 , 0.5
   }



Weazel@Posted: Tue Aug 10, 2004 7:50 pm :
do I just add that mirror code into my shader code? Or is there another use...

Thanks in advance...



Weazel@Posted: Tue Aug 10, 2004 9:59 pm :
Rayne you rock...

It's perfect now... Here's the whole working code....

Code:
textures/stargate/event_horizon
{
discrete // Not sure what this is used for
nonsolid
//water // add this for water effect swimming etc...

diffusemap textures/water/water1.tga

{
vertexProgram heatHazeWithMask.vfp
vertexParm 0 time * 0.1 , time * 0.5 // texture scrolling
vertexParm 1 1.5 // magnitude of the distortion
fragmentProgram heatHazeWithMask.vfp
fragmentMap 0 _currentRender
fragmentMap 1 textures/sfx/vp1.tga // the normal map for distortion
fragmentMap 2 textures/sfx/vp_full.tga // the distortion blend map
} // End Heat Haze Effect

{
mirrorRenderMap      512   256  // size of the texture to draw the mirror view in
blend   blend

// give it a greenish tint
red      0.3
green   0.3
blue   0.1

// opacity
alpha   0.7

// these may not be necessary when I finish the code
translate   0.5 , 0.5
scale   0.5 , 0.5
} // End Mirror effect

} // End Shader


Thanks again...



babago@Posted: Tue Aug 10, 2004 10:09 pm :
can you post a screenshot of the finished work plz ?



Rayne@Posted: Tue Aug 10, 2004 10:17 pm :
oh, i'm workin on water the first time i saw the heat haze effect.. I saw it and said "this effect will rock to make fluids". But i spend effectively 5 minutes to make that.. I've posted a pic in the texture section


HERE



this is a pic, but i'm sure the Weazel one looks much much better



babago@Posted: Tue Aug 10, 2004 10:22 pm :
:shock: wahou :shock:

a really really good work. I never expected that ! It's really, good ! I'm thinking this water effect is just awsome.



Magical Gnome@Posted: Wed Aug 11, 2004 12:42 am :
Cool effect... could you create a short tutorial perhaps? Pretty please? :lol:



Iced_Eagle@Posted: Wed Aug 11, 2004 1:28 am :
That is really cool :)

Only bad thing though...... Only works on Geforce FX and Radeon 9500 and above :(

Luckily I have a 9600 so I can enjoy the wtaer muhahah :twisted:



Weazel@Posted: Mon Aug 09, 2004 8:48 pm :
EDIT:

Here's my How-To on getting a liquid to work in Doom3. It's not the prettiest water, and the look from inside kinda sucks, but... It's a start to get other people started on some better looking water...

Take a look at this thread to see how-to make a vacuum area. A vacuum area is what is need to get the breath meter to work correctly.

Making a Vacuum area by TheCray_nz


1. Add the code below into a new material file named "water.mtr"

Place water.mtr into /base/materials

Code:
textures/water/water_blue
{
discrete // Not sure what this is used for
nonsolid // Makes it so you can walk through it
water // add this for water effect swimming etc...
twoSided // Makes it so water effects shows on both sides of the texture

diffusemap textures/water/water1.tga

{
vertexProgram heatHazeWithMask.vfp
vertexParm 0 time * 0.1 , time * 0.5 // texture scrolling
vertexParm 1 1.5 // magnitude of the distortion
fragmentProgram heatHazeWithMask.vfp
fragmentMap 0 _currentRender
fragmentMap 1 textures/sfx/vp1.tga // the normal map for distortion
fragmentMap 2 textures/sfx/vp_full.tga // the distortion blend map
} // End Heat Haze Effect

{
mirrorRenderMap      512   256  // size of the texture to draw the mirror view in
blend   blend

// give it a greenish tint
red      0.3
green   0.3
blue   0.1

// opacity
alpha   0.7

// these may not be necessary when I finish the code
translate   0.5 , 0.5
scale   0.5 , 0.5
} // End Mirror effect

} // End Shader


Add the above code into a new material file named "water.mtr"

Place water.mtr into /base/materials

Make sure to make textures for water1.tga and vp_full.tga

Place water1.tga into /base/textures/water

Place vp_full.tga into /base/textures/sfx

I've included a link to a zip file that has the mtr file and both tga's...

Water.zip



LMCTF-Vampire@Posted: Mon Aug 09, 2004 9:11 pm :
So far in my travels in single player (as well as all 6 multiplayer maps) I have not seen any water at all. This is making me rather nervous because alot of my map ideas require water in them... :(



rich_is_bored@Posted: Mon Aug 09, 2004 9:12 pm :
Are you familiar with material shaders because you'll have to write one and even still Doom 3 may not support it.

Write a material shader and add the command "water" to it. If you can swim around in a brush with this new custom material applied then yes, Doom 3 supports it.



Weazel@Posted: Mon Aug 09, 2004 11:24 pm :
I have a new MTR file [/base/materials/water.mtr] which includes the following code...

Code:
textures/water/water1
{
nonsolid
water // add this for water
translucent
twosided

{
vertexProgram heatHazeWithMask.vfp
vertexParm 0 time * 0.1 , time * 0.5 // texture scrolling
vertexParm 1 1.5 // magnitude of the distortion
fragmentProgram heatHazeWithMask.vfp
fragmentMap 0 _currentRender
fragmentMap 1 textures/sfx/vp1.tga // the normal map for distortion
fragmentMap 2 textures/sfx/vp1_alpha.tga // the distortion blend map
}
}


I made a temp texture for my water, named water1.tga under /base/textures/water

When looking for this new material in doom3ed, I cannot find it. What am I doing wrong?

Thanks in advance...



Weazel@Posted: Mon Aug 09, 2004 11:46 pm :
ok changed the mtr file around a little bit...

Code:
textures/water/
{
nonsolid
water // add this for water
translucent
twosided
diffusemap textures/water/water1.tga

{
vertexProgram heatHazeWithMask.vfp
vertexParm 0 time * 0.1 , time * 0.5 // texture scrolling
vertexParm 1 1.5 // magnitude of the distortion
fragmentProgram heatHazeWithMask.vfp
fragmentMap 0 _currentRender
fragmentMap 1 textures/sfx/vp1.tga // the normal map for distortion
fragmentMap 2 textures/sfx/vp1_alpha.tga // the distortion blend map
}
}


Next question is how can I apply a light or something to this material? It looks ok from the outside, but when you are swiming around in it, it's just looks like a normal room, and there is no breath meter, damage etc...

Any ideas guys?



RobD@Posted: Tue Aug 10, 2004 12:13 am :
For the breath meter you could use the oxygen meter you get in singleplayer when you go outside. The damage would probably be a check if(oxygen <= 0) DamagePlayer(). That's how I would do it but that's only theoretical since I never even looked at scripting or shaders yet. No idea how you would actually put that idea to use D:



rich_is_bored@Posted: Tue Aug 10, 2004 1:02 am :
@ Weazel: Whoa! The water keyword works in the retail game? I was almost certain they were going to remove it.

So is the oxygen problem the only real issue? The appearance from inside shouldn't be too hard to fix. You just need to make the material doublesided.

Quote:
For the breath meter you could use the oxygen meter you get in singleplayer when you go outside. The damage would probably be a check if(oxygen <= 0) DamagePlayer(). That's how I would do it but that's only theoretical since I never even looked at scripting or shaders yet. No idea how you would actually put that idea to use D:


That's the general idea but I don't think you'd include code to do that it in the material shader. This is functionality missing from the game.

Of course, this is no suprise because there have been interviews that clearly indicated id had no intention of including water in the game. Although, it is shocking to find that the water command still works.

Maybe there is something you could add to one of the definitions files to fix it?

EDIT: BTW, I'd really like to see a screenshot. I can't see the DX9 effects on my end because I'm running the game on a GeForce 3.



Weazel@Posted: Tue Aug 10, 2004 4:48 am :
Ok haven't figured out the breath meter thing yet, but I'm working on it... I was wonder why the scrolling texture stops working when I increase the texture size...

As it is now the textures are really small and don't look very realistic. So I want some larger textures...

Any idea?



rich_is_bored@Posted: Tue Aug 10, 2004 4:19 pm :
Have you tried this?

Code:
   {
      blend diffusemap
      map textures/water/water1.tga
      scale 4,4
   }



Weazel@Posted: Tue Aug 10, 2004 6:02 pm :
Can you explain a little more on the usage of that code to me?

The water image is fine, it the other two that are small, both are like 64x64

textures/sfx/vp1.tga
textures/sfx/vp1_alpha.tga

Because they are so small you cannot see the water rippling at a distance, only up close. If I could increase there size to 256x256 or maybe 512x512 I should be able to get some good detail at a normal distance.



rich_is_bored@Posted: Tue Aug 10, 2004 6:35 pm :
Hmmm... I'm not sure if it will work that way.

Basically instead of typing ...

Code:
diffusemap [name of texture]


you type...

Code:
{
  blend diffusemap
  map [name of texture]
}


It does the same thing but because there are brackets you can add extra commands like scale.

The problem is I'm not sure it would work with fragmentmap. You can try it. It might work.

Modified snippet of your material shader...

Code:
vertexParm 1 1.5 // magnitude of the distortion
fragmentProgram heatHazeWithMask.vfp
fragmentMap 0 _currentRender
{
  blend fragmentMap 1
  map textures/sfx/vp1.tga // the normal map for distortion
  scale 2,2
}
{
  blend fragmentMap 2
  map textures/sfx/vp1_alpha.tga // the distortion blend map
  scale 2,2
}
}
}


That's the only way I'm familiar with scaling them in a material shader but like I said, I don't know if it will work with a fragmentmap.

If it doesn't work you'll have to make resized copies of the two tgas manually.



Weazel@Posted: Tue Aug 10, 2004 6:44 pm :
thanks for the tip I'll keep that in mind for the future, I fixed my problem by just using the surface editor in doom3ed to scale the texture to a high value which fixed my issue...

Next step get the water to reflect like a mirror :) I'll keep you posted...

And again thanks for all your help...



Rayne@Posted: Tue Aug 10, 2004 7:10 pm :
The Mirror rendermap code...


;)


Code:
{
      mirrorRenderMap      512   256      // size of the texture to draw the mirror view in
      blend   blend

      // give it a greenish tint
      red      0.3
      green   0.3
      blue   0.1

      // opacity
      alpha   0.7

      // these may not be necessary when I finish the code
      translate   0.5 , 0.5
      scale   0.5 , 0.5
   }



Weazel@Posted: Tue Aug 10, 2004 7:50 pm :
do I just add that mirror code into my shader code? Or is there another use...

Thanks in advance...



Weazel@Posted: Tue Aug 10, 2004 9:59 pm :
Rayne you rock...

It's perfect now... Here's the whole working code....

Code:
textures/stargate/event_horizon
{
discrete // Not sure what this is used for
nonsolid
//water // add this for water effect swimming etc...

diffusemap textures/water/water1.tga

{
vertexProgram heatHazeWithMask.vfp
vertexParm 0 time * 0.1 , time * 0.5 // texture scrolling
vertexParm 1 1.5 // magnitude of the distortion
fragmentProgram heatHazeWithMask.vfp
fragmentMap 0 _currentRender
fragmentMap 1 textures/sfx/vp1.tga // the normal map for distortion
fragmentMap 2 textures/sfx/vp_full.tga // the distortion blend map
} // End Heat Haze Effect

{
mirrorRenderMap      512   256  // size of the texture to draw the mirror view in
blend   blend

// give it a greenish tint
red      0.3
green   0.3
blue   0.1

// opacity
alpha   0.7

// these may not be necessary when I finish the code
translate   0.5 , 0.5
scale   0.5 , 0.5
} // End Mirror effect

} // End Shader


Thanks again...



babago@Posted: Tue Aug 10, 2004 10:09 pm :
can you post a screenshot of the finished work plz ?



Rayne@Posted: Tue Aug 10, 2004 10:17 pm :
oh, i'm workin on water the first time i saw the heat haze effect.. I saw it and said "this effect will rock to make fluids". But i spend effectively 5 minutes to make that.. I've posted a pic in the texture section


HERE



this is a pic, but i'm sure the Weazel one looks much much better



babago@Posted: Tue Aug 10, 2004 10:22 pm :
:shock: wahou :shock:

a really really good work. I never expected that ! It's really, good ! I'm thinking this water effect is just awsome.



Magical Gnome@Posted: Wed Aug 11, 2004 12:42 am :
Cool effect... could you create a short tutorial perhaps? Pretty please? :lol:



Iced_Eagle@Posted: Wed Aug 11, 2004 1:28 am :
That is really cool :)

Only bad thing though...... Only works on Geforce FX and Radeon 9500 and above :(

Luckily I have a 9600 so I can enjoy the wtaer muhahah :twisted: