Lights, shadows and deferred renderer

June 1, 2015

Thanks to implemented deferred renderer it is possible to create and manage lights on 3D Wayfinder Administration panel. This means also real-time shadows, point-lights and multiple directional lights.

Deferred rendering is an alternative approach to rendering 3d scenes. The classic rendering approach involves rendering each object and applying lighting passes to it. So, if an object is affected by 5 lights, it will be rendered 5 times, once for each light, in order to accumulate the effect of each light. This approach is called “forward rendering”.

Deferred rendering takes another approach: first of all of the objects render their “lighting related infomation” to a texture (G-buffer). This includes their colors, normals, depths and any other info that might be relevant to calculating their final color. Afterwards, the lights in the scene are rendered as geometry (sphere for point light, cone for spotlight and full screen quad for directional light), and they use the G-buffer to calculate the color contribution of that light to that pixel.

Using deferred renderer decreases performance a bit, but with proper GPU, the frame rate drops only by 1-2 frames per second.
Lights can be added and managed from „Lights” tab in editor window.

Lights management in 3D wayfinder

 

 

There are 3 types of light:

  • Omnidirectional – this is point light, it is possible to change light radius and intensity.
  • Directional – this makes global directional light, like sunlight
  • Ambient – With ambient it is possible to change the overall lighting of the whole 3D model.

 

So lets get started with adding lights and see, what will happen in our 3D scene.

First we have turned on deferred renderer. With default settings, it is currently not turned on.

Deferred renderer options

 

 

 

 

 

To use custom lighting model on Wayfinder application side, we have to enable deferred renderer.

 

Now we can see shadows:

Deferred renderer and shadows in 3D Wayfinder

 

Now we have added 2 point-lights. From the settings we have selected „Omnidirectional” and by playing with radius and intensity we get the desired result. One of the lights is white and another one yellow:

 

Point lights added to 3D Wayfinder

 

At the same time we have lost the default ambient color. So now everything looks a bit too colorful. To get the ambient color back, we added one ambient type light.

So far we used default ambient color, which is gray.

It doesn’t matter for ambient and directional light, where they are positioned in the 3D floor plan. For clarity and easier management we have made them same kind of „cubics” as omnidirectional light. So you can position them wherever you like.

After adding gray ambient color, we get this:

Ambient light added to 3D scene

 

Now lets add a custom directional light. Lets say that we prefer shadows in other direction and this front-side of the building to be more lightened.

With directional light it is important to turn the direction of the light. For this we need to check „move manually” and then select rotate.

Changing light in 3D editor

 

After saving we see a picture with different shadows:

Directional light added to 3D scene

 

Well, the shadows are really long and the whole scene looks a bit dark.

But we can always add another directional light. Of course adding each directional light, affects the performance, as for every light there will also be shadows rendered.

So go ahead and test the magical world of lights in 3D.

« »