Got the foggy water, but also got two surfaces ???


(Mr_Tickles) #1

Ok, I’ve been trying to create some foggy water… uh oh I hear you all type, not that again. Anyway, slightly different problem. I can get the foggy water to work… finally. Trouble is that now I seem to have two out of phase waves on the surface of the water, when one is on top the water is transparent as it should be, when the other one is on top it’s opaque. Plus there’s an ugly line or boundary where the two overlap each other.

Here’s the code:

textures/mr_tickles/ocean
{
	nocompress
	nofog
	qer_editorimage textures/mr_tickles/ocean.tga
	qer_nocarve
	qer_trans .5
	q3map_globaltexture
	deformVertexes wave 256 sin 0 12 0 .5
	surfaceparm trans
	surfaceparm nonsolid
	surfaceparm water
	surfaceparm nomarks
	surfaceparm fog
	fogparms ( 0.29 0.267 0.192 ) 256
	cull disable
	nopicmip
	tesssize 1024

	{
		fog on
		map textures/mr_tickles/ocean.tga
		blendFunc GL_ONE_MINUS_DST_COLOR GL_ZERO
		alphaFunc GE128
		depthWrite
		rgbgen identity
		tcmod scale 0.4 0.2
		tcmod turb 0 0.003 0.5 0.5
		tcmod scroll -0.01 -0.01
	}
}

I know it could probably have been better arranged, but there ya go :slight_smile:


(ratty redemption) #2

Trouble is that now I seem to have two out of phase waves on the surface of the water

eh, not sure how that is happening since you appear to only have one tex stage in your shader and no rgb or alpha gen waves… if you want, post some pics of the effect in game, as that might give us a better understanding of what`s happening.

also nocompress and nopicmip will hurt your fr, so I wouldn`t use those.


(The Wanderer) #3

make sure you haven’t accidently duplicated your water brush in radiant


(ratty redemption) #4

agreed, it could be you have some z fighting caused by this.


(Mr_Tickles) #5

Nope, it wasn’t a duplicate brush, I looked for that. Also I put it into another map and didn’t duplicate there either and the same effect was happening.
I think I must just keep getting problems, without the fog parts of the shader, every thing was going so well when i tried it on my test map. However, when taking it across to the main one, the water just went up and down and didn’t form waves like it should do and did in the test map. (except for at the edge where there was a little movement). I’ve tried altering the values I have set for things but nothing is making it go right. I did a search for it before posting this thread but there wasn’t anything that helped. I am completely knackered at the moment, can’t stop my eyes from shutting so i’ll try and post some screenies when I get up later.
For the time being, just think of two sine waves, one slightly above the other, and then one of those waves 180 degrees out of phase. Oh, and one’s foggy and appears opaque and the other’s transparent.

Thanks for the replys people. See you later. Night :slight_smile:

Edit: I just read over what I posted and got about one sentence into then got lost. I’ll edit it later when it will hopefully make a bit more sense than if I do it now. (otherwise I could end up with more literal diahorrea, Yuk!)

Oh, and one other thing, I read elsewhere that the order in which the commands are laid out could affect the workings of the shader. Please tell me how you would have set it out, Thanks.

Also I was wondering if it’s possible to get slight cumulative fog without it abruptly cuting off vision at the maximum distance.


(ratty redemption) #6

this still doesn`t make sense to me, as it sounds like you have two surfaces moving out of sync with each other?

try commenting out // the deformvertexes or changing it`s div value, from 256 to the same as your tesssize.


(Mr_Tickles) #7

Ok, I’ve tried that, didn’t seem to help unfortunately. Here are some screenshots of the wave surfaces:







I have no idea.

Yes, I still have some texture editing to go, but I can’t do that till I can see it properly.
Also, for some odd reason the whole surface is just going up and down together, i.e. no waves. Execpt for a tiny bit at the edges.


(Mr_Tickles) #8

Just thought i’d post this rather amusing pic, it probably shows the problem a bit better aswell.

Yep, that’s a single brush, just remember it is moving and I caught the shot at it’s largest amplitude. There are two surfaces for every brush surface if you look closely.

EDIT: I also commented out the deformVertexes as you said ratty, and got a normal water brush:

EDIT: Also, I’ve just realised that the two 180 degree out of phase waves that I have may simply be a reflection of each other. Not that this helps me at all though.


(Java.Lang) #9

Try changing this line: deformVertexes wave 256 sin 0 12 0 .5
To this: deformVertexes wave 12 sin 0 2 0 .5

This should make your waves a lot less dramatic.

Also, only one side of your brush is going to end up having the shader on it right?
If so, why not test it in this manner too?


(MadJack) #10

I just fired Q3Ase and from what I could see…

tcMod turb 0 0.003 0.5 0.5

…is the problem

I changed it to 0.03 and it gives a nice impression. 003 is way to slow/low… anyway that might just be me…

It still looks good with Java’s changes too. So you want to try my modification.

HTH


(Mr_Tickles) #11

Woohoo! Java you’ve cured my problem with the water going up and down but not in waves! It does waves very nicely now thanks! Not too sure about the amplitude change though as it is meant to be the ocean. I will have another look at that though just to make sure. Thanks

MadJack, I thought 0.003 was quite low too but I have fiddled about with that one for a while and found that it works well and coincides with the waves nicely (I did try your suggestion however and my water rotated, not really what I was looking for, but thanks :)).

I have commented out everything but the deformVertexes line so i’m pretty sure that is still my problem with the duplicate waves.

Did you have the problem with the two waves aswell or was it just me?

EDIT: forgot the 3 in 0.003…


(MadJack) #12

:eek3: :???:

How the hell can that happen?! I mean, how can it give a roll? The movement was exactly the same… Except it was slower before. AFAIK the modificattion I did was with the speed…

Oh well… if it works the way Java told you to, that’s great! lol


(ratty redemption) #13

although I agree about the tcmod turb values being extremely subtle, these will however just affect the tex movement, not the deformvertexes… and turb isnt a rotation, its a “swirly” effect :wink:

and if you have a much wider brush, in the x y dimensions, then with the larger amplitude for deformvertexes then you should get waves and not just apparent vertical movement …this is all related to the tesssize, as the smaller the water surface tris, the smaller and more frequent the waves will be, thus needing less amplitude.

and you really should use a nodraw water shader on all but the top surface of your water brush, unless you want to create some fantasy or sci-fi looking liquid effect, here`s the dev shader I use, but you can change the paths to use your own editor images.

textures/_ratty_water/nodraw_water
{
 qer_editorimage textures/_ratty_terrain/red.tga
 q3map_notjunc
 surfaceparm nolightmap
 surfaceparm nonsolid

 //surfaceparm nodraw  // uncomment to debug

 surfaceparm water
 surfaceparm trans
 qer_trans 0.98
 cull disable
 {
  map textures/_ratty_terrain/red.tga
  blendfunc gl_src_alpha gl_scr_color
 }
}

the red.tga is just a solid red color channel with a solid 128 indexed (50%) alpha channel, so if I want to see the water brush edges in game, I uncomment the nodraw and these translucent red surfaces appear… obviously you don`t need that for the final version, so you would then change the shader so it looks like this.

textures/_ratty_water/nodraw_water
{
 qer_editorimage textures/_ratty_terrain/red.tga
 surfaceparm nolightmap
 surfaceparm nonsolid
 surfaceparm nodraw
 surfaceparm water
 surfaceparm trans
 qer_trans 0.98
}

Yep, that’s a single brush, just remember it is moving and I caught the shot at it’s largest amplitude. There are two surfaces for every brush surface if you look closely.

that definitely shouldn`t be doing that on a single brush, it looks like a hollowed out brush with 4 walls, a ceiling and floor… have you tested your water shader in a new separate test map to make sure there is only one water brush?

if you do that and still get the error, post the .map, could be in code form and well test it our ends, but Im assuming the other guys didn`t get the duplicate planes otherwise they would likely of said so.


(Mr_Tickles) #14

Ummmm, about the tcmod turb thing, no it didn’t rotate, bad choice of words on my part there, just couldn’t think of the right way to describe it :slight_smile:

Yep, I have tested it in three maps now.

When you say post the .map, what do you mean? Open it in a text format and paste the contents here? I’ve seen a lot of long code posts, but this map file’s like 10 MB… the test one is only 6K, I really don’t understand the difference in size there, my big map is big, but I wouldn’t have called it 1,666 times as big!

True I do need to make the all the edges but the top and bottom nodraw, I haven’t done that yet, but I still don’t see how that would affect it. I will try it and either post or edit this one.

EDIT:

as you can see, still the two surfaces… :frowning:

Ok, here’s the watertest2 map (as seen in the screenshot above) which is having exactly the same problem:

// entity 0
{
"mapcoordsmaxs" "1024 -1024"
"mapcoordsmins" "-1024 1024"
"classname" "worldspawn"
// brush 0
{
( -512 1024 256 ) ( -512 -1024 256 ) ( -512 -1024 0 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( 1280 768 256 ) ( -1024 768 256 ) ( -1024 768 0 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( -1024 -768 256 ) ( 1280 -768 256 ) ( 1280 -768 0 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( -1024 -1024 512 ) ( -1024 1024 512 ) ( 1280 1024 512 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( 1280 1024 -512 ) ( -1024 1024 -512 ) ( -1024 -1024 -512 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( -504 -1024 256 ) ( -504 1024 256 ) ( -504 -1024 0 ) skies/sd_wurzburgsky 0 0 0 0.500000 0.500000 0 0 0
}
// brush 1
{
( -512 1024 256 ) ( -512 -1024 256 ) ( -512 -1024 0 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( 1280 768 256 ) ( -1024 768 256 ) ( -1024 768 0 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( 1024 -1024 256 ) ( 1024 1024 256 ) ( 1024 1024 0 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( -1024 -1024 512 ) ( -1024 1024 512 ) ( 1280 1024 512 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( 1280 1024 -512 ) ( -1024 1024 -512 ) ( -1024 -1024 -512 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( -1024 760 256 ) ( 1280 760 256 ) ( -1024 760 0 ) skies/sd_wurzburgsky 0 0 0 0.500000 0.500000 0 0 0
}
// brush 2
{
( 1280 768 256 ) ( -1024 768 256 ) ( -1024 768 0 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( 1024 -1024 256 ) ( 1024 1024 256 ) ( 1024 1024 0 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( -1024 -768 256 ) ( 1280 -768 256 ) ( 1280 -768 0 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( -1024 -1024 512 ) ( -1024 1024 512 ) ( 1280 1024 512 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( 1280 1024 -512 ) ( -1024 1024 -512 ) ( -1024 -1024 -512 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( 1016 1024 256 ) ( 1016 -1024 256 ) ( 1016 1024 0 ) skies/sd_wurzburgsky 0 0 0 0.500000 0.500000 0 0 0
}
// brush 3
{
( -512 1024 256 ) ( -512 -1024 256 ) ( -512 -1024 0 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( 1024 -1024 256 ) ( 1024 1024 256 ) ( 1024 1024 0 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( -1024 -768 256 ) ( 1280 -768 256 ) ( 1280 -768 0 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( -1024 -1024 512 ) ( -1024 1024 512 ) ( 1280 1024 512 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( 1280 1024 -512 ) ( -1024 1024 -512 ) ( -1024 -1024 -512 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( 1280 -760 256 ) ( -1024 -760 256 ) ( 1280 -760 0 ) skies/sd_wurzburgsky 0 0 0 0.500000 0.500000 0 0 0
}
// brush 4
{
( -512 1024 256 ) ( -512 -1024 256 ) ( -512 -1024 0 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( 1280 768 256 ) ( -1024 768 256 ) ( -1024 768 0 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( 1024 -1024 256 ) ( 1024 1024 256 ) ( 1024 1024 0 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( -1024 -768 256 ) ( 1280 -768 256 ) ( 1280 -768 0 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( -1024 -1024 512 ) ( -1024 1024 512 ) ( 1280 1024 512 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( -1024 1024 504 ) ( -1024 -1024 504 ) ( 1280 1024 504 ) skies/sd_wurzburgsky 0 0 0 0.500000 0.500000 0 0 0
}
// brush 5
{
( -512 1024 256 ) ( -512 -1024 256 ) ( -512 -1024 0 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( 1280 768 256 ) ( -1024 768 256 ) ( -1024 768 0 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( 1024 -1024 256 ) ( 1024 1024 256 ) ( 1024 1024 0 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( -1024 -768 256 ) ( 1280 -768 256 ) ( 1280 -768 0 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( 1280 1024 -512 ) ( -1024 1024 -512 ) ( -1024 -1024 -512 ) radiant/notex 0 0 0 0.500000 0.500000 0 0 0
( -1024 1024 -504 ) ( 1280 1024 -504 ) ( -1024 -1024 -504 ) metals_sd/wall_b 0 0 0 0.500000 0.500000 0 0 0
}
// brush 6
{
( 1536 1024 -256 ) ( -512 1024 -256 ) ( -512 -1024 -256 ) mr_tickles/ocean -512 0 0 0.500000 0.500000 0 347 0
( -512 -1024 0 ) ( -512 1024 0 ) ( 1536 1024 0 ) mr_tickles/ocean -512 0 0 0.500000 0.500000 0 347 0
( -512 -256 0 ) ( 1536 -256 0 ) ( 1536 -256 -256 ) common/nodrawwater 0 0 0 0.500000 0.500000 0 29 0
( 768 -1024 0 ) ( 768 1024 0 ) ( 768 1024 -256 ) common/nodrawwater 0 0 0 0.500000 0.500000 0 29 0
( 1536 256 0 ) ( -512 256 0 ) ( -512 256 -256 ) common/nodrawwater 0 0 0 0.500000 0.500000 0 29 0
( 256 1024 0 ) ( 256 -1024 0 ) ( 256 -1024 -256 ) common/nodrawwater 0 0 0 0.500000 0.500000 0 29 0
}
// brush 7
{
( 128 1024 64 ) ( -384 1024 64 ) ( -384 -1024 64 ) metals_sd/wall_b 0 0 0 0.500000 0.500000 0 0 0
( -352 -1024 128 ) ( -352 1024 128 ) ( 160 1024 128 ) metals_sd/wall_b 0 0 0 0.500000 0.500000 0 0 0
( -416 -320 320 ) ( 96 -320 320 ) ( 96 -320 64 ) metals_sd/wall_b 0 0 0 0.500000 0.500000 0 0 0
( 128 -1024 320 ) ( 128 1024 320 ) ( 128 1024 64 ) metals_sd/wall_b 0 0 0 0.500000 0.500000 0 0 0
( 112 320 320 ) ( -400 320 320 ) ( -400 320 64 ) metals_sd/wall_b 0 0 0 0.500000 0.500000 0 0 0
( -384 1024 320 ) ( -384 -1024 320 ) ( -384 -1024 64 ) metals_sd/wall_b 0 0 0 0.500000 0.500000 0 0 0
}
}
// entity 1
{
"origin" "-272 0 224"
"classname" "team_CTF_bluespawn"
}
// entity 2
{
"origin" "-32 -224 240"
"classname" "team_CTF_redspawn"
}
// entity 3
{
"origin" "-48 96 256"
"classname" "info_player_deathmatch"
}


(ratty redemption) #15

yep this text version of the test map is what I was asking for… can you post the latest version of your water shader?

it shouldnt matter about the texture paths as Ill use my own.

which q3map2 version and what compile settings did you use?

Im interested to recreate the same bug your getting to better understand it, but its possible it will work perfectly on my system, although that won`t help us debug why this is happening.


(Mr_Tickles) #16

Well, that above was my test map, it has happened on two others. That testmap is pretty basic so i’m pretty sure you could recreate it yourself anyway. Here is the shader, hasn’t really changed from what it was before apart from Java’s change to the div value of the deformVertexes:

textures/mr_tickles/ocean
{
	nocompress
	nofog
	qer_editorimage textures/mr_tickles/ocean.tga
	qer_nocarve
	qer_trans .5
	q3map_globaltexture
	deformVertexes wave 12 sin 0 12 0 .5
	surfaceparm trans
	surfaceparm nonsolid
	surfaceparm water
	surfaceparm nomarks
	surfaceparm fog
	fogparms ( 0.01 0.01 0.015 ) 1024
	cull disable
	nopicmip
	tesssize 1024

	{
		map textures/mr_tickles/ocean.tga
		blendFunc GL_ONE_MINUS_DST_COLOR GL_ZERO
		alphaFunc GE128
		depthWrite
		rgbgen identity
		tcmod scale 0.4 0.2
		tcmod turb 0 0.003 0.5 0.5
		tcmod scroll -0.01 -0.01
		fog on
	}

}

I have no idea what’s causing it because there doesn’t seem to be anything unusual in there on comparing it to other shaders of the same type.

The only thing that crosses my mind now is the line:

textures/mr_tickles/ocean

I know you said this is the name of the shader, but my shader isn’t in a folder called textures, I have it in scripts along with the other shaders. Can you explain to me why it still operates to some degree when it’s pointing to the texture folder?

The compile options I have been using are:
-meta -light -fast -filter -samples2 -vis -fast -saveprt

However, this is using the batch file that MadJack has made. I have no idea if that’s making a difference at all. Actually now I’ve typed that out it does appear that -fast is there twice so i’ll try to compile it without MadJack’s Batch file for the moment and edit this post and let you know.


(MadJack) #17

-fast appear twice because you called -light -fast -filter -sample 2 AND -vis -fast -saveprt


(Mr_Tickles) #18

Yeah, I’m just wondering if that could be causing the two surfaces, most probably not though, it probably doesn’t make any difference that it’s called twice, I just ran out of ideas with the shader… sorry, I word things badly, I didn’t mean that it was your fault. A friend has just looked over it and he says the problem is something to do with the wave lines. Anyone know how to fix that?


(MadJack) #19

it’s called twice but on different compile stages. The bat file calls q3map2 for -vis -fast, then calls -light -fast -blah. The way the bat file works is that it’ll call q3map2 with bsp first, then vis and finally light. Each time a bsp is written and from that bsp the following stage do its stuff.

Very unlikely that VIS caused problems. Problems or differences that VIS might do is when you use -light with a fast vis but only lighting should be affected, not “geometry” of brushes or shaders. Anyway, you might wanna try a normal vis (might take hours depending on how you build your map and complexity and hinting etc)… I might be wrong with that though. Someone will correct me if I’m wrong :slight_smile:

If I get bored with my map soon I’ll check your stuff and see if I can make it work here but I’m far from being bored right now… But who knows :smiley:

EDIT: Don’t worry, I didn’t take it personally :slight_smile:


(=DaRk=CrAzY-NuTTeR) #20

Simply

deformVertexes wave 256 sin 0 12 0 .5

basicly this line is screwed just play about with it, i have no problems with

deformVertexes wave 100 sin 2 5 1 .5

just take my line and experiment, also you can try putting your water into triangles, like the terrain, will give a more watery wavy effect

whats the water gona be used for anyway?