Log On
     
 





Tutorial: Sky Portals

Part 3

The lighting for a nodraw is tricky, but simple.

First, you need to create a shader specific to the sun angle you wish, then if it's to produce a surface light, a q3map_lightimage, and an alpha pass that will render the image invisible.

Lets take that example and apply the textures/skies/pj_ctf2_sky parameters. Remember, we aren't concerned with the shader pass effects.

textures/skies/pj_ctf2_sky
{
	qer_editorimage textures/skies/bluetopclouds.tga
	q3map_lightimage textures/skies/topclouds.tga
	surfaceparm noimpact
	surfaceparm nolightmap
	q3map_globaltexture
	q3map_lightsubdivide 512 
	q3map_sun	0.266383 0.274632 0.358662 250 90 45
	q3map_surfacelight 100

We wish to create our own shader called myshader/pj_ctf2_sky_skyportal and use the included images for this.

textures/myshader/pj_ctf2_sky_skyportal
{

	qer_editorimage textures/common/skyportal.tga
	q3map_lightimage textures/skies/topclouds.tga
	surfaceparm noimpact
	surfaceparm nolightmap
	surfaceparm sky
	q3map_lightsubdivide 512 
	q3map_sun	0.266383 0.274632 0.358662 250 90 45
	q3map_surfacelight 100
		{
		map textures/common/sky_portal.tga
		blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
		depthWrite
		}
}

Now what that does is take the original sky parameters and copy them over to the new custom sky portal one, as well as add a pass (shown in red) that makes the actual shader invisible, since the sky_portal.tga has an empty channel. We do not need a globaltexture parm, but we do need the q3map lightimage in order to get the color in this example, and we need to add the surfaceparm sky in order for it to 'turn off' with r_fastsky 1.

So lets apply this texture and compile.

0..1..2..3..4..5..6..7..8..9.. POOF

Some things to take into consideration:

  • Whatever is in that room will be drawn for the clients, and that means r_speeds will be accumulative based on that room.
     
  • Movers must have the specific key/values to be seen in the room.
     
  • Clients can turn it off only if the surfaceparm sky is present in the shader.
     
  • Flares can be drawn on it, since technically it is being drawn before it.
     
  • With the latest q3map, md3's can be imported and scaled for some really cool stuff.
     
  • You can use different shader passes on the sky portal (at the expense of performance, of course) for weather effects, or dusk-till-dawn effects.

That's it! Any questions, visit #wfamaps at irc.enterthegame.com and hunt one of us down.