Jump to content

APB Dev Blog (1 November 2019)

Recommended Posts

6 hours ago, FRAYDO said:


Dynamic Lighting Improvements

To be clear, I'm almost exclusively talking about how light interacts with dynamic/moving objects, not about the baked vertex lighting for static meshes ("light solve"). The latter is not easy to replace at a reasonable performance cost despite how terrible it looks, so I'm leaving that for the future. I'm also slightly misusing the term "Dynamic Lighting" to mean static lights illuminating moving geometry. We do not have moving lights in W3D.

, the incoming light direction was calculated once for each mesh and thus every light was effectively treated as a directional light (infinitely far away) in the pixel shader. This means that there was no smooth distance falloff (attenuation) for the light across a larger object. The only thing that was considered per-pixel was the angle between the mesh normal and the incoming light direction.

You can clearly see the jarring visuals this can create in the screenshot below (walls are usually not lit as dynamic meshes, but they demonstrate the issues quite well):


The wall in front is lit by a red spot light, while the back wall is lit by a white point light. There are horrible discontinuities in the lighting across the three wall segments, and the leftmost segment in the front doesn't receive any lighting because its center point is not within the maximum attenuation radius of the light. Furthermore, the tree to the right is fully lit up despite only grazing the red spot light cone (the cone visualization is also new) because it is still only checked aginst the radius, not against the actual cone.

The latter is not just a minor visual problem since we can only have a maximum of four lights processed per object (for performance reasons), so if there are multiple spot lights close to each other with non-overlapping cones, but overlapping spheres according to their attenuation radius, the game might have a difficult time picking the lights that contribute the most light to this mesh, leading to annoying situations where lights suddenly "pop up" or flicker when you're moving through the world.

This means we largely had to make two fundamental changes: 

  1. Move the code that handles light attenuation from the CPU side to the GPU pixel shader and pass all the relevant information along (light position instead of direction, inner and outer attenuation radius, etc.).
  2. Improve the light culling code so that it can more accurately predict how much a light would contribute to the resulting illumination of a given mesh.






[blurb]APB update coming soon! In the meantime, have a dev blog of the latest changes that will be implemented. Water effects tweaked, Battlefield unit reference, and more![/blurb]

                  RTX ON

Edited by thedisclaimitory
I needed to fix the url
Link to comment
Share on other sites

On 11/1/2019 at 2:30 PM, Yah-Nosh said:

@FRAYDOThat shot of a MiG sniping a Gunboat, pure awesome :D

Thank you. Credit goes to Pushwall for that one!

On 11/1/2019 at 4:10 PM, NodGuy said:

Awesome update is awesome!

You're awesome!

15 hours ago, Mihaita12 said:

Great, one more and move on to the next!

Yes sir!

Link to comment
Share on other sites

Join the conversation

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

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...