# Skybox Lighting

This topic is 4873 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, i´m not sure how this technique is called, but i want to light my outdoor scene according to the surrounding skybox. That is, for example, a reddish sky causes the scene to be lit reddish as well. Hmm, i hope you know what i´m mean. I have read something about this method on the net, and they use HDRI for this. But i want to do it without HDRI. Can someone tell me how this could be done? and sorry for my bad english i´m out of training :( thanks Gammastrahler

##### Share on other sites
maybe its sorta like cube mapping? :)

##### Share on other sites
Hmmm,

i think you mean (Environment) Cube Mapping? That´s not what i want, since this does reflections on the surface.

I want only diffuse interaction.

##### Share on other sites
I'm afraid it's not really possible. But you can use the following trick :
Since the sky occupy the top of your skybox, you can have a function that lock the texture applied on the top of your skybox, and compute the average color of this texture. This will gives the average color of your sky, and you could use it with a standard directional light.

##### Share on other sites
From the original cubemap, create a new cossine weighted cubemap (this can be of much lower resoultion).
Then just use your normal as texture coord for this new cubemap.
ATI has a normalmap tool that can perform the filtering.
Doing the filtering in realtime is alot harder.
Every texel in the filtreed cubemap needs to consider half of the pixels in the original map.

Edit: You do not need HDR or anything like that to use this technique. It works even on GeForce1 cards and kan look really nice. It's only a precomuptation, like this:
* For every possible normal on a sphere = every texel on the destination cubemap*   Light = 0*   Sum = 0*   For every texel on the original cubemap*     K = Calculate the dot product between the two normals.*     If K is less than zero, skip further processing of this texel (this rejects about 50% of the texels)*     Light += Color of the original cubemap at texel * K*     Sum += K;*   Light /= Sum*   Store Light at the destination texel.

Another way to think of it is to treat every texel on the cubemap as a distant light, then do the normal diffuse lighting for a pixel using all these lights.
Combined with ambient occlusion it looks quite nice.

As for the name, I call it hemisphere lighting, dunno if it's the correct term for it.

##### Share on other sites
Hey,

eq is right. You could also take a look at this paper: http://graphics.stanford.edu/papers/envmap/

It has a nice, fast way of computing an irradiance map from the original environment map. But in this case, we're only dealing with ambient and diffuse lighting. If you want specular, you can easily get good results by using a blurred version of the original environment map. How much blur you apply defines the general "glossiness" of specular reflecting surfaces. You can further modulate this in each material by using a gloss map too.

Hope that helps.

##### Share on other sites
This might be of interest to you:

They are using a texture lookup to control the ambient lighting term. They use a single color for the sky and sample their ground color, but you could sample a sky color as well.

You may need to register to read the article. If you don't have a gamasutra account, try BugMeNot.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 14
• 12
• 29
• 11
• 44
• ### Forum Statistics

• Total Topics
634855
• Total Posts
3019653
×