Weird lighting


(Rummie) #1

Hi,

I have a weird lighting problem. I have made a simple map with only 2 light sources: the sky and a torch. My _minlight is set to 25 and _color is set to 1 1 1. I am using the latest q3map2 with the following light settings:

-light -fast -samples 2 -samplesize 8 -bounce 16

My sky shader is:

textures/dg_egypt/egyptsky
{
	qer_editorimage textures/dg_egypt/env/egypt_sky_up.jpg
	q3map_sunExt 1 1 1 400 -190 45 3 32
	q3map_lightmapFilterRadius 0 8
	q3map_skyLight 160 6

	surfaceparm sky
	surfaceparm noimpact
	surfaceparm nolightmap

	skyparms textures/dg_egypt/env/egypt_sky - -

	nopicmip

}

and the torch shader is

textures/sfx/xflame2_5000
{
	//----(SA) added "lick"
	deformVertexes wave 194 sin 0 2 0 .5
	deformVertexes wave 30 sin 0 1 0 .9
	deformVertexes wave 194 sin 0 1 0 .6
	//----(SA) end

	nofog	// fogs properly
	surfaceparm nomarks
	surfaceparm nolightmap
	surfaceparm nodlight
	cull none
	q3map_lightimage textures/sfx/flame_COLOR.tga
	q3map_surfacelight 5000
	qer_editorimage textures/sfx/flame1.tga

	{
		animMap 8 textures/sfx/flame1.tga textures/sfx/flame2.tga textures/sfx/flame3.tga textures/sfx/flame4.tga textures/sfx/flame5.tga textures/sfx/flame6.tga textures/sfx/flame7.tga textures/sfx/flame8.tga


		blendFunc GL_SRC_ALPHA GL_ONE
		rgbGen wave sawtooth 0 1 0 8
	}	
	{
		animMap 8 textures/sfx/flame8.tga textures/sfx/flame1.tga textures/sfx/flame2.tga textures/sfx/flame3.tga textures/sfx/flame4.tga textures/sfx/flame5.tga textures/sfx/flame6.tga textures/sfx/flame7.tga
		blendFunc GL_SRC_ALPHA GL_ONE
		rgbGen wave inverseSawtooth 0 1 0 8
	}	
	{
		map textures/sfx/flameball.tga
		blendFunc GL_SRC_ALPHA GL_ONE
		rgbGen wave sin .6 .2 0 .6
//		rgbGen identity	
	}
}

And I get this on compile:

Where does that light come from? It is only on that wall and not on the adjacent wall. Help?


(Gringo Starr) #2

I’m not an expert, but maybe it’s trying to be efficient but incorrectly reusing a lightmap? What about putting _lightmapscale .5 in the worldspawn to test?


(phobos) #3

Generally this comes from light leaking around corners, but unless you’ve got something behind that right wall, I can’t see where the orange is coming from. I’ll try reproducing your map and see what I can find.

Usually solving light leaks involves better brushwork, like thicker walls, cutting up existing ones.


(ydnar) #4

Q3Map2 combines similar lightmaps within a certain error tolerance. This can be turned off by using -nocollapse in the light phase.

Couple things:

  • That’s a very high _minlight. Despite minlight and ambient being used in RTCW and ET, I don’t advocate its use, as it washes out the entire map’s lighting. There are better ways to elevate the brightness of a map overall, such as using radiosity and gamma correction (-bounce N and -gamma N.N respectively).

textures/rummie/xflame2
{
   qer_editorimage textures/sfx/flame1.tga

   surfaceparm nolightmap
   surfaceparm nomarks
   surfaceparm nonsolid
   surfaceparm trans

   cull none
   
   {
      animMap 8 textures/sfx/flame1.tga textures/sfx/flame2.tga textures/sfx/flame3.tga textures/sfx/flame4.tga textures/sfx/flame5.tga textures/sfx/flame6.tga textures/sfx/flame7.tga textures/sfx/flame8.tga
      blendFunc GL_SRC_ALPHA GL_ONE
   }
}

y

  • Your sky shader uses q3map_skyLight 160 6. Since you’re using such a high iteration value, you can remove q3map_lightmapFilterRadius from the shader completely. In fact, with the most recent builds of Q3Map2 I don’t advocate using q3map_lightmapFilterRadius in sky shaders any more at all, much like I don’t advocate using -filter.

  • The -samplesize switch has no effect in the -light phase. Edit the .srf file manually (the first entry) to set default sample size. It does still continue to work in the BSP phase, however.

  • The flame/torch shaders from RTCW are utter shite. First of all, they are neither surfaceparm trans, nor surfaceparm nonsolid. This means they’re structural and cast shadows. The light emitting portions aren’t really that great either. To fix up your torch lighting, make a clean new flame shader like this and use an entity light with _samples 8 and _deviance 8 next to the flame brushes in the map. The compile will be faster and the light will be more uniform. Don’t forget to add spawnflags 1 to enable inverse-quadratic attenuation (RTCW/ET lights are linear by default, another silly fact).


(Rummie) #5

Thank you sir - very useful information. I know the _minlight was exceedingly high, but at that point I was trying to wash out the yellow with minlight - I did not know about the gamma switch - thanks very much.


(Gringo Starr) #6

Is it fixed? :slight_smile:


(Rummie) #7

Yes, it is fixed. Not only that but with the -nocollapse and -gamma compile options it looks a lot better.


(Ifurita) #8

Rummie is a noob :wink:

good to see you back