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
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,804
  • 3
  • 20
  • 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
  • 293
  • 2
  • 9
  • 19
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
  • 4
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
  • 7,631
  • 9
  • 45
  • 71
6
votes
2 answers

How do I make the lights stay fixed in the world with Direct3D

I've been using OpenGL for years, but after trying to use D3D for the first time, I wasted a significant amount of time trying figure out how to make my scene lights stay fixed in the world rather than fixed on my objects. In OpenGL light positions…
Baxissimo
  • 2,629
  • 2
  • 25
  • 23
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
  • 7
  • 16
6
votes
0 answers

THREE.js Whats the best way to add lighting from blender exported gltf

I would like to find the best way to add lights from a blender scene into a THREE.js project. I can not find an explanation of how to import the lighting from blender to THREE.js anywhere. You are expected to already have lighting in your THREE.js…
David Clews
  • 795
  • 6
  • 14
6
votes
2 answers

How do I tell if the active texture is texture id 0 in GLSL?

I have model assets that are untextured and I am tired of rendering them as black without lighting. This is because if texture id 0 is bound and I ask the sampler it tells me its black. Later leading to 0 * lighting making the entire object black…
EnabrenTane
  • 7,428
  • 2
  • 26
  • 44
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
  • 11,556
  • 6
  • 52
  • 82
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…
CodeSmile
  • 64,284
  • 20
  • 132
  • 217
6
votes
1 answer

SceneKit - Lighting and casting shadows

I'm trying to create a spot light that illuminates a cube. The surface underneath should then show a shadow. Unfortunately I wasn't able to achieve this. The light ignores the cube and casts the light on both - the surface and the cube - regardless…
Max
  • 2,699
  • 2
  • 27
  • 50
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,804
  • 3
  • 20
  • 43
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,630
  • 23
  • 77
  • 110
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
  • 32,406
  • 45
  • 166
  • 297
1
2
3
54 55