Questions tagged [lighting]

Related to computer games' engines and 3d graphics software. For the use of both shadow and light in GUIs and for the use of lighting with respect to programs using hardware such as cameras, that requires code to control the lighting. Must be used with other relevant tags distinguishing the programming language and framework being used. e.g. unity 3d Not to be used with light, as is used in physics having wave and particle characteristics.

Related to the computation of reflection models like the Phong Model or Blinn-Phong Model and the per-vertex (Gouraud) and per-pixel shading models (Phong).

719 questions
59
votes
5 answers

Improved Area Lighting in WebGL & ThreeJS

I have been working on an area lighting implementation in WebGL similar to this demo: http://threejs.org/examples/webgldeferred_arealights.html The above implementation in three.js was ported from the work of ArKano22 over on…
wagerfield
  • 860
  • 1
  • 8
  • 11
46
votes
12 answers

Calculating which tiles are lit in a tile-based game ("raytracing")

I'm writing a little tile-based game, for which I'd like to support light sources. But my algorithm-fu is too weak, hence I come to you for help. The situation is like this: There is a tile-based map (held as a 2D array), containing a single light…
Zarkonnen
  • 21,429
  • 14
  • 62
  • 80
24
votes
4 answers

How does Minecraft perform lighting?

The only model I'm familiar with is diffuse lighting but this look way more complicated than that.
Xavier
  • 7,987
  • 13
  • 61
  • 93
21
votes
2 answers

Realistic lighting (sunlight) with Three.js?

I'm attempting to create a small 1st-person game using Three.js, but I'm having trouble with the lighting. Basically I want to simulate the sun and have it rotate around casting light on everything. I'm using THREE.DirectionalLight at the moment and…
Joey Morani
  • 21,793
  • 29
  • 79
  • 126
14
votes
2 answers

Oren-Nayar lighting in OpenGL (how to calculate view direction in fragment shader)

I'm trying to implement Oren-Nayar lighting in the fragment shader as shown here. However, I'm getting some strange lighting effects on the terrain as shown below. I am currently sending the shader the 'view direction' uniform as the camera's…
flau
  • 1,249
  • 1
  • 20
  • 35
9
votes
2 answers

iOS SceneKit Neon Glow

Have been looking at lighting on Scenekit, and while I can now apply a lighting node to light something I'm looking for a way to light from within an object. As an example imagine a neon glow, or a lightbulb that casts light on other objects. Any…
Matthew Baker
  • 2,311
  • 1
  • 18
  • 35
9
votes
1 answer

Diffuse light/shadow

I just implemented a light system in my engine. In the following screenshot you can see a light (the yellow square) in action: Take into account that on top of the light illuminating the scenario, its also implemented a FOV which will occlude…
Leo
  • 1,034
  • 9
  • 23
9
votes
3 answers

Efficient 2D Tile based lighting system

What is the most efficient way to do lighting for a tile based engine in Java? Would it be putting a black background behind the tiles and changing the tiles' alpha? Or putting a black foreground and changing alpha of that? Or anything else? This…
Kyranstar
  • 1,560
  • 1
  • 12
  • 31
9
votes
1 answer

Deferred Rendering with Tile-Based culling Concept Problems

EDIT: I'm still looking for some help about the use of OpenCL or compute shaders. I would prefer to keep using OGL 3.3 and not have to deal with the bad driver support for OGL 4.3 and OpenCL 1.2, but I can't think of anyway to do this type of…
8
votes
3 answers

OpenGL lights limit

As I was reading RedBook I stayed quite confused, that openGL can have maximum 8 lights in scene (number depending on implementation, but should be arround 8). But I can imagine number of situations that would need more lights, so I think there's a…
Raven
  • 4,403
  • 7
  • 41
  • 71
7
votes
1 answer

per-fragment lighting coordinate system

I'm developing an OpenGL 2.1 application using shaders and I'm having a problem with my per-fragment lighting. The lighting is correct when my scene initial loads, but as I navigate around the scene, the lighting moves around with the "camera",…
Nitrex88
  • 2,132
  • 2
  • 20
  • 23
7
votes
1 answer

Why does GLSL lighting code shift the light spot with the camera?

I am trying to make a custom light shader and was trying a lot of different things over time. Some of the solutions I found work better, others worse. For this question I'm using the solution which worked best so far. My problem is, that if I move…
Cobra_Fast
  • 14,395
  • 8
  • 51
  • 97
7
votes
2 answers

Libgdx light without box2d

I just started creating a game using libgdx. It is a top down 2d shooter using scene2d ui. Now i thought, that i could add darkness and light to some levels, but i don't want to rewrite everything using box2d. I don't need realistic shadows just…
Springrbua
  • 8,377
  • 9
  • 48
  • 92
7
votes
1 answer

Normal Mapping and translation disrupts my lighting

I got a normal mapping issue. I have a texture and a normal texture on each model loaded via the ASSIMP library. I am calculating the tangent vectors on each object with the help of the ASSIMP library so these should be fine. The objects work…
Joey Dewd
  • 1,734
  • 3
  • 16
  • 43
7
votes
1 answer

Sun as a light source using opengl and c++

I am working on the solar system and I am trying to get the sun to be the central light source of this program but it's not working the way I thought it would. Here is a picture of what I have without lighting. Here is the same program with…
TRod
  • 295
  • 2
  • 6
  • 18
1
2 3
47 48