Terrain and Global Fog Problem.


(Raven) #1

Version.36

We can’t seem to get metashaders and global fog to work together. The global fog is working on everything, but the ground surface that is textured with the terrain metashader. Near the surface the fog basically disappears and you see all the way to the distance cull :frowning: The same thing happens when you use a true sky with global fog, but we already knew about it. Is there any way to fix this? Thanks :slight_smile:


(Raven) #2

Thanks Ydnar. We got it with your help :slight_smile:


(Codey) #3

Any info on the fix Raven?


(Raven) #4

This shader works for us (We did not have the correct shader entries):

[b]
textures/Yourfolder/terrain_0
{
q3map_shadeangle 225
q3map_splotchfix
q3map_nolightmap
q3map_nonplanar
q3map_onlyvertexlighting
q3map_texturesize 1024 1024
q3map_tcGen ivector ( 1024 0 0 ) ( 0 1024 0 )
{
map textures/Yourfolder/something_ground.tga
rgbGen vertex
}

}

textures/Yourfolder/terrain_1
{
q3map_shadeangle 225
q3map_splotchfix
q3map_nolightmap
q3map_nonplanar
q3map_onlyvertexlighting
q3map_texturesize 1024 1024
q3map_tcGen ivector ( 1024 0 0 ) ( 0 1024 0 )
{
map textures/Yourfolder/something_ground_1.tga
rgbGen vertex
}

}

textures/Yourfolder/terrain_0to1
{
q3map_shadeangle 225
q3map_splotchfix
q3map_nolightmap
q3map_nonplanar
q3map_onlyvertexlighting
q3map_texturesize 1024 1024
q3map_tcGen ivector ( 1024 0 0 ) ( 0 1024 0 )

{
	map textures/Yourfolder/something_ground.tga
            rgbGen vertex
            alphaGen vertex
}
{
	map textures/Yourfolder/something_ground_1.tga
            rgbGen vertex
	blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
            alphaGen vertex
}

}

textures/Yourfolder/terrain.vertex
{
{
map textures/Yourfolder/something_ground.tga
rgbGen vertex
}
}

The you add these to your worldspawn:

Key: terrain value: 1
Key: Layers value: 2
Key: alphamap value: textures/Yourfolder/Terrain_blend.pcx
Key: Yourfolder/terrain

You can’t have both lightmapped terrain and fog. The terrain has to be vertex lit.

I hope that helps a little :banana:
[/b]


(Codey) #5

Ah, heeh I was hoping you guys found a workaround for the lightmap terrain and global fog problem :smiley:

Dang, thanks for the info tho

:smiley: Codey


(Raven) #6

No problem. The phong shaded vertex lighting actually looks pretty good, so you might want to give it a try.


(ydnar) #7

Few things:

  • On the blend shaders, alphaGen vertex is redundant. rgbGen vertex already copies the vertex alpha, so in a sense you’re just doing it twice.

  • The shadeAngle 225 directive is a bit overkill, try something under 180 degrees.

  • The directives q3map_nolightmap and q3map_onlyvertexlighting are the exact same thing internally. It’s like asking for a piece of granite, and then asking them to make sure they give you a piece of rock.

  • The q3map_texturesize directive doesn’t really matter unless you’re making a map for a non-PC target.

  • Only lightmapped surfaces need q3map_splotchFix. Vertex-lit surfaces don’t have splotches, and hence don’t need them fixed.

Cheerio,
y

:slight_smile:


(Raven) #8

Thank you Ydnar. I will tell Zero about those changes. I added the splotchfix parameter, since there were a couple of odd lighting instances. I did not know it was only for lightmapped faces. The shadeangle is supposed to be set to the angle of the entity sun…correct? That is why I have 225.


(ydnar) #9

The shade angle is the breaking angle between two faces when a seam appears. If set to 90 degrees, any angle less than that will be smoothed, and any angle larger than that will be creased.

It has nothing to do with the sun. :slight_smile: See these three shots:

120 degrees

45 degrees

0 degrees (no phong shading, all flat)

Hope that helps.

y


(Codey) #10

I found a way to do it…

POW Escape!

But I’ll give the phong shading a go as the lightmap is chewing up gobs of memory.

:smiley: Codey


(Raven) #11

Excellent!!! Thanks guys :slight_smile:


(Loffy) #12

hi!
Im just curious about this term phong shading.
Im absolutely not a hacker, but generally interested in games and mapping. Could you please explain what phong shading is, in simple words. Just so I get an idea of what it is.
It must be some sort of shader-thing, but what’s the difference, compared to an ordinary shader-script/texture?

(There is, for example, a high tower in the map Goldrush, game: Enemy Territory, near tank barrier #1, that has “phong” applied. you can see it when you look at the tower in Radiant (.map-file is provided, with the editor - thx SD!). So, there is a phong:ed tower. But when I look at it inside the game, I just cant see what’s special about the tower.)

Long post, for a nooby question.
Thanks in advance.


(rgoer) #13

Bui Tuong-Phong came up with Phong Shading in the early seventies, and it has since become a staple of the 3D computer graphics industry. Read up on the subject here.


(Loffy) #14

Thanks! / L.