using the new alphaMods to make water


(NOP) #1

I’ve been trying to get several blue shades of water using the new alphaMod features of the latest q3map2 release. What I’m trying to do is get the water to go from blue to light blue to almost completely transparent(see screenshot below).

Now I can get the first two shades alright, but I’m having truble making the second shade(light blue) gradually go completely transparent. The shaders for the two colors I have so far are below. It’s my understanding that to make something go completely transparent with the new alphaMod commands I have to use the GL_SRC_ALPHA GL_ONE function on every stage. This however completely screws up the color of my water cause everything becomes extermely bright and it doesn’t match the rest of the water.

Any Idea on how to make textures/water_test/shallowWater gradually go fully transparent?


textures/water_test/deepWater
{
	qer_editorimage textures/water/ocean5.tga
	cull none
	surfaceparm trans
	surfaceparm nonsolid
	surfaceparm water
	surfaceparm pointlight
	{ 
		map textures/water/ocean5.tga
		blendFunc blend
		rgbGen identity
		alphaGen const .7
		tcmod scroll 0.005 0.03

	}

}

textures/water_test/shallowWater
{
	qer_editorimage textures/water/ocean4.tga
	cull none
	surfaceparm trans
	surfaceparm nonsolid
	surfaceparm water
	surfaceparm pointlight

	{ 
		map textures/water/ocean5.tga
		blendFunc blend
		rgbGen identity
		alphaGen const .7
		tcmod scroll 0.005 0.03

	}

	{
		map textures/water/ocean4.tga
		blendFunc GL_SRC_ALPHA GL_ONE
		rgbGen wave sin 0.4 0.1 0.25 0
		alphaGen vertex
		tcMod turb 0 0.05 0 0.15
		tcmod scroll -0.01 0.08
	}
}


(ratty redemption) #2

you can use blendfunc blend instead of GL_SRC_ALPHA GL_ONE which won`t get brighter with each stage.

also I would replace the rgbGen identity lines with rgbGen vertex, as identity is only really used with overbright bits iirc, and it will also mean those stages will be brighter then rgbGen vertex is likely to produce.


(NOP) #3

Yeah but then the alphaMod commands(brushes) won’t work(i think). I’ll try it out though anyway

EDIT: they’re working but now the rest of the water becomes fully opaque. I’ll work on it some more see what I can do.


(ratty redemption) #4

if you cant get it working, I could help you write the shader if you want, including adding in the foam blend for when your waves hit the beach... Ive been thinking about how this could be done and although I haven`t tested it yet, I think I know how to do it with the new alphamods.


(NOP) #5

:clap: I finally made it work. I got stuck there for a while cause ydnars common shaders were wrong(they gave all 75% opacity) and it took me quite a bit to figure that out. I was about to report it when I saw that ratty had already reported it(gotta learn to read stuff through at some point)
Anyway @ratty i followed your suggestion and with some tweaking it worked. Thanks a lot and thanks for suggesting this method to me in the first place in the editing forum.

Here’s a screenie


(NOP) #6

ha…you beat me to it(my post was 3 min after yours).
I will try to add the foam too…right now I was just trying to get the transparency right. Thanks for everything…if I get stuck I’ll post again or maybe I’ll PM you if that’s alright


(Davros) #7

NOP, can u post a sample map with shaders?


(NOP) #8

Here’s a little sample map for the water. The shaders are as simple as I could get them to be. It’s just a template showing how to blend two different kinds of water colors and then make them almost completely transparent. It also shows how to put small spots of different color water in certain places(like around a rock in the sea).

It should be relatively easy to add more stages to the shaders for more effects(i.e. foam over the clear portion).
The textures I used are very very plain(pretty much just placeholers)…replace them with your own to get the kind of water you want. Also add the tcMod’s etc…to the different stages to get various water effects.

  1. You need the latest version of q3map2 2.5.14… the one that supports grouping of alphaMod brushes.
  2. Make sure it is using the common shaders I included cause the ones initially suplied with 2.5.14 had a small bug in them.

Like I said, I stripped the shaders to the bare bones so they were as simple as posible understand, but if you have any questions feel free to ask.


(ratty redemption) #9

@NOP, this is great news, not just that I`ve helped inspire people to use soft edge water as I like to call it, but also great that you figured it out so quickly and have got good looking results, and in turn are now helping others to use it as well …I believe these effects will had a new depth of realism to our maps :slight_smile:

Im currently working with gerbil, to convert my large rtcw terrain and water test map, into a playable et map, although Ive little left to do, as gerbil is building the man made structures, and doing all the scripting work, being the expert he is with those, and we will be releasing the source files once were happy with them.

also when Ive finished off my parts of the map, Im going to start on the terrain building and blending tutorials, I mentioned a few weeks back in the et editing forum, and this will also cover all stages of making water, that I can think of.

so if anyone wants to contribute to it, I`m sure we can find even more effects and improved ways of making them then I had originally planned.

tbh, I hadn`t thought of making a foam blend stage, for sea water until you mentioned it, although when you did, I knew roughly how it could be done.

but several of us mappers regularly using and developing this technology, with the support of ydnar`s excellent tools, is definitely better for all concerned then me spending months testing new blending methods on my own, which could also get quite boring at times.

ironically, it took me that long to learn how to use, the now redundant alphamaps, to make my soft edge water for the waterfalls, castle moat and winding stream in my terrain map, and the process was very slow as the results were often unpredictable, although it all looks very nice imo, and I`ve managed to keep the fr pretty high :slight_smile:

but even more ironic, now I`ve done a quick test map on a copy of my waterfalls, using the alphamod volume brushes, as ydnar calls them, which took me about 5 mins to set up, as opposed to probably a whole working day to paint the fiddly little alphamaps and tweak the waterfall meshes, and the results look identical.

so over the next few days, Im going to quickly strip out all the evil little alphamaps and replace them with alphamod brushes, because I know hardly any mappers would be foolish enough to use alphmaps to achieve what I did, when they now can produce equally as good results in a fraction of the time, iow, I dont want to release a map to the public with a redudant construction method in it.

eh, sorry this post was very winded guys, but Im really excited to see what we can come up with in our terrain maps, and Im willing to help any one learn this stuff if I can find time …so feel free to pm me or post any questions, or comments on improving our shaders, brush and mesh work etc.


(ratty redemption) #10

pic 1 shows on the left, the new alphamod volume blending, being used to make a soft edge waterfall, on the right is my previous alphamap (indexed bitmap) version… to me they look identical, but the new one was built in a fraction of the time, litterally mins compared to a whole working day for the old method.

pic 2 shows the advantage of soft edge water, on the right, compared to normal hard edge water on the left… the soft edge version also has my alpah channeled, shader based, water mist.

although I`ve yet to try the target_smoke entity as suggested by Drakir, has anyone tried to make water mist using that yet?


(ydnar) #11

This demonstrates alphaMod volume quite well. Thanks ratty :slight_smile:


(ratty redemption) #12

@ydnar, Im glad you like it, and it is a pleasure to map with, plus Im sure we can find many interesting uses for it :slight_smile:

edit: also we should point out, the terrain in those pics is using ydnar`s alphamod dotproduct2 blends, which I also love working with :slight_smile:

Ill be releasing the source files for that waterfall once Im totally happy with it, but it really isn`t difficult to set up.


(G0-Gerbil) #13

Ratty you poor poor b@#$%d :wink:
Your six months effort on the terrain will now be done in a few minutes :stuck_out_tongue:
Actually, is there any word of Ydnar supporting the alphamod brushes in groups so you can have brushes sharing the same location but blending the textures seperately?
I’d love for that, and unless I missed something, I think you said it wasn’t supported and Ydnar mentioned summat about ‘thouight about it but nope’. Would love it in :slight_smile:

Now to go sort my fuzzy edge terrain in helmsdeep - another big bit of help from Ratty which is now kinda redundant sob


(NOP) #14

They’re already implemented…the sample map i provided uses them. Idnar released another version of 2.5.14 that has this feature implemented after ratty asked for it…just follow the release thread at the top of the forum.


(ratty redemption) #15

Ratty you poor poor b@#$%d
Your six months effort on the terrain will now be done in a few minutes

lol, I know :blah:  :blah: 

I honestly have lost count how many times I`ve done major rebuilds on that terrain and water test map, but at least the new tools are now allowing us to replace redundant methods very quickly, and personally I find them much more fun to work with :banana: 

especially as it was an excuse for me, to make some more editor images, which gerbil knows I have a habit of doing… ie Ive defaced radiant and its editor images a few times, just so I can make it look more pretty, for my little mapper ratty eyes :wink:


(G0-Gerbil) #16

ie Ive defaced radiant and its editor images a few times, just so I can make it look more pretty, for my little mapper ratty eyes
You told me some of the buttons don’t HAVE an icon any more :wink:
Seriously, it’s a gerat feature - I’m just a bit suprised it took this long to make it in. I guess the thing is working with transparency can be difficult, especially to envisage the final result, so not many people have been clamouring for it (although I’m sure tons of people will use it now!). To be honest Ratty was the only person I know who was doing ‘serious’ alpha trans work before this new feature came in.
Long overdue then perhaps, but we loves it now \o/

As for the group feature, that rocks! I must admit I don’t usually follow the ‘latest build’ thread, I prefer to stick with what I know - the only reason I went there in thefirst place was cos I saw Ratty’s post and then got a bit sidetracked on the ‘dirtmapping’ which I still don’t really get :smiley:

Anyway, this one feature is fantastic, now I can update my cuastic shaders to work properly - hurrah!


(ratty redemption) #17

@Gerbil, that was during my dev stage of deciding what the new splash damage tool icons should look like on my system, so at the time instead of offending my ratty eyes with the original icons, I made the new ones invisible.

and after careful consideration of each of their functions, Ive designed a set of icons to "pictorially" represent each tool in a way best suited to my little ratty mind, heres a pic of my finished radiant 138 layout :wink:

on a more serious note, it also shows the test map of the two waterfall versions, although in the proper map, there is only the waterfalls on the right, leading down to the moat water.

the green color in the xy window is has the classname func_group2, which is an easy way for me to instruct radiant to not compile all the brushes, if I`m only working on certain ones.

I use this or region compiling a lot so I can concentrate on what Im currently building, with little clutter in the editor windows or in game, plus the func_group2 brushes will be filtered from radiants windows, along with entities, so I can easily hide them if I want to.

here`s the definition file I created to set up the color of the new group.


/*QUAKED func_group2 (0 0.8 0) ?
Used to group brushes together for editor convenience. Not compiled.
*/

this is simply added to a renamed .txt file I named ratty_entities.def which is saved in the main scripts folder, and automatically loaded up in radiant along with any other .def files found in that folder.

and to change a func_group into a func_group2 or back again, I simply bring up the entity window in radiant and edit the classname.

although be warned, its best to group worldspawn brushes into a standard func_group or other brush based entity like a script_mover, before renaming the classnames, as we dont want to actually rename worldspawn as that can corrupt the map… other then that, it`s perfectly safe to work with.

also if you look closely at the green moat brushes, you can see the various sections of water overlap each other, and often share the same verts, this is why I needed the alphamod volume brushes to behave in groups.

the end result is each section of water flows (scrolls) in the correct direction around the moat, and where they overlap there is a very smooth blend :banana:


(obsidian) #18

Would you mind sending me (or posting) the shader that you made for it?


(ratty redemption) #19

sure, but Im regularly updating or tweaking the terrain and water shaders, so do you want to wait until we have the map in beta stage or have the shader in its current form?

also if its for dev purposes rather then public release, Im happy to share the entire terrain and water shaders before our map is released, but equally I can copy out specific parts of it, like the waterfall if you just want to use that in public releases.

I hope that make sense?


(obsidian) #20

Yup…

I’m just trying to update the Shader Manual to version 2.5.14 (I was prepared to send y a copy of the 2.5.13 manual until he updated Q3Map2 again - it’s hard keeping up with him). I would just like to see that waterfall for developing purposes, so I can write something on the new alphaMod features. I won’t distribute your shaders or assets or anything, of course. I just want to experiment with it.

If you can, please send me just the waterfall in map form + shader in a zip file or something. Mail it to me… obsidianlordz (at) hotmail (dot) com

Thanks.