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.

learn more… | top users | synonyms

2
votes
2answers
68 views

Render with multiple lights (one pass per light)

Hi I'm new here so sorry if I make some mistakes writing this question. I have already a system that at the moment handle multiple lights just passing an array of light struct and loop through it. I ...
1
vote
1answer
77 views

XNA Diffuse Shader Issue. Edge lighting problem. Image Attached

As you can see in this image the diffuse shading is working correctly in some places but in other places such as the the bottom of the sphere you can see the squares/triangles of the mesh. Any ...
0
votes
0answers
25 views

Get light positions from an environment map

As the title says, I was wondering if there's a way, in a preprocessing step, to infer the position of a some light sources starting from an environment map. I think I saw lights inferred from an ...
2
votes
1answer
44 views

Irradiance cubemap to spherical harmonics conversion

What are advantages of using spherical harmonics instead of irradiance cubemap? Are there any common used methods for conversion?
0
votes
1answer
29 views

Rotation with XMMatrix to Rotation with XMFLOAT3

I'm rotating a Direction Light around a fixed object, so the light only contains a XMFLOAT3 to determine it's direction that it is facing. I have another object rotation using the variable Rotation ...
3
votes
1answer
136 views

Best way to blend colors in tile lighting? (XNA)

I have made a color, decent, recursive, fast tile lighting system in my game. It does everything I need except one thing: different colors are not blended at all: Here is my color blend code: ...
1
vote
2answers
109 views

Implementing directional lighting in voxel based polygon-engine

I'm having trouble implementing directional lighting. (I'm not that familiar with 3D.) The problem is that the lighting does not "follow/flow with" the other blocks next to them. How should I fix ...
1
vote
1answer
48 views

Handling multiple lights of different types in GLSL

I want to be able to support multiple lights of different types (point, spot & directional). Note that I also want to be able to render transparent/translucent objects, which rules out deferred ...
3
votes
1answer
403 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 ...
2
votes
0answers
95 views

Libgdx - IsometricTiledMapRenderer and light shading

I am wondering if there is any way to simulate light shading in Libgdx using an IsometricTiledMapRenderer. Here is my code to draw an isometric map, it's able to be moved around with the mouse and ...
0
votes
1answer
60 views

Volumetric Lighting projects models

I've been trying to implement Volumetric Lighting using the code from this tutorial but I've run into some issues, even after basically copypasting the shader code. I'll just show you what's going ...
1
vote
0answers
18 views

Trouble with Lightmaps When Meshes Intersect

I've been working on making lightmaps for a game on mobile devices (meaning that individual texture sizes cannot exceed 2048 and that file size needs to be as small as possible), but I'm running into ...
0
votes
0answers
33 views

How to add a flashlight in libgdx?

So I want to add a flashlight to the game when the game starts to get darker which I already have working. I bound a light texture to the batch and the first problem is that for some reason the ...
4
votes
1answer
65 views

Lighting computation viewing direction

This is something that's really cooking my noodle. When I'm computing the light response for a material in my fragment shader, I'm using the standard 3 normalized vectors, in eye space: fragment ...
2
votes
0answers
55 views

Using sky for indirect lighting - should I remove the sun?

I'm attempting to achieve slightly more realistic ambient lighting in outdoor scenes using the sky cubemap. When rendering an object, I first calculate the direct lighting contribution using ...
0
votes
0answers
26 views

Light shaped like a line

I am trying to figure out how line-shaped lights fit into the standard point light/spotlight/directional light scheme. The way I see it, there are two options: Seed the line with regular point ...
0
votes
0answers
26 views

How to draw a spotlight in 3D

To be clear, I am not talking about the light result (the lit area) but the spotlight itself, like this The two common suggestions that I tried are 2D image and a 3D cone. The problem with the ...
1
vote
0answers
35 views

Normal map lighting bug in bottom right quadrant

I am currently working on getting normal maps working in my project, and have run into a problem with lighting. As you can see, the normals in the bottom right quadrant of the lighting isn't ...
1
vote
0answers
26 views

How can I perform a masked erase in SDL2?

I'm trying to implement some shadow/lighting effects in my 2D-project, and I've concluded that if there is an easy way to perform a masked erase on an SDL_Texture, it would make the drawing operations ...
1
vote
1answer
71 views

Correcting Lighting in Stencil Reflections

I'm just playing around with OpenGL seeing how different methods of making shadows and reflections work. I've been following this tutorial which describes using GLUT_STENCIL's and MASK's to create a ...
0
votes
0answers
44 views

box2dlights conelight rotation is off

I'm using libgdx/box2dlights for my game~ I have a conelight set up as such: ConeLight cl = new ConeLight(rh, 32, new Color(0f, 0.0f, 0.0f, 1.0f), 3, 0, 0, 0, 1); where "rh" is a RayHandler set to ...
6
votes
2answers
177 views

Reducing Spherical Harmonic Ringing

I've generated some 2nd order SH light-probes from cube-maps in my scene and I was surprised how strong artifacts are around the back of the dominant lights. I switched to a Lambert source plus ...
2
votes
1answer
135 views

Surface shader with VertexLit causes black object

I wrote the simplest possible surface shader: Shader "SimpleSurf" { Properties { _MainTex ("Base (RGB)", 2D) = "white" {} } SubShader { Tags {"RenderType"="Opaque" } ...
0
votes
1answer
41 views

Way to avoid excessively bright objects with specular lighting?

I have a typical Phong shading with specular light. I have all the parameters tuned so to give appropriate highlights from a point light source. Now the problem I have is a new object that has a large ...
1
vote
1answer
76 views

Brighter pixels around area (OpenGL ES 2)

I'm trying to achieve an effect like in the image bellow. Basically I will have a 2D texture and I want a small area around a point (let's call it "light source") to be slightly better lit (i.e. be ...
3
votes
1answer
116 views

Creating a black light (ultraviolet) shader?

I am interested in the algorithm for color picking that would ideally allow to choose what color range will be highlighted and what color range will be faded. I can sort-of understand how to make it ...
13
votes
8answers
2k views

Does the linear attenuation component in lighting models have a physical counterpart?

In OpenGL (and other systems) the distance attenuation factor for point lights is something like 1/(c+kd+sd^2), where d is the distance from the light abd c, k and s are constants. I understand the ...
0
votes
1answer
56 views

Light direction not being calculated correctly

I'm trying to implement deferred lighting in my game, and have run into an issue with normals. The image above shows the lighting being applied to a tile map. The yellow shade represents the ...
6
votes
3answers
565 views

How can I create a shader that will reproduce this lighting effect on terrain?

Notice the way in which the major light source in each image reflects off the ground, as a function of the distance between the light source and the viewer (?). Is this a (bumped) specular map? ...
0
votes
2answers
138 views

Unity3D Directional lights vs Draw calls

I need 2 light sources looking at a different direction as per my design. This means, I cannot flag one of them as 'not-important'! I found that because I'm using 2 directional lights, drawcalls are ...
16
votes
3answers
3k views

What is the utility of squared radius and inverse squared radius for lighting computations?

On one of the slides from "DirectX 11 Rendering in Battlefield 3" PowerPoint I noticed the folowing code: struct Light { float3 pos; float sqrRadius; float3 color; float invSqrRadius; } I ...
1
vote
4answers
222 views

Cell Lighting Propagation Problem

I have in place a cell-based lighting system that works basically like this: (Not my actual code) //Light moves up for (int x = 0; x < width; x += 1) { for (int y = 0; y < ...
6
votes
2answers
463 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 ...
1
vote
0answers
62 views

SpotLight in ForwardBase pass using forward rendering

Is there anyway I can force Unity to allow me using a custom shader to render spotlights in a ForwardBase pass (using Forward Rendering Path)? For what I could see since now: Unity use and ...
1
vote
1answer
649 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 ...
3
votes
1answer
126 views

Understanding and editing HDR light environments in Photoshop

I'm working with an in-development system that uses .hdr environments (equirectangular projection) to provide image-based lighting (IBL) to a 3D rendering. I'm trying to understand what range of ...
1
vote
1answer
146 views

How to create a sun billboard with Ogre3d

I've been working with a few different engines alongside trying to code my own project. Rather than rewrite an entire renderer, etc I am using Ogre3d. To begin with I am trying to implement a very ...
0
votes
1answer
94 views

Surface shader ignores lighting in vertexLit path

I want to use a surface shader in VertexLit(not Forward) rendering path. I caused a problem that the compiled shader completely ingnores lighting from the light sources on the scene. Here's the code: ...
0
votes
0answers
45 views

Cone Lighting formula for 2D projection space?

There is a good formula for a 3d cone lighting: float angleCos = dot(lightVector.rgb, lightDirection.rgb); attenuation = saturate((angleCos-coneCos)*coneCos); What if I want to compute whether my ...
2
votes
0answers
525 views

How to occlude lights in Unity3D?

First off, I own Unity Pro. I've been looking in to occluding lights when they aren't being viewed for a while now to improve performance. The main methods I ran in to were using BecameVisible() and ...
1
vote
1answer
100 views

Why is the light following my camera around?

I have implemented a simple Phong shader without specular highlights for now (just ambient + diffuse components) The problem however, is that the calculations seem to be done in camera space; as I ...
0
votes
2answers
37 views

Compute cone angle (cos) given side and hypotenuse vectors at time 0 and world matrix at time 1

I need a formula for the cosine of a cone, given normalized side vector, normalized hypotenuse vector at time 0 and world matrix at time 1. This is needed to implement custom spotlights in a level ...
0
votes
2answers
608 views

Simple 2d tile based lighting in xna

I am currently trying to implement simple lighting into my game. My world is represented in a 2d array of numbers, each number being a certain tile. I am changing the color parameter in the ...
5
votes
1answer
474 views

Lightmapped prefabs for procedural content

I'm doing a game with procedural content from handmade prefabs, but I ran into a problem as Unity bakes the scene instead of objects when lightmapping with Beast. So when the prefabs are instanced ...
1
vote
1answer
124 views

How do I get my polygons to be lighted by either side?

Okay, I am using Ogre3D and Gorilla(2D library for ogre3D) and I am making Gorilla::Screenrenderables in the open scene. The problem that I am having is that when I make a light and have my ...
0
votes
0answers
31 views

Checking if a object is blocking my view of a light (it's between light and camera)

I'm trying to determine, from a list of objects, which ones are blocking my view of a light. In other words: which ones are between the light and the camera. Coding in C++, using HPL1Engine. This is ...
7
votes
3answers
2k views

How do I implement occluded lighting in a block-based 2D game?

I want to have 2D lighting that can be blocked by in-game objects. My game has a top-down view and all game objects are described by rectangles. Let's say I have a 10x10 world and I place a light at ...
2
votes
2answers
28 views

Derive direction in which a spot light emites its light from a projection matrix

First of all, sorry if my question sounds too basic or even makes no sense. I'm new with game development I'm working with HPL1Engine, specifically, the lights parts. I need to know the direction in ...
0
votes
0answers
75 views

Cast shadow without rendering object

I'm new to UDK, and am using it to develop a survival-horror game based heavily on shadows. My question is short: is there a way to create an actor that, when rendered, ONLY renders its shadow (not ...
4
votes
1answer
1k views

GLSL Light (Attenuation, Color and intensity) formula

I'm implementing point lights in my Voxel engine, and I'm really struggling to get a good flow of light, from 100% near the light source to 0% at the light radius. I have 5 arguments for the ...