# Tagged Questions

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.

4answers
3k views

### Opengl lighting not working

I have rendered a spinning model in LWJGL. I have calculated normals and enabled lighting. Now I make a light: float lightpos[] = {0, 0, 0, 0}; FloatBuffer lightposb = BufferUtils.createFloatBuffer(...
1answer
630 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 ...
1answer
2k views

### Cook Torrance model implementation : black specular light

I am trying to implement the Cook-Torrance model, and this is how I calculate the parameter Rs: float Rs(float m,float F,vec3 N, vec3 L,vec3 V, vec3 H) { float result; float NdotV= dot(N,V);...
1answer
1k 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 ...
1answer
172 views

### Fragments never falling into spot light's cone

I am using GLSL version 1.20 with OpenGL 2.1 . I am trying to compute when a fragment falls into the area of a spot light. I have already set all the light values with glLightfv and glLightf, also ...
1answer
1k views

### vec4 for vec3 multiplication while calculating the specular value

I'm following this tutorial to calculate the specular color of a vertex. I use OpenGL 2.1 with GLSL version 120. This is the formula that I apply: spec= (R*eye)^s * Ls * Lm With: L=...
2answers
1k 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 Unity,...
1answer
399 views

### Can't get normals to work correctly with lighting in OpenGL [closed]

I'm trying to light up a simple 2d triangle with my cursor as a diffuse light source but can't seem to set the normal correctly for the lighting to look right. The function that calculates the normal ...
1answer
1k views

### Has anyone got the Krypton Lighting Engine working in MonoGame for Windows 8?

I've converted the core of the Krypton Lighting Engine so that it's compatible with Windows 8. The trouble I'm having when actually using it is that it can't load the KryptonEffect.xnb file. I'm ...
2answers
2k views

### What is the color value of daylight?

This is a very short question. I want to implement ambient light in the color of daylight from the sun. What is the color value of sun light?
2answers
317 views

### Diffuse light direction

I'm learning a tutorial from Rastertek about diffuse light with DX 11, here's the shader code: float4 LightPixelShader(PixelInputType input) : SV_TARGET { float4 textureColor; float3 lightDir;...
1answer
237 views

### How does pixel shading work for ambient occlusion volumes?

I'm trying to understand the ambient occlusion technique described here, but I've trouble comprehending what exactly is the pixel shader doing. Is the pixel shader invoked on points that belong to ...
2answers
661 views

### Changing Ogre3D terrain lighting in real time

I'm looking at the Ogre 3D library and I'm browsing through some examples / tutorials. My question is about terrain. There are a few examples showing how great the terrain system is, but I think that ...
3answers
3k views

### Lights shining through walls

I'm currently having a problem with lights in Unity. They shine through walls for some reason. Point, directional, etc. If a light is next to a wall on one side, you can see it on the floor on the ...
1answer
487 views

### Gamma-Correct rendering without floating-point rendertargets

When using a gamma-correct pipeline, you have to work with floating-point rendertargets. Otherwise, you will get severe banding due to the insufficient precision of the usual 8-bit-per-channel integer ...
1answer
1k views

### Blender Object Appearing Gray when all Lights are Off

I have an issue with Blender where, when I turn my only light off (a sun lamp) and render the image my object appears gray rather than black (and thus, not appear to the camera). I can't figure out ...
1answer
1k views

### Multiply mode in SpriteBatch

I have a "lighting" texture (black background with white or colours for lights) that I want to draw as a multiplcation operation. SpriteBatch.Begin can specify BlendState.Additive, but there's no ...
1answer
562 views

### Performance of pixel shaders vs. SpriteBatch: XNA

Precondition: I read this question/answer about using shaders, or spritebatch, to render and mark a sprite. I need to do something like that. I also have a 2D lighting PoC which I need to write. The ...
0answers
588 views

### Per fragment lighting with OpenGL 4.x tessellated model

I'm experienced with OpenGL 3+. I'm dabbling with tessellation shaders and have now got to a point where I have a nicely tessellated teapot/plane demo (quick look here) As can be seen from the ...
1answer
338 views

### OpenGl / C++ and some strange light problem on half board [closed]

I have some problem with lights in my opengl "game". I have board with is square (-50,50), (50, 50), (50, -50), (-50,-50) x and z since y doesn't matter at all. I tried to make something like ...
2answers
641 views

### How to create realistic 2d lighting using colour temperature

I'm looking for a lighting algorithm that produces realistic lights expressed in kelvins, from about 2500k to 6500k. What I'm confused about is how to make the lights properly interact with the colors ...
1answer
796 views

### GLSL per pixel lighting with custom light type

Ok, I am having a big problem here. I just got into GLSL yesterday, so the code will be terrible, I'm sure. Basically, I am attempting to make a light that can be passed into the fragment shader (for ...
1answer
1k views

### Speed up lighting in deferred shading

I implemented a simple deferred shading renderer. I use 3 G-Buffer for storing position (R32F), normal (G16R16F) and albedo (ARGB8). I use sphere map algorithm to store normals in world space. ...
1answer
333 views

### How do I autogenerate gradient lighting?

I am trying to think of a way to generate a gradient like this picture: Something like this GetGradientTexture(360f,100(width),100(height)), or if i want a directional light (like a flashlight) ...
1answer
101 views

### What is a fast way to darken the vertices I'm rendering?

To make a lighting system for a voxel game, I need to specify a darkness value per vertex. I'm using GL_COLOR_MATERIAL and specifying a color per vertex, like this: glEnable(GL_COLOR_MATERIAL); ...
2answers
2k views

### Why does my model render differently than its preview?

I've been importing .fbx files that I made with 3DS Max 2012 into Unity, and it's quite neat to see my models running around in game. However, I can't help but notice that the models, as they're ...
1answer
643 views

### forward rendering and multiple shadow maps

I have two light sources on my scene. I created two fbo's which store depth textures for these lights. A render loop looks like this: bind fbo1 save depth values for first light unbind fbo1 bind ...
1answer
484 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 ...
4answers
8k 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 ...
2answers
2k views

### 2-d lighting day/night cycle

Off the back of this post in which I asked two questions and received one answer, which I accepted as a valid answer. I have decided to re-ask the outstanding question. I have implemented light ...
2answers
1k views

### 2D lighting theory: day-and-night cycle, spot lights at night

I am writing a rogue-like 'zombie' management game. The game map will be similar to Prison Architect. A top-down 50 X 50 grid. I want to implemented a day night cycle and during the night I would ...
1answer
1k views

### How can I achieve this lighting with OpenGL?

I'm currently trying to implement a type of "smooth" lighting. How can I achieve lighting which looks like this: http://dl.dropbox.com/u/1668516/concept/warp3.png Using OpenGl. I've attempted to use ...
0answers
142 views

### Light on every model and not in the whole scene

I am using a custom shader and try to pass the effect on my Models like that: foreach (ModelMesh mesh in Model.Meshes) { foreach (ModelMeshPart part in mesh.MeshParts) { part....
1answer
298 views

### multipass shadow mapping renderer in XNA

I am wanting to implement a multipass renderer in XNA (additive blending combines the contributions from each light). I have the renderer working without any shadows, but when I try to add shadow ...
1answer
2k views

### How does Minecraft render its sunset and sky?

In Minecraft, the sunset looks really beautiful and I've always wanted to know how they do it. Do they use several skyboxes rendered over eachother? That is, one for the sky (which can turn dark and ...
1answer
915 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 ...
1answer
154 views

### Where does the light come from, using Maya/Panda3D?

Total noob to Maya. Total noob to Panda3D. Planning on becoming really good at both as soon as I have free time to do so, but right now I have an assignment due in a few hours which requires this: (...
1answer
784 views

### How do I reconstruct depth in deferred rendering using an orthographic projection?

I've been trying to get my world space position of my pixel but I'm missing something. I'm using a orthographic view for a 2.5d game. My depth is linear and this is my code. float3 lightPos = ...
2answers
2k views

### OpenGL Lighting [duplicate]

I have a simple day and night cycle by at day disabling OpenGL lighting and at night enabling openGL Lighting. When I enable everything appears darker. My question is How would I make it that at a ...
3answers
516 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 ...
1answer
1k views

### Radiosity lightmap generation

Is there any working C++ source code for a lightmap generation algorithm using Radiosity or any other GI system? I've found technical papers only, but I can't really find any implementation.
1answer
721 views

### how to modify shadow mapping in “3D Graphics with XNA Game Studio 4.0”? [closed]

So I've been following the tutorials from the book Sean James's "3D Graphics with XNA Game Studio 4.0", and have been doing fine until i reached the shadow mapping part. in this book it creates point ...
1answer
394 views

### How can I simulate light using mask images on the iPad? [duplicate]

Possible Duplicate: Can I achieve a torchlight effect (lighter area around a light source) in a 2D game? I want to have a picture as a background, say this: Then I would like to apply a ...
2answers
821 views

### How to make HLSL effect just for lighting without texture mapping?

I created an effect and just want to use lightning but in default effect that XNA create we should do texture mapping or the model appears 'RED', because of this lines of code in the effect file: ...
2answers
433 views

### Lights system with shaders in OpenGL?

In more than just 1 occasion, i read about 2 ways of doing a light's system in OpenGL: normal way? i don't know how to call this one with the shaders ( GLSL ) The problem is i don't get the ...
1answer
224 views

### Drawing at negative coordinates in XNA?

I am trying to make a 2D isometric RPG and I kind of hit a wall when it comes to lighting. I was thinking of using shaders, if I manage to understand them.The problem I am anticipating is the presence ...
1answer
370 views

### Tools need to for low poly model, texture making & lighting in unity3d (iOS) [closed]

I am new to unity3d, i want to create a 3d game i have a team of 3d designers and programmers. My question which software should we use for modelling, texture making and advanced lighting for mobile ...
2answers
385 views

### Techniques for lighting a texture (no shadows)

I'm trying to learn about dynamic shadows for 2D graphics. While I understand the basic ideas behind determining what areas should be lit and which should be in shadow, I don't know how I would "...
2answers
782 views

### Lighting problems with Terrain

I'm in the process of learning Open GL and am having issues with lighting on my Terrian, I don't know if the issue is related to how I calculate my normals or the shader itself (I am using the shader ...
1answer
507 views

### Setting Krypton Light to Screen Pixels

So a few days back, I started playing around with Krypton XNA for 2D lighting in my game. I noticed in general, that spawning a light at (0,0) with Krypton causes the light to appear in, pretty much, ...