Log On

Tutorial: Sun Flares
Page 1

This tutorial assumes that you have working knowledge of what a sky texture is, and how the q3map_sun parameter affects a map.

A sun flare is a group of images that are drawn whenever the player has no obstacle between it's eye and a surface stopping the void with a sky parameter. It will fade and shrink depending on the angle and the distance of the obstructing surfaces.

Note that this tutorial may change a bit and requires some math background, but its quite simple. Now everyone in calc probably sat there dreaming of that pretty blonde next to them instead of paying attention, so its ok if you need to fiddle now to get an understanding.

For this example, I used the common sky shader "skies/hellsky2" found in the scripts directory, skies.shader. Open it up and take a look at it.

	qer_editorimage textures/skies/dimclouds.tga
	surfaceparm noimpact
	surfaceparm nolightmap
	q3map_bounce 0
	q3map_backsplash 0 0
	q3map_sun .9 .9 1 70 65 78
	q3map_surfacelight 60
	skyparms - 512 -


Note the "q3map_sun .9 .9 1 70 65 78" in the hellsky2 shader. The first 3 are the RGB colors of the sun (in this case pretty much white), then the intensity (70), then the coordinates with Degrees as 65 and elevation as 78. Those coordinates are the foundation in which we wish to use to position the flare.

This is straight from the shader bible:
is the angle relative to the directions on the map file. A setting of 0 degrees equals east. 90 is north, 180 is west and 270 is south.
is the distance, measured in degrees from the horizon (z value of zero in the map file). An elevation of 0 is sunrise/sunset. An elevation of 90 is noon.

Well keeping this in mind, we need to figure our 'pitch' and 'yaw' for the entities' properties boxes. Using the q3map_sun variables, you negate the degrees from the pitch, and use the elevation as the yaw if it is under 180. With the hellsky example above, its directly correlated. So what happens then if the degrees is greater then 180? Well, you simply subtract it from 360, and *-1.

Info_flare SUN or BIGSUN
Yaw: 78
Pitch: -65

Lets take a look at what the cmd debugsun does next.