Jump to content

GtkRadiant/Creating sky shaders

From Wikibooks, open books for an open world
« Sky

Creating sky shaders

GtkRadiant

If you have experimented a bit with the skies that come with your game, but none of them fitted to your map, or you simply just want to make your own sky for fun, you will need to create a sky shader as well as six images.

Lets start with the images since they are far harder to create. As already said, a skybox consists of six images, first one for each direction like Back, Front, Left and Right as well as one Up and one Down Image. I will not go into the details of making those images, since I'm not very good at doing that, but basically, you will have to make sure the Back, Front, Left and Right images line up to each other if you don't want some ugly lines in the corners.

Also make sure that the Up image lines up with all the other images, or you will also have some ugly lines there. Usually, the Down image doesn't need to be very good, since you want to avoid the possibility to look at it, since it gives the map a "floating" look. If you make sure the down image cant be seen, you can make it one colored or so... anyway, when you have made all these images, name them: nameofsky_bk, nameofsky_ft, nameofsky_rt, nameofsky_lf, nameofsky_up, and nameofsky_dn where you change nameofsky to whatever you like. The file format can be jpg (non progressive) or tga (some games also support png).

The shader should look like the following:

 textures/mapname/nameofsky
 {
 	qer_editorimage textures/skies/sky.tga //path of the image that shows up in Radiant
 	skyparms textures/mapname/nameofsky 1024 - //farbox cloudheight nearbox
 	q3map_sunExt 1 0.86 0.67 350 -102 40 2 16 //red green blue intensity degrees elevation deviance samples
 	q3map_lightmapFilterRadius 0 160 //self other
 	q3map_skyLight 300 3 //amount iterations
 	surfaceparm 	sky //tells the game it's a sky
 	surfaceparm 	noimpact //no projectiles impact here
 	surfaceparm 	nolightmap //no shadows on this surface
 	surfaceparm	nomarks //no burn marks
 }

To add a scrolling cloudlayer, you must add a texture stage after the main body, like so:

textures/mapname/nameofsky
 {
 	qer_editorimage textures/skies/sky.tga
 	skyparms textures/mapname/nameofsky 1024 -
 	q3map_sunExt 1 0.86 0.67 350 -102 40 2 16
 	q3map_lightmapFilterRadius 0 160
 	q3map_skyLight 300 3
 	surfaceparm 	sky
 	surfaceparm 	noimpact
 	surfaceparm 	nolightmap
 	surfaceparm	nomarks
 {
        map textures/skies/cloudlayer1.tga  //the map of the clouds, put an alpha channel into the texture for best results
        blendFunc blend  //to make it so you can see the skybox behind the cloudlayer
        tcMod scale 3 3  //this makes the texture repeat more often, in this case, 3x as much in each direction, play around with the values as you like
        tcMod scroll 0.2 0.1  //this makes it move.  play around with the values here until they are to your liking
 }
}

Note: You will get an error if you have many layers as the game can not handle it. If you get any errors, remove cloudlayer stages.