Jump to content

Realistic Water Splash


Go to solution Solved by Vegeta,

Recommended Posts

Recently I've been experimenting with a more realistic water splash .gfx, since the multiplayer default is a still image that gets placed on the surface of water when wading in it.  I've tried a few different methods now, but none seam to be supported by the multiplayer code.

 

First I attempted to use an animmap on the wake shader, which by default maps that still framed image (gfx/misc/splash.jpg), to play through a sequence of .jpgs that complete a loop-able animation.  For some reason the new shader was ignored, and instead the still image was used.  I even attempted deleting the old splash.jpg from the base assets in an experiment, however when I tested it in game, I recieved an error when in water, caused by the image not being found.

 

After continuing to modify my animated shader with no luck, I attempted to replace the single framed .jpg, with a .gif as a sort of last resort, but of course this did nothing.  And now I'm considering using a videomap in the shader that links to a looped .roq video with the same image sequence as the .gif.  I really doubt that this will work though, and may not even try it, based on the results of my first tests.

 

If anyone else has any ideas of what I can try next, your input would be appreciated.  Thanks in advance.

Langerd likes this
Link to comment

@@eezstreet
 
I already looked at the env water effects to make sure there wasn't an .efx governing the graphic, but after testing them all, I was unable to find any that simply displayed this motionless .jpg.  At this point I'm pretty sure it's just built into the multiplayer .dlls.
 
On a side note, the single player wading through water does appear to use an effect, and is capable of being animated using any method.
 
 
In case anyone is unclear as to what I'm talking about, this is what the effect looks like in the multiplayer game

 

splash.jpg

 

 

And this is the animated version that I developed and am trying to get in game

 

splash.gif

 

Edited by Vegeta
Langerd and Ramikad like this
Link to comment

What's the exact warning you get in the console after you removed the base water image? It could be that it's a warning about the JPG format of your new image. The images must be saved as interlaced JPGs, not progressive.

 

Be sure to test your changes by putting them in a .pk3 archive. It should be alphabetically after all the base assets, and many people use a convention like z_animatedwater.pk3 when testing. (You might know this already and it might be patronising)

 

EDIT: This is the code that draws the water wake shader, in case another coder can spot something I've missed that would prevent an animated shader being used: https://github.com/JACoders/OpenJK/blob/master/codemp/cgame/cg_players.c#L4791

Link to comment

I actually tried changing the "wake" shader first thing, but couldn't get it to work.  The game continued to use the old wake shader which used the still splash image.  Maybe I'm doing something wrong?

 

Anyways, here's what the shader file looked like when I tried to put it in game

 

 

wake
{
	cull	twosided
    {
	animMap 9 gfx/misc/splash gfx/misc/splash2 gfx/misc/splash3 gfx/misc/splash4 gfx/misc/splash5 gfx/misc/splash6 gfx/misc/splash7 gfx/misc/splash8 gfx/misc/splash9 
        blendFunc GL_ONE GL_ONE
        rgbGen vertex
    }
}

 

 

Link to comment

Are you putting the shader into a PK3? What .shader is the original wake shader in? What is the name of your .shader file?

Unrelated, but I'm pretty sure GL_ONE GL_ONE is the wrong blendFunc. This is equivalent to blendFunc identity if I'm not mistaken.

Link to comment

@@eezstreet

 

Yes, I've been placing the new .shader file in a pk3.  The shader file is titled new_water.shader, the pk3 is titled module5.pk3, and I did remember to add "new_water" to the shaderlist.txt.

 

The original wake shader is the third shader defined in gfx.shader.

 

And I'm not really sure why I left "blendFunc GL_ONE GL_ONE" in the new shader, I suppose because it was part of the old shader and I was basing the new one off of the original  in this instance.

Link to comment

Well, I've placed the .pk3s in both the base folder and my personal mod folder for testing, and both yield the same result.

 

As for the .jpg format, it was my understanding that Jedi Academy doesn't support progressive .jpgs, so I've been leaving that export option unchecked after creating new textures or gfx.

Link to comment
  • Solution

Oh, sorry.  I suppose I read your question incorrectly the first time.  I place the .shader files in the folder titled "shaders" within the .pk3s.

 

@@eezstreet

 

I'm not sure why, but your suggestion worked.  The game must have been determined to use the original gfx.shader file over the new one that I created, because as a result, overwriting the old gfx.shader worked.  Do you have any idea why the new .shader files I was making could not overwrite the old one?

Edited by Vegeta
Link to comment

Oh, sorry.  I suppose I read your question incorrectly the first time.  I place the .shader files in the folder titled "shaders" within the .pk3s.

 

@@eezstreet

 

I'm not sure why, but your suggestion worked.  The game must have been determined to use the original gfx.shader file over the new one that I created, because as a result, overwriting the old gfx.shader worked.  Do you have any idea why the new .shader files I was making could not overwrite the old one?

 

what did you name your new shaderfile like ?

they re loaded in a set order afaik and if the old shader file is loaded after your new shaderfile it will overwrite the information from your file with the original file information

Link to comment

@@AshuraDX

 

Ah, that makes so much more sense.  I thought that it only worked that way with .pk3, but if the individual .shader files load in an alphabetical order, and two .shader files define the same shader with different properties, then the one coming afterwards would likely have dominance over the other.  Although, I'm still not quite sure, because the new .shader was titled "new_water", while the old one was "gfx", so I would assume that the new one would come first.  Perhaps there is something else that I'm overlooking.

Link to comment

Unintuitively, shaders earlier in the alphabet are preferred over ones later (so gfx.shader would override new_water.shader). There's no guarantee that this will be the same with different engines like OpenJK though, it's pretty much just an internal quirk.

Link to comment

@@Didz

 

Alright, good to know.  Thanks for the information, I'll keep it in mind for future projects.  :D

Try to put into pk3 an edited version of gfx files that contain wake shaders. edit the wake shader field. ;)

PS:after you extract by JKA  you need to uncheack the file about "only reading" in this properties, or you cannot edit the text.

Link to comment
  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...