This tutorial was originally created by wisemx.
Before you try to create a sun place one
light_environment in your map and adjust it. You should adjust the Brightness and Ambient properties for your
light_environment to match the sky you are using. For the Brightness use the Pick color button to pick the color of your light. Then change the last three numbers for the overall brightness. In our example for this tutorial the numbers are 243 238 224 600. This means that “243 238 224” is the color I chose and “600” is the brightness. Now adjust the Ambient property to match. In our example the numbers I used are 243 238 224 110. Typically an ambient brightness anywhere from 40-120 looks fine. If you raise that number too much your shadows will blend right out and will not show.
Pick the skybox sky name you want to use. To see all of the skies available to you use the texture browser and enter the filter word “skybox”. You change your Skybox Texture Name in your Map Properties. From the main toolbar, Map, Map Properties. For this example I used
sky_day02_02. Pay attention to the names when you type them in, don’t use any sky texture name that ends with bk, dn, ft, lf, rt, or up. Those will be the additional textures that will be used automatically when the map compiles for each of the “walls” of the skybox. You won’t be able to see your skybox until your map is compiled and you run it in the game.
Now run your map and look around for the location of your sun. Go back to your map and insert an
env_sun in the spot where you want your sun to be. Press + to bring up the properties and use the Point At button to point at the same spot you used for your
light_environment. In the example file I’ve used -28 319 0, with the first number “-28” being the height of my sun in the sky. This was the only number I changed to get the sun where I wanted it in the sky, to match the skybox. You can also use the Pitch property for this, which would have also been “-28”, or you can leave it at “0” and make the adjustments to the Pitch Yaw Roll property, which ever is easiest for you, it doesn’t matter. I’ve seen some tutorials call the additional Pitch property redundant but it should actually be thought of as an additional method for fine tuning your sun.
The next two properties View entity and UseAngles are used together. The new way to use an
env_sun is to use angles but you can also use a View entity and not use angles. If you use a View entity set UseAngles to No. If you don’t use a View entity set UseAngles to Yes.
What is a View entity? It’s any target your sun can point at with the best being an
info_target. You would simply place one in a spot you want your sun to direct itself to and give it a name then specify that name in the
env_suns View entity property.
In the download for this tutorial I’ve created a sun with both methods. Now that you have your sun into position and have aimed it you can alter the properties for the Color and Size. Don’t choose too bright of a color and don’t make your sun too large. Well, I said don’t but I guess there may be times when you want a large goofy looking sun. For this example my sun's color is 253 243 179 and the size is 3. A size of 3 or 4 is typically best but experiment.
The two examples below are:
- WiseSun.vmf (The new method with UseAngles)
- WiseRoomSun.vmf (The
If you want to create a sun in a 3D skybox place the
env_sun in your 3D skybox and make slight adjustments until it's where you want it.