# Light Strips in Vulkan Renderer

290 views

It's always fun when I can do something completely new that people have never seen in a game engine. I've had the idea for a while to create a new light type for light strips, and I got to implement this today. The new engine has taken a tremendous amount of effort to get working over two years, but as development continues I think I will become much more responsive to your suggestions since we have a very strong foundation to build on now.

Using this test scene provided by @reepblue you can see how this new light type looks and behaves. They are great for placing along walls, but what really made me interested was the idea to calculate specular lighting not from a single point, but with a different way. I thought if I could figure out the math I would get a realistic reflection on the ground, and it worked!

The reflection on the floor is actually the specular component of the light. We are used to thinking of specular reflections as a little white circle that moves around, but the light doesn't have to be coming from a single point. Some calculations in the shader can be used to determine the closest point to the light strip and use that for reflections. The net effect is that a long bar appears on the floor, matching the length of the light. This is not a screen-space effect or a cubemap. When you look down at the floor the specular component is still there shining back at you. Every surface is using the same exact equation, but it appears very different on the walls, the ceiling, and the floor due to the different angles.

Even a surface facing opposite the light will correctly reflect it back to the camera.

In this image, I created a small green strip light that looks like a laser. There is no visible laser beam, but if there was it would appear above the soft green lighting. The hard line on the ground is actually the specular reflection of the light. You can see it reflecting off the sphere as well.

The new Vulkan renderer also supports box lights, which are a directional light with a defined boundary, and I have an idea for one more type of light.

• 6

wow keep it up

it looking good

Looking Nice, just my two cents dont you think that there should be gaps btw the reflection rects as seen in the light strip. Also do you have plans of implementing area lights in the turbo engine?

31 minutes ago, m.yuneeb90 said:

Looking Nice, just my two cents dont you think that there should be gaps btw the reflection rects as seen in the light strip. Also do you have plans of implementing area lights in the turbo engine?

This light is a geometric shape and has nothing to do with the visual model. It's like a light saber. I support it would be more accurate to create one strip light for each light tube and leave a small gap between them.

2 hours ago, m.yuneeb90 said:

Also do you have plans of implementing area lights in the turbo engine?

I have seen many different definitions of what an "area light" is. What are you describing?

@m.yuneeb90 That's exactly what I did, although the example you posted above does not show any specular reflection for the line strips. Getting a specular reflection with a line is actually really hard because there isn't an easy intersection / closest point algorithm and you have to mess around with plane equations. Other shapes are fairly easy so I think those can be added too without much trouble.

One issue with this type of technique is it does not work very well with shadows. It could be possible to add shadowmaps for some shapes, but since light is coming from multiple directions it would look odd, and it would be impossible to correctly shade the specular component, because it can come from many different directions. I think the voxel raytrace system I have in mind will be able to handle these types of things better. But, this is another tool you can access.

What really prompted this was @reepblue showed me his test level and I thought the fluorescent tubes should get a new light type for them.

17 hours ago, Henrik R said:

Well done, but it's not quite new - has been done by Frostbite and others before, see the tube lights from here: https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf

I’m using a ray, not a geometric volume. Different math although it looks similar to a skinny cylinder.  The really interesting part is that although the line has no thickness and would be invisible (or nearly) in a perfect reflection, the surface adds vertical height to the reflection, the same way light reflections appear impossible tall on a rainy street.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×

• Pages

• Back
• Store

• #### Support

• Projects
×
• Create New...