The simulation of light and illumination in games, including its interaction with the environment. A core element of games that can bring out vivacity into otherwise static worlds.

learn more… | top users | synonyms

46
votes
4answers
20k views

How is 2D lighting implemented?

I am wondering what the best way to approach a "lighting" effect in 2D games is. For instance, if my main character is glowing, what techniques can I use to complete the visual effect of the character ...
18
votes
3answers
2k views

How can I create a lighting effect like this?

This is the most beautiful 2d lighting I have ever seen, and I'd like to perform lighting like this too. How do I do it? I don't care about the physics or how the particles are simulated - I only ...
16
votes
3answers
3k views

What is the utility of squared radius and inverse squared radius for lighting computations?

On one of the slides from "DirectX 11 Rendering in Battlefield 3" PowerPoint I noticed the folowing code: struct Light { float3 pos; float sqrRadius; float3 color; float invSqrRadius; } I ...
16
votes
1answer
6k views

What does it mean to “bake lights”?

What does it mean to bake lightmap ? I heard this in Unity3d, and again found this LightUp plugin for sketchup that bakes lightmap. From what I observe, the lightmap baked gives the 3d object a much ...
16
votes
1answer
876 views

What is the math behind the light effect in krakatoa?

I'd like to know the math behind the light effect in krakatoa (click here for an example). Light source is traveling with particles, but how is shading done? Is it something simple, like Phong ...
14
votes
2answers
6k views

How can I implement lighting in a voxel engine?

I am creating the MC like terrain engine, and I have thought that lighting would make it look a whole lot nicer.The problem is that the blocks are not being lit properly when a block which emits light ...
13
votes
8answers
2k views

Does the linear attenuation component in lighting models have a physical counterpart?

In OpenGL (and other systems) the distance attenuation factor for point lights is something like 1/(c+kd+sd^2), where d is the distance from the light abd c, k and s are constants. I understand the ...
12
votes
4answers
3k views

How can I acheive a smooth 2D lighting effect?

I'm making a 2D tile based game in XNA. Currently my lightning looks like this. How can I get it to look like this? Instead of each block having its own tint, it has a smooth overlay. I'm assuming ...
12
votes
4answers
3k views

How can I implement voxel-based lighting with occlusion in a Minecraft-style game?

I am using C# and XNA. My current algorithm for lighting is a recursive method. However, it is expensive, to the point where one 8x128x8 chunk calculated every 5 seconds. Are there other lighting ...
11
votes
3answers
4k views

Is there a way to use an arbitrary number of lights in a fragment shader?

Is there a way to pass an arbitrary number of light locations (and colors) for the fragment shader, and loop over them in the shader? If not, then how are multiple lights supposed to be simulated? ...
11
votes
3answers
8k views

Trying to understand light on Opengl, how to simulate a realistic sun light?

I don't know if I'm doing something wrong or missing anything but I want to simulate sun light, like in a sunny day. When the object is facing the directional light, it's well lit and there's no ...
11
votes
1answer
414 views

How to achieve light that changes color mid-way?

I thought of creating light sources, and some colored windows. Now, the windows are semi-transparent. How could I make it so that when the light (say, pure white) hits the glass and continues through ...
11
votes
1answer
561 views

How do I create multiple 2D spotlights?

I'm looking to create a 2D "spotlight" effect that allows a spotlight on multiple entities. I.e., as if several sprites were holding torches. For a single entity (one spotlight), I use a technique ...
10
votes
1answer
924 views

How does Trine's lighting look so spectacular?

Is there some kind of "special" lighting in this scene? I notice that the sun seems to "pop".
10
votes
3answers
3k views

Can I achieve a torchlight effect (lighter area around a light source) in a 2D game?

I am thinking of writing myself a simple 2D game. It will not shine with perfect graphics or gameplay at first, but I'd consider it my first step in PC game development. So, imagine such simple ...
9
votes
1answer
930 views

What is Ramp Shading or Lighting?

What is ramp shading or lighting and how does it work? Is it different than toon shading or is it the same concept? How is specularity calculated differently for ramp shading versus blinn-phong or ...
9
votes
2answers
720 views

Handle many lights in a scene (with shaders)

I'm curious about how to handle many lights in a scene. Given a very big map in a role playing game, with dungeons (with lights in there) etc. I know about deferred lighting, but that only answers how ...
9
votes
3answers
3k views

Lighting in a Minecraftian World

Minecraft is a game that is largely based on a heightmap and uses that heigtmap information to flood the world with light. From my understanding the highest point in the heightmap is the end of the ...
8
votes
4answers
671 views

I need help with 3d shading/lighting

How do you guys handle shading in a 3d game? I have a directional light source that shades one side of a tree made of cubes. The remaining 3 sides all get ambient shading only. So the 3d effect is ...
8
votes
2answers
624 views

Can someone explain radiosity lighting to me?

I already have the basics of ambient occlusion down. I have a raycaster and am capable of shooting rays about a hemisphere uniformly. It seems like those are the basics of what are needed for ...
8
votes
2answers
809 views

Creating smooth lighting transitions using tiles in HTML5/JavaScript game

I am trying to implement a lighting effect in an HTML5/JavaScript game using tile replacement. What I have now is kind of working, but the transitions do not look smooth/natural enough as the light ...
8
votes
1answer
359 views

OpenGL: Light at end of tunnel effect

Anyone knows any implementation of the "light at the end of tunnel" effect? where the outside is entirely bright and gradually becomes more visible? The reverse could also be true, where the inside ...
8
votes
1answer
294 views

Fast lighting with multiple lights

How can I implement fast lighting with multiple lights? I don't want to restrain the player, he can place an unlimited number and possibly overlapping (point) lights into the level. The problem is ...
8
votes
4answers
2k views

Any good book on lighting in video games?

Lighting plays a fundamental role into videogames. A videogame without a good ilumination is flat and without life. I'm looking for a book that explains how must be iluminated a scene and what factors ...
8
votes
1answer
653 views

Drawing “Stenciled” Sprites and making them glow

Currently, in my game - I'm not using XNA's SpriteBatch to render anything(I am using Farseer Physic's Debug View), and I was wondering how I would render something like this: only using XNA. My ...
7
votes
2answers
251 views

Diffuse Reflection confusion

From what I've read, with a simple directional light, the color of a point, if you only take diffuse reflection into account (intensity = 1), should be color = color_of_point * color_of_light * ...
7
votes
2answers
1k views

What is physically correct lighting all about?

I can't find anything comprehensive using Google. I'm wondering what the core concepts of physically correct lighting are, and where I could read up on it. What's physically correct lighting all ...
7
votes
3answers
3k views

How do I implement occluded lighting in a block-based 2D game?

I want to have 2D lighting that can be blocked by in-game objects. My game has a top-down view and all game objects are described by rectangles. Let's say I have a 10x10 world and I place a light at ...
7
votes
3answers
386 views

Why doesn't light continuous on my model?

I created a basic textured cube model with Blender to practice modeling, and then I imported it into Unity. After I put up some lighting it looks pretty ugly. The light is not continuous on a row of ...
7
votes
1answer
276 views

Is there any difference between storing textures and baked lighting for environment meshes?

I assume that when texturing environments, one or several textures will be used, and the UVs of the environment geometry will likely overlap on these textures, so that e.g. a tiling brick texture can ...
7
votes
1answer
148 views

Shadowmap granularity

I thought that we could re-use the same shadowmap for every light. But I've seen an industry article suggesting that you can't re-use shadowmaps between lights, and have to use separate surfaces. Do ...
6
votes
3answers
592 views

How can I create a shader that will reproduce this lighting effect on terrain?

Notice the way in which the major light source in each image reflects off the ground, as a function of the distance between the light source and the viewer (?). Is this a (bumped) specular map? ...
6
votes
3answers
833 views

For normal mapping, why can we not simply add the tangent normal to the surface normal?

I am looking at implementing bump mapping (which in all implementations I have seen is really normal mapping), and so far all I have read says that to do this, we create a matrix to convert from ...
6
votes
2answers
835 views

Rendering collections of light sources

I have a small test environment where small point lights are scattered. Players should able to collect them. The collectible lights are rendered using a simple billboard technique where two triangles ...
6
votes
3answers
621 views

What has changed in the lighting systems of Rage, Battlefield 3 to make them so realistic?

I've played and completed Rage and currently Battlefield 3 (which looks a lot better with less hype). One thing that is immediately apparent is the lighting, or the bump maps - I can't figure out ...
6
votes
2answers
367 views

Spherical harmonics lighting - what does it accomplish?

From my understanding, spherical harmonics are sometimes used to approximate certain aspects of lighting (depending on the application). For example, it seems like you can approximate the diffuse ...
6
votes
2answers
467 views

A big light with shadows

To have better texture2D quality in my 2D game, I had to recreate every textures with 300% of their original size. But the lights have to bright 3 times more. For lights, I'm using this : Catalin's ...
6
votes
2answers
851 views

How are dynamic blending shadows like this created?

I would like to know, how dynamic shadows, that 'blend' onto other objects, are created.
6
votes
1answer
557 views

Fast and simple attenuation from a flaming torch

I have a single point light-source which is a flaming torch. I compute the distance from the light accurately. I am not trying to have a particularly realistic torch effect, but I will be moving the ...
6
votes
1answer
846 views

How many shadow casting lights are in modern games?

I'd like to know how many shadow casting lights are supported in modern games, such as Uncharted 2, Crysis 2, Modern Warfare 2, Halo: Reach, etc. Do they all limit themselves to just a couple of ...
6
votes
2answers
363 views

How do walls affect lighting?

I have been trying to implement a simple form of lighting in my 2D game. In the screenshot, I don't think it looks very good, kind of just plastered over the top of the map. How would the wall effect ...
6
votes
2answers
1k views

Grid/cell based light system

I am working on a top-down, 2d cell-based RPG game. I would like to implement a cell based lighting system, something like this and this. I basically have several light sources and light deteriorates ...
6
votes
2answers
190 views

Reducing Spherical Harmonic Ringing

I've generated some 2nd order SH light-probes from cube-maps in my scene and I was surprised how strong artifacts are around the back of the dominant lights. I switched to a Lambert source plus ...
6
votes
3answers
1k views

Common light map practices

My scene consists of individual meshes. At the moment each mesh has its associated light map texture, I was able to implement the light mapping using these many small textures. 1) Of course, I want ...
6
votes
2answers
300 views

Implementing realistic sun reflection on a sea

I'm drawing a 3d rendered island which has a day / night cycle and a sun that rises and sets over water. The sea is rendered with a fragment shader derived from this Blinn-Phong tutorial. ...
5
votes
1answer
2k views

GLSL Light (Attenuation, Color and intensity) formula

I'm implementing point lights in my Voxel engine, and I'm really struggling to get a good flow of light, from 100% near the light source to 0% at the light radius. I have 5 arguments for the ...
5
votes
1answer
1k views

Fast pixelshader 2D raytracing

I'd like to do a simple 2D shadow calculation algorithm by rendering my environment into a texture, and then use raytracing to determine what pixels of the texture are not visible to the point light ...
5
votes
3answers
4k views

How do I fix this weird lighting problem?

I'm making a small game in Unity, and some models are displaying very ugly shading. The shading usually looks funky along the edges between triangles. I'm pretty new to working in 3D; I bet this is ...
5
votes
2answers
501 views

Detecting Light Intensity Around Characters

Later Edit Since there seemed to be a bit of confusion: I am asking this for purely didactic reasons, I'm not searching for the most efficient solution. Reformulated question: I'm working under ...
5
votes
2answers
4k views

Normal Mapping for 3D-Like Lighting in 2D Games

I recently saw this video about a game engine that uses normal mapping to generate lighting and shadows for amazing, 3d-like lighting effects. (Like the three barrels below on the right side, they ...