Herr W@Posted: Tue Aug 15, 2006 1:56 pm Post subject: water material affects texture blending:
I've got a question about texture-blending:
After finally managing to get Lloyd Markle's extra-cool water into my map, I had to find out that it's material conflicts with that of my cartoon-outlines. The result looks like this:

I examined it, and it seems as if the first material stage (vertexprogram... vp_water.tga) causes the problem.
Code: | textures/Water_source/water_clear
{
qer_editorimage textures/water_source/w_c_editor.tga
discrete
nonsolid
water
twosided
translucent
// sort far
deform turbulent sinTable 0.0175 (time*0.15) 10
{
vertexProgram heatHazeWithMask.vfp
vertexParm 0 time * 0.1 , time * 0.5
vertexParm 1 1.5
fragmentProgram heatHazeWithMask.vfp
fragmentMap 0 _currentRender
fragmentMap 1 textures/sfx/vp1.tga
fragmentMap 2 textures/water_source/vp_water.tga
}
{
blend blend
map textures/water_source/water_clear.tga
translate time*.0,time*-.01
alpha 0.5
}
} |
Without that stage the water blends beneath everything outside as intended, but I think it would be a pity to forgo that nice effect.
Has anybody an idea what to change in one or both materials?
(Cartoon outline material:)
Code: | textures/bb2/outline
{
noselfShadow
noShadows
unsmoothedTangents
forceOverlays
backSided
nonsolid
sort close
{
blend blend
map textures/bb2/outline.tga
}
} |
_________________ Visit Herr W's MONKEY KOMBAT Arena at http://monkeykombat.planetquake.gamespy.com ! |
rebb@Posted: Tue Aug 15, 2006 4:05 pm Post subject: : Thats the same Problem that causes your Gun's outline to be distorted when it is over a distortion-shader ( which looks all kinds of ass ).
The distorting fragment-program is using the _currentRender image, which holds, well, the current Render before any distortion is applied.
Since this also contains your Cel-Shaded Outlines and Geometry, those get distorted as well. _________________ ( imagine obnoxiously huge Image here ) |
Manc@Posted: Tue Aug 15, 2006 4:34 pm Post subject: : Unfortunately this is something that has carried over in other doom3 engine-based games as well. There's nothing that can be done from a modmaker's standpoint to correct this. The best you can do is fiddle with the parameters to make the effect less distorted and hopefully less noticeable outside distortion combined with just generally mapping around it. _________________ Mike @ MancuNET |
klonsemann@Posted: Tue Aug 15, 2006 6:02 pm Post subject: : Take a look at this watermaterial. The modder has coded a new glprog witch sloves this problem and generades very nice wave-reflection-deforms. 
By the side, nice Cartoonlook !! Is there a larger project, these materials are for ?
#EDIT# Just visited your homepage, great stuff ! _________________ Not the stupid editor makes the bad maps, but bad mappers do ! |
Herr W@Posted: Wed Aug 16, 2006 8:15 am Post subject: : Thank you all for the quick replies! Great community here at DOOM3WORLD!
Quote: | Take a look at this watermaterial. The modder has coded a new glprog witch sloves this problem and generades very nice wave-reflection-deforms. |
Good tip, klonsemann! I just had a glance at it, and that's indeed cool looking water. A major problem for my use is that it doesn't include water physics, which are absolutely vital for the gameplay of the "Bermuda Bytes" map.
But maybe I can combine it with Lloyd Markle's water... Hope that won't requiere any coding, because that isn't my world at all  _________________ Visit Herr W's MONKEY KOMBAT Arena at http://monkeykombat.planetquake.gamespy.com ! |
Herr W@Posted: Wed Aug 16, 2006 10:59 am Post subject: : Just a quick test, but it seems to work! Here is pbmax' water surrounding my cartoon-atoll...

A little dark and you can walk on top of it, but that should be solvable.
- Most important: Now there are waves PLUS outlines (plus water physics of course)! 
Big THANKS to pbmax! _________________ Visit Herr W's MONKEY KOMBAT Arena at http://monkeykombat.planetquake.gamespy.com ! |
voldemort@Posted: Wed Aug 16, 2006 1:45 pm Post subject: : try making the water volume a func_forcefield and use a target null for the target force and place it 0.125 units from the volumes origin so the player can resist it
(the further the target_null the more force applied at that close range your player can resistt it still) _________________ it was bad enough imps and maggots everywhere but when that Hellknight copped a feel that was to much now I really was in hell |
Herr W@Posted: Wed Aug 16, 2006 1:48 pm Post subject: : Hm... Not as easy as I hoped it would be. 
Testing pbmax' water in Doom3 (the screenshot above is from Quake4), I get two different effects, depending on standing outside the water (i.e. one of my islands) or on top of it.
As you can see from the screenshot, the look from on top comes close to what I would like to have, but produces a reflection error, projecting meshes from unterwater onto the surface...

I have no idea why the material behaves like that. Maybe one of you does?! _________________ Visit Herr W's MONKEY KOMBAT Arena at http://monkeykombat.planetquake.gamespy.com ! |
Rayne@Posted: Wed Aug 16, 2006 2:11 pm Post subject: : When it comes to handle reflective surfaces, DooM3 engine sucks at best... _________________ theRev is coming... |
Herr W@Posted: Wed Aug 16, 2006 2:44 pm Post subject: : Maybe I should have included pbmax' material script...
Code: | textures/pbmax/fresnel_water_pixel1
{
qer_EditorImage textures/pbmax/water1_local.tga
{
mirrorRenderMap 512 512 // size of the texture to draw the mirror view in
blend blend
alpha 0.0 //100% reflective, 0% transparent
translate 0.5, 0.5
scale 0.5, 0.5
program fresnel_water_pixel.vfp //shader program
vertexParm 0 time * 0.070 , time * 0.0 //scroll
vertexParm 1 5.00 //magnitude
fragmentMap 0 _scratch //the mirror/reflection image
fragmentMap 1 textures/pbmax/water1_local.tga //normal map for distortion & "per pixel" fresnel
}
}
textures/pbmax/fresnel_water_pixel2
{
qer_EditorImage textures/pbmax/water2_local.tga
{
mirrorRenderMap 512 512
blend blend
alpha 0.0
translate 0.5, 0.5
scale 0.5, 0.5
program fresnel_water_pixel.vfp
vertexParm 0 time * 0.040 , time * 0.0
vertexParm 1 6.00
fragmentMap 0 _scratch
fragmentMap 1 textures/pbmax/water2_local.tga
}
}
textures/pbmax/fresnel_water_vertex
{
qer_EditorImage textures/pbmax/water1_local.tga
{
mirrorRenderMap 512 512
blend blend
alpha 0.0
translate 0.5, 0.5
scale 0.5, 0.5
program fresnel_water_vertex.vfp
vertexParm 0 time * 0.040 , time * 0.0
vertexParm 1 2.00
fragmentMap 0 _scratch
fragmentMap 1 textures/pbmax/water1_local.tga
}
} |
@voldemort: I'm a little slow again...
Quote: | try making the water volume a func_forcefield and use a target null for the target force and place it 0.125 units from the volumes origin so the player can resist it | - Is that to keep the player out off the water?!
@RayneQuote: | When it comes to handle reflective surfaces, DooM3 engine sucks at best... |
... And if it carries on sucking, I simply leave that reflections out. They wouldn't be more than an extra eye-candy anyway.  _________________ Visit Herr W's MONKEY KOMBAT Arena at http://monkeykombat.planetquake.gamespy.com ! |
klonsemann@Posted: Thu Aug 17, 2006 6:14 pm Post subject: : If you use Lloyd Markle's water, there is an watermaterial too, just copy and paste PBMAX watershader in Lloyd's shader declaration. Than Lloyds physics, etc should work with PBMAX shader !
PS: Don't forget to include PBMAX glprog, its now used instead of Lloyd's. _________________ Not the stupid editor makes the bad maps, but bad mappers do ! |
voldemort@Posted: Thu Aug 17, 2006 7:52 pm Post subject: : the forcefield would create a controlled decent like you where sinking
otherwise player would drop like a stone
func_forcefields can pull and push both _________________ it was bad enough imps and maggots everywhere but when that Hellknight copped a feel that was to much now I really was in hell |
Herr W@Posted: Fri Aug 18, 2006 8:37 am Post subject: : Quote: | If you use Lloyd Markle's water, there is an watermaterial too, just copy and paste PBMAX watershader in Lloyd's shader declaration. Than Lloyds physics, etc should work with PBMAX shader! |
Don't know why, but this produces the most remarkable results. My favourite is this one:

Keeping both seperate works, but I can't get rid of that reflection error mentioned above. And without reflexions the effect is anything but spectacular:

Maybe some finetuning brings better results...
Quote: | the forcefield would create a controlled decent like you where sinking |
Now I got it 
Sounds like a smart and elegant way to create the water effect! I'll try it out on the Quake4 version of my map. In Doom3 Lloyd's water physics are doing a great job. Unfortunately all attempts to bring them into Quake4 failed until now, so your idea comes to the best point of time.
Thank you all! _________________ Visit Herr W's MONKEY KOMBAT Arena at http://monkeykombat.planetquake.gamespy.com ! |
Herr W@Posted: Fri Aug 18, 2006 10:02 am Post subject: : Quote: | the forcefield would create a controlled decent like you where sinking |
I just tried it out: The vertical force simulates water physics very well, but the horizontal is so strong that the player can't move a centimeter towards the target_null  _________________ Visit Herr W's MONKEY KOMBAT Arena at http://monkeykombat.planetquake.gamespy.com ! |
voldemort@Posted: Fri Aug 18, 2006 1:25 pm Post subject: : distance relattionship between the target null and forcefield afffects overall force
example if you only wanted slow movement (no pull no push) you would place the target null with the exact same origin as the forcefield but for a slow drag down allgn it the same on x&y but on z move it down 0.125 grid units and this will give a gentle pull down _________________ it was bad enough imps and maggots everywhere but when that Hellknight copped a feel that was to much now I really was in hell |
Herr W@Posted: Sat Aug 19, 2006 8:55 am Post subject: : Quote: | for a slow drag down allgn it the same on x&y but on z move it down 0.125 grid units and this will give a gentle pull down |
Hm... I'm pretty sure I did it exactly as you suggested, but there's still that horizontal force that blocks the player from moving in x or y direction  _________________ Visit Herr W's MONKEY KOMBAT Arena at http://monkeykombat.planetquake.gamespy.com ! |
Herr W@Posted: Tue Aug 15, 2006 1:56 pm Post subject: water material affects texture blending: I've got a question about texture-blending:
After finally managing to get Lloyd Markle's extra-cool water into my map, I had to find out that it's material conflicts with that of my cartoon-outlines. The result looks like this:

I examined it, and it seems as if the first material stage (vertexprogram... vp_water.tga) causes the problem.
Code: | textures/Water_source/water_clear
{
qer_editorimage textures/water_source/w_c_editor.tga
discrete
nonsolid
water
twosided
translucent
// sort far
deform turbulent sinTable 0.0175 (time*0.15) 10
{
vertexProgram heatHazeWithMask.vfp
vertexParm 0 time * 0.1 , time * 0.5
vertexParm 1 1.5
fragmentProgram heatHazeWithMask.vfp
fragmentMap 0 _currentRender
fragmentMap 1 textures/sfx/vp1.tga
fragmentMap 2 textures/water_source/vp_water.tga
}
{
blend blend
map textures/water_source/water_clear.tga
translate time*.0,time*-.01
alpha 0.5
}
} |
Without that stage the water blends beneath everything outside as intended, but I think it would be a pity to forgo that nice effect.
Has anybody an idea what to change in one or both materials?
(Cartoon outline material:)
Code: | textures/bb2/outline
{
noselfShadow
noShadows
unsmoothedTangents
forceOverlays
backSided
nonsolid
sort close
{
blend blend
map textures/bb2/outline.tga
}
} |
_________________ Visit Herr W's MONKEY KOMBAT Arena at http://monkeykombat.planetquake.gamespy.com ! |
rebb@Posted: Tue Aug 15, 2006 4:05 pm Post subject: : Thats the same Problem that causes your Gun's outline to be distorted when it is over a distortion-shader ( which looks all kinds of ass ).
The distorting fragment-program is using the _currentRender image, which holds, well, the current Render before any distortion is applied.
Since this also contains your Cel-Shaded Outlines and Geometry, those get distorted as well. _________________ ( imagine obnoxiously huge Image here ) |
Manc@Posted: Tue Aug 15, 2006 4:34 pm Post subject: : Unfortunately this is something that has carried over in other doom3 engine-based games as well. There's nothing that can be done from a modmaker's standpoint to correct this. The best you can do is fiddle with the parameters to make the effect less distorted and hopefully less noticeable outside distortion combined with just generally mapping around it. _________________ Mike @ MancuNET |
klonsemann@Posted: Tue Aug 15, 2006 6:02 pm Post subject: : Take a look at this watermaterial. The modder has coded a new glprog witch sloves this problem and generades very nice wave-reflection-deforms. 
By the side, nice Cartoonlook !! Is there a larger project, these materials are for ?
#EDIT# Just visited your homepage, great stuff ! _________________ Not the stupid editor makes the bad maps, but bad mappers do ! |
Herr W@Posted: Wed Aug 16, 2006 8:15 am Post subject: : Thank you all for the quick replies! Great community here at DOOM3WORLD!
Quote: | Take a look at this watermaterial. The modder has coded a new glprog witch sloves this problem and generades very nice wave-reflection-deforms. |
Good tip, klonsemann! I just had a glance at it, and that's indeed cool looking water. A major problem for my use is that it doesn't include water physics, which are absolutely vital for the gameplay of the "Bermuda Bytes" map.
But maybe I can combine it with Lloyd Markle's water... Hope that won't requiere any coding, because that isn't my world at all  _________________ Visit Herr W's MONKEY KOMBAT Arena at http://monkeykombat.planetquake.gamespy.com ! |
Herr W@Posted: Wed Aug 16, 2006 10:59 am Post subject: : Just a quick test, but it seems to work! Here is pbmax' water surrounding my cartoon-atoll...

A little dark and you can walk on top of it, but that should be solvable.
- Most important: Now there are waves PLUS outlines (plus water physics of course)! 
Big THANKS to pbmax! _________________ Visit Herr W's MONKEY KOMBAT Arena at http://monkeykombat.planetquake.gamespy.com ! |
voldemort@Posted: Wed Aug 16, 2006 1:45 pm Post subject: : try making the water volume a func_forcefield and use a target null for the target force and place it 0.125 units from the volumes origin so the player can resist it
(the further the target_null the more force applied at that close range your player can resistt it still) _________________ it was bad enough imps and maggots everywhere but when that Hellknight copped a feel that was to much now I really was in hell |
Herr W@Posted: Wed Aug 16, 2006 1:48 pm Post subject: : Hm... Not as easy as I hoped it would be. 
Testing pbmax' water in Doom3 (the screenshot above is from Quake4), I get two different effects, depending on standing outside the water (i.e. one of my islands) or on top of it.
As you can see from the screenshot, the look from on top comes close to what I would like to have, but produces a reflection error, projecting meshes from unterwater onto the surface...

I have no idea why the material behaves like that. Maybe one of you does?! _________________ Visit Herr W's MONKEY KOMBAT Arena at http://monkeykombat.planetquake.gamespy.com ! |
Rayne@Posted: Wed Aug 16, 2006 2:11 pm Post subject: : When it comes to handle reflective surfaces, DooM3 engine sucks at best... _________________ theRev is coming... |
Herr W@Posted: Wed Aug 16, 2006 2:44 pm Post subject: : Maybe I should have included pbmax' material script...
Code: | textures/pbmax/fresnel_water_pixel1
{
qer_EditorImage textures/pbmax/water1_local.tga
{
mirrorRenderMap 512 512 // size of the texture to draw the mirror view in
blend blend
alpha 0.0 //100% reflective, 0% transparent
translate 0.5, 0.5
scale 0.5, 0.5
program fresnel_water_pixel.vfp //shader program
vertexParm 0 time * 0.070 , time * 0.0 //scroll
vertexParm 1 5.00 //magnitude
fragmentMap 0 _scratch //the mirror/reflection image
fragmentMap 1 textures/pbmax/water1_local.tga //normal map for distortion & "per pixel" fresnel
}
}
textures/pbmax/fresnel_water_pixel2
{
qer_EditorImage textures/pbmax/water2_local.tga
{
mirrorRenderMap 512 512
blend blend
alpha 0.0
translate 0.5, 0.5
scale 0.5, 0.5
program fresnel_water_pixel.vfp
vertexParm 0 time * 0.040 , time * 0.0
vertexParm 1 6.00
fragmentMap 0 _scratch
fragmentMap 1 textures/pbmax/water2_local.tga
}
}
textures/pbmax/fresnel_water_vertex
{
qer_EditorImage textures/pbmax/water1_local.tga
{
mirrorRenderMap 512 512
blend blend
alpha 0.0
translate 0.5, 0.5
scale 0.5, 0.5
program fresnel_water_vertex.vfp
vertexParm 0 time * 0.040 , time * 0.0
vertexParm 1 2.00
fragmentMap 0 _scratch
fragmentMap 1 textures/pbmax/water1_local.tga
}
} |
@voldemort: I'm a little slow again...
Quote: | try making the water volume a func_forcefield and use a target null for the target force and place it 0.125 units from the volumes origin so the player can resist it | - Is that to keep the player out off the water?!
@RayneQuote: | When it comes to handle reflective surfaces, DooM3 engine sucks at best... |
... And if it carries on sucking, I simply leave that reflections out. They wouldn't be more than an extra eye-candy anyway.  _________________ Visit Herr W's MONKEY KOMBAT Arena at http://monkeykombat.planetquake.gamespy.com ! |
klonsemann@Posted: Thu Aug 17, 2006 6:14 pm Post subject: : If you use Lloyd Markle's water, there is an watermaterial too, just copy and paste PBMAX watershader in Lloyd's shader declaration. Than Lloyds physics, etc should work with PBMAX shader !
PS: Don't forget to include PBMAX glprog, its now used instead of Lloyd's. _________________ Not the stupid editor makes the bad maps, but bad mappers do ! |
voldemort@Posted: Thu Aug 17, 2006 7:52 pm Post subject: : the forcefield would create a controlled decent like you where sinking
otherwise player would drop like a stone
func_forcefields can pull and push both _________________ it was bad enough imps and maggots everywhere but when that Hellknight copped a feel that was to much now I really was in hell |
Herr W@Posted: Fri Aug 18, 2006 8:37 am Post subject: : Quote: | If you use Lloyd Markle's water, there is an watermaterial too, just copy and paste PBMAX watershader in Lloyd's shader declaration. Than Lloyds physics, etc should work with PBMAX shader! |
Don't know why, but this produces the most remarkable results. My favourite is this one:

Keeping both seperate works, but I can't get rid of that reflection error mentioned above. And without reflexions the effect is anything but spectacular:

Maybe some finetuning brings better results...
Quote: | the forcefield would create a controlled decent like you where sinking |
Now I got it 
Sounds like a smart and elegant way to create the water effect! I'll try it out on the Quake4 version of my map. In Doom3 Lloyd's water physics are doing a great job. Unfortunately all attempts to bring them into Quake4 failed until now, so your idea comes to the best point of time.
Thank you all! _________________ Visit Herr W's MONKEY KOMBAT Arena at http://monkeykombat.planetquake.gamespy.com ! |
Herr W@Posted: Fri Aug 18, 2006 10:02 am Post subject: : Quote: | the forcefield would create a controlled decent like you where sinking |
I just tried it out: The vertical force simulates water physics very well, but the horizontal is so strong that the player can't move a centimeter towards the target_null  _________________ Visit Herr W's MONKEY KOMBAT Arena at http://monkeykombat.planetquake.gamespy.com ! |
voldemort@Posted: Fri Aug 18, 2006 1:25 pm Post subject: : distance relattionship between the target null and forcefield afffects overall force
example if you only wanted slow movement (no pull no push) you would place the target null with the exact same origin as the forcefield but for a slow drag down allgn it the same on x&y but on z move it down 0.125 grid units and this will give a gentle pull down _________________ it was bad enough imps and maggots everywhere but when that Hellknight copped a feel that was to much now I really was in hell |
Herr W@Posted: Sat Aug 19, 2006 8:55 am Post subject: : Quote: | for a slow drag down allgn it the same on x&y but on z move it down 0.125 grid units and this will give a gentle pull down |
Hm... I'm pretty sure I did it exactly as you suggested, but there's still that horizontal force that blocks the player from moving in x or y direction  _________________ Visit Herr W's MONKEY KOMBAT Arena at http://monkeykombat.planetquake.gamespy.com ! |