x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Light bleeding with static mesh and BSPs

Hi,

being new to Unreal Engine 4 I built a building using only BSPs Boxes (Walls, floors, ceilings, doors, windows). My goal is to do this with some other buildings as well and then convert them into a single static mesh to be able to place them in one piece.

However, I am experiencing light bleeding at edges between two boxes, for example wall and floor and even across the whole ceiling. I tried some solutions from other questions, such as messing with shadow bias and shadow filter sharpen, but nothing really seemed to work out well. I converted the bsp boxes to one single static mesh, which has the exact same bleeding.alt text

Anything else I could try?

Product Version: Not Selected
Tags:
more ▼

asked Jan 01 '15 at 09:02 PM in Rendering

avatar image

adipFTW
70 10 15 23

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Hi AdipFTW,

I do have a couple of things you can try and information you can provide that would help me offer some other solutions as well.

  • Is your light source set to Static, Stationary, or Movable?

  • Is this a static mesh or a BSP, because you indicated that it was converted, but I'd like to be sure?

If this is a static mesh, you may just need to up the lightmap resolution, which is defaulted to 64. Since this is a larger meshes it will need to be higher since the UVs are using more space in the lightmap texture.

If this is still a BSP, select all the box brushes (excluding the subtractive brushes) and go to the details panel and set the lightmap resolution to 16, 12, 8, or 4. BSP's work in reverse of what static meshes do for their lightmap. A lower resolution will give you better shadows with this. Try 16 and work your way down until you find a resolution that works for you.

Something else to try is to build lighting on Production mode vs the default Preview mode. The lighting and shadow quality is much higher here. Often using production will block light bleed that happens in lower levels.

Give this a try and let me know.

Tim

more ▼

answered Jan 02 '15 at 07:58 PM

avatar image

Tim Hobson ♦♦ STAFF
49k 886 98 874

avatar image adipFTW Jan 02 '15 at 11:04 PM

Hi Tim,

thank you for suggestions! Concerning your questions:

  • I have only one light, which is set to movable, as the goal is a day/night cycle.

  • I modeled the building using BSPs first, then selected all of them and converted them into a single static mesh (is that the right way to do it?) to see, if differences occur.

On the static mesh I set Overriden Light Map Res (correct one?) to 1024 from 64. It resulted in no difference after rebuilding lighting, whether in preview or production quality.

Reducing the Lightmap Resolution Down to 4 with your suggested steps also results in no difference...

Best Regards Julius

avatar image Tim Hobson ♦♦ STAFF Jan 03 '15 at 01:26 AM

Ah, Well since you're using a movable (dynamic) light there is no need for lightmaps. Those are specifically for lights being build with Static or Stationary. This will bake all the shadows from the scene into lightmaps associated with each mesh. Dynamic lighting doesn't do this.

To affect the light bleed you'll want to adjust the shadow bias and the shadow filter. It will never be perfect though and at further distances it the crisper shadows will fade bringing some of the light bleed back. This is not a "bug" but a limitation of using dynamic lighting with cascaded shadow maps. The value of performance verses what looks good is a tricky trade off to have. It's going to be about finding a balance between using Dynamic Shadow distance (Values lower than 20000, which is the max, tend to work better), shadow bias (lower values, but not bottomed out because you'll get cascade line artifacts), and shadow filter sharpness (default is 3, but using 2 can get you softer shadows at the low of sharpness).

Also take a look at the documentation for Ray Traced Distance Field Soft Shadows. This is still somewhat experimental and has some limitations but the dynamic shadow quality is must better with it. In the future it may take the place of cascaded shadow maps but that has yet to be determined.

https://docs.unrealengine.com/latest/INT/Engine/Rendering/LightingAndShadows/RayTracedDistanceFieldShadowing/index.html

I hope this helps. :)

Tim

avatar image adipFTW Jan 03 '15 at 09:13 PM

Hi Tim, thanks again for helping me out, things start to look better. :) After messing around with some settings I achieved this: alt text

However, as you can see, there still is small light bleeding at the corners of the pillars, which I cant remove unless i bottom the shadow bias, but this of course is not an option. Furthermore I somehow added this waveform to the shadows, it appears to be related to the 'Dynamic Shadow Distance MovableLight' option on my lightsource, where a bigger number results in bigger waves, smaller numbers in smaller waves, but also lower visibility distance:alt text

alt text

Any way to refine those shadows further?

avatar image Tim Hobson ♦♦ STAFF Jan 05 '15 at 11:03 PM

For the best result and to not use Dyanmic shadow distance maps is to turn that down to 0 and leave the Ray Traced Distance Field shadows at 30000. Turn the dynamic distance to 0 will eliminate these types of results from cascaded shadows.

The only other option would be to tweak settings between the dynamic shadow distance, sharpen and shadow bias until you get a result that fits your needs.

Thanks!

Tim

avatar image adipFTW Jan 06 '15 at 09:47 AM

But if I set Dynamic Shadow Distance MovableLight to 0 all shadows disappear...

Does that mean I'm stuck with the other option?

EDIT: The shadows DO appear with static meshes, they just disappeared in my first BSP-only building. However I got some really bad artifacts... alt text

avatar image Tim Hobson ♦♦ STAFF Jan 06 '15 at 04:44 PM

Actually that's right. Sorry, I had forgotten that BSP does not support Distance Field Soft Shadows. I don't often use BSP so it had slipped my mind. :/

If you're going to use Distance Field Soft Shadows and Cascaded Dynamic Shadows you'll need to find a balance by adjusting the distance for the dynamic shadows. It won't be perfect due to its limitations though.

For static meshes, distance fields do require some tweaking.

You can go to the show button in the viewport > Visualize > Mesh Distance Fields.

This will change the buffer view and show how the shadows are made based on distance fields. If you look at your mesh and see holes or things that look odd (If you want post a screen shot and I can help diagnose) you'll need to adjust the resolution of them.

To do this open the mesh in the mesh editor > in the details panel on the right > LOD0 > go to Build Settings > Distance Field Resolution. The default is set to 1.0. Try changing this to 2 or 3. You can go higher but it may not be necessary unless there are still issues.

This is still an experimental feature of sorts so there are known issues, but for most uses it works well and is being actively used in Epics latest game in development, Fortnite.

Let me know! :)

Tim

avatar image adipFTW Jan 07 '15 at 10:09 AM

We're getting closer, step by step. :) Increasing the Distance Field Resolution to 2 got rid of those artifacts on the wall. However, there still remains 'shadow bleed' as seen on the following picture:alt text

While increasing the Distance Field Resolution to 2 brought better results, there are no noticeable differences between a value of 2 and 100.

I dont really understand, what I see, if I visualize those Mesh Distance Fields, it simply looks my mesh, but with rounder egdes. It got closer to the original, when I increased the Distance Field Resolution to 2, but what do I see here? In the following, you see the fields with a resolution of 1, 2 and 100 in order:alt text

alt text

alt text

avatar image Tim Hobson ♦♦ STAFF Jan 07 '15 at 02:52 PM

Take a look at this video: http://youtu.be/DQt_OopZadI?t=5m

Daniel Wright (Senior Rendering programmer behind DFS) talks about DFS and the "how" and "why" of it all. This DFS view is a way to see the representation of the meshes that will cast the shadows.

Can you post a picture of your dynamic light setup as well. It looks like you're still using dynamic shadow distance under the Cascaded shadow maps tab in the details panel. If so, that would create that type of bleed.

When you post the screen shot from the details panel, in the top right of that panel is an eye. Click that and set it to "Show Modified only." That way I know exactly what settings are being used.

Lighting can be tricky to setup in any game engine when you're new to it. No matter if it's dynamic or static. There is not always a 1 or 2 click process to get everything perfect. Thanks for your patience. :)

Tim

avatar image adipFTW Jan 08 '15 at 06:23 PM

Here are the 'modified-only' settings of my light source:alt text

Thanks for that video, it was very informative!! If I understood it correctly Distance Field Ambient Occlusion is a form of GI? Would be good to know, since I will probably try to get that in there as well at a later point.

avatar image Tim Hobson ♦♦ STAFF Jan 08 '15 at 10:30 PM

Ambient Occlusion detects the proximity distance between objects and removes light where GI would inject light into a scene.

You can see the Distant Field GI work being done here. As Daniel notes, this is still early on.

https://forums.unrealengine.com/showthread.php?2421-Global-Illumination-alternatives&p=193884&viewfull=1#post193884

If you want AO, add a skylight and set it to movable.

To the original matter with the edge issue at that corner. I was able to reproduce that as well, but only with BSP converted to a static mesh.

I was able to clear it up by increasing the distance field on my end.

The best result I got though was making the same shaped mesh in my modeling program (3Ds Max). The way that BSP converts to static mesh can leave odd cuts for the polygons vs being able to determine those cuts myself in a modeling program.

As Daniel mentioned in the video as well, it's better to have more uniform kinds of models when doing this. You'll get better results.

Here are the results I had with a BSP converted to Static Mesh:

This was just a single wall with a hold cut out that was converted.

Distance Field Resolution: 1

alt text

Distance Field Resolution: 75

alt text

Next this is one I created in 3Ds max:

Distance Field Resolution: 1

alt text

Distance Field Resolution: 6

alt text

As you can see it's much better to use a custom made static mesh. It probably helps to that my static mesh made outside of the editor was more uniform as well.

This system still has some improvements coming as it's being developed that should help with some of these things.

Tim

bsp_sm_df1.png (502.9 kB)
bsp_sm_df75.png (727.2 kB)
custommesh_df1.png (491.1 kB)
custommesh_df5.png (547.9 kB)
avatar image adipFTW Jan 09 '15 at 02:25 PM

It indeed seems better to create the mesh in another programm like 3ds Max. Do you know of a way to export my mesh from UE4 to 3ds Max, so i can adjust the ploygon cuts there and then reimport it into UE4? This would save me a lot of time, since I have already made several meshes...

avatar image Tim Hobson ♦♦ STAFF Jan 09 '15 at 02:45 PM

Yeah, You can right click on the static mesh in the Content Browser > Asset Actions > Export

My workflow if I've created something in the level and want to edit it to use BSP as my block out/prototype and then export and rebuild in Max. It's a definite way for me to keep proportions if I don't have specifics in mind from the get-go.

Tim

avatar image adipFTW Jan 09 '15 at 03:19 PM

Nice! When I import the static mesh to 3ds Max, it looks like this:alt text

Now what is my goal? You said something about odd cuts, so aalll those triangles should be rectangles instead?

avatar image Tim Hobson ♦♦ STAFF Jan 09 '15 at 03:54 PM

I hate to say, but it may be a little bit of work to get something like that done. Typically things that complex will be built in a modeling program from the start.

Going back to the Distance Fields though, using smaller pieces and breaking the building up into more modular pieces would result in better shadows. This would explain why you turned it to 100 for the DFS resolution and didn't see any significant change.

But, here is my before and after:

![alt text][1]

bsp_sm.png (38.8 kB)
bsp_sm.png (38.8 kB)
avatar image adipFTW Jan 09 '15 at 05:50 PM

As seen on your 'before' piece, my faces consist of triangles as well. I have removed the middle edges to make them rectangles again, for now just around that paticular corner to see, if it works:alt text

However, still the same bleed :( alt text

Edit: this is with a resolution of 10.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question