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).

812 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
  • 900
  • 2
  • 8
  • 11
47
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
  • 22,200
  • 14
  • 65
  • 81
27
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
  • 8,828
  • 13
  • 64
  • 98
27
votes
3 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
  • 25,431
  • 32
  • 84
  • 131
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,328
  • 1
  • 20
  • 36
11
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,650
  • 2
  • 14
  • 35
9
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,783
  • 8
  • 44
  • 75
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,637
  • 4
  • 24
  • 49
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,174
  • 11
  • 25
9
votes
2 answers

When do I have to multiply two colors together when do I have to add them?

I've implemented a simple shader with the following properties: - Material (ambient, diffuse and specular) - Base color which defines the color of the object - Light Color Fragment shader: (vColor is the base color of the object) vec3 lightDir =…
morpheus05
  • 4,772
  • 2
  • 32
  • 47
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…
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,158
  • 2
  • 21
  • 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
  • 15,671
  • 8
  • 57
  • 102
7
votes
1 answer

SDL2 - Draw fully-transparent circle on a texture

I'm developing a 2D game in SDL 2.0 and I'm having am trouble with my lighting system. I want to fill the screen with fog and create a transparent circle around the player (lower-left). I know how to make a dark room with a tinted light using…
DragonDePlatino
  • 159
  • 1
  • 10
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…
Robert P
  • 9,398
  • 10
  • 58
  • 100
1
2 3
54 55