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
7
votes
2 answers

Strange square lighting artefacts in OpenGL

I have a program that generates a heightmap and then displays it as a mesh with OpenGL. When I try to add lighting, it ends up with weird square shapes covering the mesh. They are more noticeable in some areas than others, but are always there. I…
sigill
  • 71
  • 3
6
votes
3 answers

How to correct uneven illumination in images using MATLAB?

I am performing feature detection in a video using MATLAB. The lighting condition varies in different parts of the video, leading to some parts getting ignored while transforming the RGB images to binary images. The lighting condition in a…
Sulla
  • 6,763
  • 7
  • 40
  • 65
6
votes
2 answers

Light source inside a room acting unexpectedly

I've written several Android apps, but this is my first experience with 3D programming. I've created a room (4 walls, ceiling and floor) with a couple objects inside and am able to move the camera around it as if walking. I've textured all surfaces…
atheaos
  • 721
  • 2
  • 6
  • 16
6
votes
3 answers

How to create fast and easy scene-independent shadows w/o shaders in OpenGL

Let i have some mesh (for ex. sphere) in the center of room, full of cubes and one light source. How can i make fast and easy shadow-casting in OpenGL, using "standard" (fixed) functions only? Note: the result must contain cube and sphere shadows as…
shybovycha
  • 9,794
  • 6
  • 47
  • 77
6
votes
0 answers

SKSpriteNode lighting doesn't work with textures from SKTextureAtlas

I ran into a problem with SpriteKit (tried Xcode 7 beta and Xcode 6.4 on OS X 10.11 beta) where normal-mapped lighting breaks down if I create a SKTextureAtlas from the image and normal files that work when used individually. See this example: From…
LearnCocos2D
  • 63,754
  • 20
  • 125
  • 213
6
votes
1 answer

Lighting Stays with Animated Surface in Matlab

I'm attempting to animate a rotating sphere in Matlab, however the lighting on the sphere rotates with it. I instead want the sphere to rotate while the lighting remains fixed with the coordinate system. Here's a gif of what my code is currently…
joshchab
  • 63
  • 3
6
votes
1 answer

Normal mapping and phong shading with incorrect specular component

I'm implementing normal/bump mapping in world space coordinates (I find those easier to work with) and my lighting worked fine without normal mapping, but when introducing normal mapping (and the new vectors calculated with the TBN matrix) the…
Joey Dewd
  • 1,734
  • 3
  • 16
  • 43
6
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,461
  • 2
  • 26
  • 46
6
votes
3 answers

How can I make a ball of light in openGL?

I'm trying to make a orb of light (Like a sun) but I can't seem to make it visible at all. I'll give you some snipets of code I have. It's in Java LWJGL, so it might look a little different. private float lightAmbient[] = { 0.0f, 1.0f, 1.0f, 1.0f };…
William
  • 8,162
  • 23
  • 73
  • 106
6
votes
2 answers

Rotate Normals in Shader

I have a scene with several models with individual positions and rotations. Given normals, the shaders apply simple bidirectional lighting to each pixel. That is my vertex shader. #version 150 in vec3 position; in vec3 normal; in vec2…
danijar
  • 27,743
  • 34
  • 143
  • 257
5
votes
2 answers

2D Tile Lighting

I'm adding lighting to my XNA 2D tile based game. I found this article useful, but the way its done it does not support collision. What I'd like is a method to do the following Have always lit point Collision (If the light ray hits a block, then…
Cyral
  • 12,859
  • 5
  • 40
  • 78
5
votes
1 answer

OpenGL object glossy/shiny in Mac OS X 10.6, but not 10.5. Why?

I've written an OpenGL screensaver for Mac OS X 10.5 and higher which shows a spinning heart constructed using marching cubes. It works fine on my black 13.3" development Macbook running Snow Leopard (10.6), nice and glossy. But when I try it on a…
thinkski
  • 1,236
  • 1
  • 13
  • 23
5
votes
1 answer

OpenGL glEnable(GL_COLOR_MATERIAL) followed by glDisable(GL_COLOR_MATERIAL)

I was drawing, simultaneously, a vertex colored cube next to a textured cube, with glDrawArrays(), and found that with lighting enabled the textured cube gets "slightly brighter". After some debugging I found that the very first moment that…
luiez
  • 51
  • 1
  • 4
5
votes
2 answers

Global illumination for static geometry

I have been trying to find a suitable global illumination technique, preferably based on OpenGL or GPGPU, to light an outdoor scene which has static objects and dynamic light sources (it is a city model). It does not need to be very detailled or…
Violin Yanev
  • 1,267
  • 2
  • 15
  • 22
5
votes
2 answers

Light Direction and its Transformation in the Simplest Lighting Model

So, I've gotten to basic lighting in my OpenGL learning quest. Imagine this simplest lighting model. Each vertex has a position, color, and normal. The shader gets the ModelViewProjection matrix (MVP), Modelview matrix(MV) , and Normal matrix (N)…
Armen Tsirunyan
  • 120,726
  • 52
  • 304
  • 418
1
2
3
47 48