Sky/water horizon blending?


(neotic) #21

I got it working, my only question… is that my water brush seems to be cut in have in a sense. I have my water brush with the shader applied. The brush is half invisible on the side covered with the alpha_0 shader. It looks kind of like this diagram below.

(alpha_0 brush) + (water brush begins) | (first half of brush, invisible) | (second half of brush, water is apparent and fades out nicely)
| |
| |
| |


(Mr_Tickles) #22

Hmmm, do you have a screenie please?
I think I get it, but there’s nothing like a good pic to make sure :slight_smile:


(neotic) #23

Sure can bud; in the below image you can see what I mean. The top layer on the left is where the water actually starts. On the top layer to the right you can see how close the shader is to the cement block. In the background picture you can see that the distance between the water drawn and the cement block has been greatly increased. Other than that it works great; it blends right out to the end. LoL i hope the floor terrain wont give me these problems… but ill worry about that after this. :smiley:

Thanks again mate.


(Mr_Tickles) #24

Lol, No probs :slight_smile:
There shouldn’t be any problems with the ground terrain.

I’m still trying to get those damn water textures to line up, nightmare! :smiley:


(ratty redemption) #25

sorry I havent been able to help you guys yet, but Ive really busy helping a couple of other mappers… if you guys havent got this all working, then Ill help you once I`ve got some free time.

and from what I`ve briefly read of this topic your both on the right track with the blending and what your both trying to do is definitely possible.


(Mr_Tickles) #26

Right, just thought I’d update the thread with some details for completeness sake.

After a week or two’s break, I’ve just come back to this and this is the result:

If you look from close to surface level, the sea seems to disappear into the distance like a real ocean and there’s no need for battery style fog. So now we can have a clear day with this effect. v57!

As you can see below, if you look closely, there is a seam at the edges of the water where there is a slight HOM effect, this is where the two water bodies were joined.


(neotic) #27

Could you post your shader there? Looks real nice… but I have a bright sky… so I’m not sure if it would work for me.


(Mr_Tickles) #28

I don’t see why it wouldn’t, I recently had a run around saberpeak and it looks as though it works fine in there. I’ve changed the LT128 to GT0 now, just to let you know…

textures/mr_tickles/mutual/water_fade
{
	qer_editorimage textures/mr_tickles/mutual/sea1x512
	qer_trans .5
	q3map_forcemeta
	q3map_nolightmap
	surfaceparm nonsolid
	surfaceparm nomarks
	surfaceparm trans
	q3map_tcmod rotate -100
	q3map_tcgen ivector ( 512 0 0 ) ( 0 512 0 )
	deformVertexes wave 12 sin 0 3 0 .25
	surfaceparm water
	nopicmip
	polygonoffset
	{
		map textures/mr_tickles/mutual/sea2x512.tga
		blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
		alphagen oneminusvertex  // inverses the value of the volume alpha
		alphafunc GT0
		tcmod turb 0 0.003 0.5 0.5
		tcmod scroll 0.001 -0.02
	}
}

You need a reasonably sized brush, but you have to play around with it until it looks right.
I thought I used a fully white alpha channel, but I’ve just opened the .tga and it has a medium grey alpha channel.


(NOP) #29

The blending on saberpeak is a little more complicated than what you posted. The problem comes from the fact that the water has to ALWAYS be transparent which means that you can ALWAYS see what’s behind it which causes a whole lot of issues when trying to blend it into the horizon. To make things even worse, you also have to do a blend between the underwater sand and the ocean as it goes out to open sea and you also have to maintaining the water appearance when looking inside out.
I got a lot of mail from people asking me how the water and terrain blending was done so I’m currently writing a bunch of tutorials about it. One of them(together with some notes on alpha blending) is already up, but it deals with terrain blending so it won’t help you much with this problem. You can check it here. The rest of them should be up soon, including the ones dealing with the water blending.

Anyway, the shaders performing the horizon blending for sabepeak are in a section named WORLD EDGE MERGING SHADERS towards the end of saberpeak.shader
The one doing the merging from water to sky is called …/SP_skyWaterMerge.
I hope you can make some sense out of them even though you don’t have the source files for the map. Hopefully I will get done with the map soon and release them.
The basic idea for the blend is very simple; basically the shader performs a blend between the water and an RGB value used for the horizon. The RGB value is the same one used for the sky mask so the blend looks seamless (the RGB value should actually be a little “darker” than the one in the sky mask because of the way the sky mask works but that’s beyond the point). Also the water brush extends out quite a bit (around 4000 units i think) and it also rises up as it goes out to give the impression that it continues further than it actually does.
I recommend you use textures WITHOUT alpha channels for the water and achieve the transparency desired for the water using alphaMod brushes. This will not only save you space(since you can use .jpg’s) but will also make the horizon blending a lot easier. Saberpeak uses textures WITH alpha channels but that was a mistake made by me in the early stages and I was too lazy to change it latter, even though it gave me so many headaches when I did the merge with the horizon and forced me to make a bunch of useless brushwork and shaders.


(Mr_Tickles) #30

Yeah, I found that the sea bed needed a bit of blending aswell and that it needed to go to the sky shader colour, but just a simple blend to nothing with the sea seemed to do it fine for me (i.e. without using the RGB). I used the radar sky and didn’t get a HOM at all. Maybe it’s because NOP’s map is very bright and shows this up better. The distance I used wasn’t as great as 4000 units however (just 2500), but I suppose if your players are going to be higher, you’d need that greater distance.

Just refreshing screenies aswell:





(rgoer) #31

If you use an octagon shape for your water “block” and sky “box” the blending becomes pretty unnoticeable