# Localized-IBL implementation

**URL:** <https://forums.unrealengine.com/t/localized-ibl-implementation/112710>\
**Category:** Rendering\
**Tags:** unreal-engine\
**Created:** [June 25, 2018, 9:45pm UTC](https://forums.unrealengine.com/t/localized-ibl-implementation/112710 "2018-06-25T21:45:17Z")\
**Posts on this page:** 20\
**Page:** 10

<div class="post-metadata">

**Author:** ![Raildex](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Raildex](https://forums.unrealengine.com/u/Raildex)\
**Post date:** [April 14, 2019, 2:29pm UTC](https://forums.unrealengine.com/t/localized-ibl-implementation/112710/183 "2019-04-14T14:29:52Z")

</div>

@ :  
Do Scenes with static Skylight and Stationary Directional Light benefit from this?

---

<div class="post-metadata">

**Author:** ![Chosker](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/chosker/32/710746_2.png) [@Chosker](https://forums.unrealengine.com/u/Chosker)\
**Post date:** [April 14, 2019, 9:13pm UTC](https://forums.unrealengine.com/t/localized-ibl-implementation/112710/184 "2019-04-14T21:13:46Z")

</div>

> [@Raildex](#):
>
> @ :  
> Do Scenes with static Skylight and Stationary Directional Light benefit from this?

it replaces / blends out the dynamic skylight, so no, a static skylight would not get any benefit

---

<div class="post-metadata">

**Author:** ![amoser](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@amoser](https://forums.unrealengine.com/u/amoser)\
**Post date:** [April 14, 2019, 11:34pm UTC](https://forums.unrealengine.com/t/localized-ibl-implementation/112710/185 "2019-04-14T23:34:00Z")

</div>

> [@](#):
>
> I did already. what kind of interesting possibilities? 🙂

At the moment I’m looking at using depth for improved parallax correction and more intelligent blending between captures.

---

<div class="post-metadata">

**Author:** ![scha](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/scha/32/1135430_2.png) [@scha](https://forums.unrealengine.com/u/scha)\
**Post date:** [April 15, 2019, 9:36am UTC](https://forums.unrealengine.com/t/localized-ibl-implementation/112710/186 "2019-04-15T09:36:17Z")

</div>

I tried the mod, it seems reflection captures are not working, ibl or not ibl.

---

<div class="post-metadata">

**Author:** ![Chosker](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/chosker/32/710746_2.png) [@Chosker](https://forums.unrealengine.com/u/Chosker)\
**Post date:** [April 15, 2019, 10:33am UTC](https://forums.unrealengine.com/t/localized-ibl-implementation/112710/187 "2019-04-15T10:33:18Z")

</div>

> [@amoser](#):
>
> At the moment I’m looking at using depth for improved parallax correction and more intelligent blending between captures.

seems interesting indeed. is this something you want to try yourself? I can point you to the right place to get the depth as alpha on the captures. I’m just not sure I want to invest much more time on this anymore, since Epic rejected the PR and I’m not even using the system in an own project (as a hobbyist I want to make research/games, not maintain engine code)

> [@scha](#):
>
> I tried the mod, it seems reflection captures are not working, ibl or not ibl.

strange, it works for me.  
can you share more of your setup just in case? (what kind of lights, if movable/static/etc) I can give it a try later

---

<div class="post-metadata">

**Author:** ![scha](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/scha/32/1135430_2.png) [@scha](https://forums.unrealengine.com/u/scha)\
**Post date:** [April 15, 2019, 11:00am UTC](https://forums.unrealengine.com/t/localized-ibl-implementation/112710/188 "2019-04-15T11:00:37Z")

</div>

It’s the default new level, I duplicated the platform, both lights set to movable, nothing else changed. SSR is working. I tried in 2 projects.

edit: btw, I noticed engine ini files have unix line endings, so in notepad they appear without line breaks, maybe that’s related?

---

<div class="post-metadata">

**Author:** ![amoser](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@amoser](https://forums.unrealengine.com/u/amoser)\
**Post date:** [April 15, 2019, 12:06pm UTC](https://forums.unrealengine.com/t/localized-ibl-implementation/112710/189 "2019-04-15T12:06:44Z")

</div>

> [@](#):
>
> seems interesting indeed. is this something you want to try yourself? I can point you to the right place to get the depth as alpha on the captures. I’m just not sure I want to invest much more time on this anymore, since Epic rejected the PR and I’m not even using the system in an own project (as a hobbyist I want to make research/games, not maintain engine code)

Yeah, I’ve actually made a very incomplete mock-up of what I’m trying to do, but it’s just using a single cube map texture asset since I haven’t completely worked out how to manage this with actual reflection captures. Some tips regarding passing depth through the alpha channel would probably save me a lot of time. Replacing the existing parallax correction turned out to be pretty easy, so I think depth is the only missing piece.

I’m hoping that this approach will be equally applicable to both reflections and diffuse, assuming it actually works at all and with acceptable quality.

---

<div class="post-metadata">

**Author:** ![Chosker](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/chosker/32/710746_2.png) [@Chosker](https://forums.unrealengine.com/u/Chosker)\
**Post date:** [April 15, 2019, 6:43pm UTC](https://forums.unrealengine.com/t/localized-ibl-implementation/112710/190 "2019-04-15T18:43:03Z")

</div>

> [@scha](#):
>
> It’s the default new level, I duplicated the platform, both lights set to movable, nothing else changed. SSR is working. I tried in 2 projects.
> 
> edit: btw, I noticed engine ini files have unix line endings, so in notepad they appear without line breaks, maybe that’s related?

it works but the ContributionFactor needs to be set to 1.0.  
apparently it’s set to 0.0 by default which is wrong. I’ll fix it at some point

 ![iblcontribution.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/0/f/0f84f8d37970e0b8cfe27cd3b9d14fa8961ec244.jpeg)

---

<div class="post-metadata">

**Author:** ![Chosker](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/chosker/32/710746_2.png) [@Chosker](https://forums.unrealengine.com/u/Chosker)\
**Post date:** [April 15, 2019, 6:52pm UTC](https://forums.unrealengine.com/t/localized-ibl-implementation/112710/191 "2019-04-15T18:52:49Z")

</div>

> [@amoser](#):
>
> Yeah, I’ve actually made a very incomplete mock-up of what I’m trying to do, but it’s just using a single cube map texture asset since I haven’t completely worked out how to manage this with actual reflection captures. Some tips regarding passing depth through the alpha channel would probably save me a lot of time. Replacing the existing parallax correction turned out to be pretty easy, so I think depth is the only missing piece.
> 
> I’m hoping that this approach will be equally applicable to both reflections and diffuse, assuming it actually works at all and with acceptable quality.

interesting. what’s the effect on the parallax correction so far?

anyway to capture depth into alpha go to ReflectionEnvironmentShaders.usf and replace line74 which looks like:

```auto

Alpha = 1 - smoothstep(.8f * MaxDistance, MaxDistance, RadialDistance);

```

for something like

```auto

Alpha = RadialDistance / 65536.0f;

```

and then you need to change the way the blending works in the composite function, since the MaxDistance of the probe isn’t accounted for anymore. so far I was factoring CapturePositionAndRadius.w in the blending to compensate, but haven’t done it properly yet (the process is long and tedious because the smallest change causes all shaders to be recompiled)

---

<div class="post-metadata">

**Author:** ![amoser](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@amoser](https://forums.unrealengine.com/u/amoser)\
**Post date:** [April 16, 2019, 2:04am UTC](https://forums.unrealengine.com/t/localized-ibl-implementation/112710/192 "2019-04-16T02:04:12Z")

</div>

> [@](#):
>
> interesting. what’s the effect on the parallax correction so far?
> 
> anyway to capture depth into alpha go to ReflectionEnvironmentShaders.usf and replace line74 which looks like:
> 
> ```auto
> 
> Alpha = 1 - smoothstep(.8f * MaxDistance, MaxDistance, RadialDistance);
> 
> ```
> 
> for something like
> 
> ```auto
> 
> Alpha = RadialDistance / 65536.0f;
> 
> ```
> 
> and then you need to change the way the blending works in the composite function, since the MaxDistance of the probe isn’t accounted for anymore. so far I was factoring CapturePositionAndRadius.w in the blending to compensate, but haven’t done it properly yet (the process is long and tedious because the smallest change causes all shaders to be recompiled)

Perfect, thanks. That’s exactly what I was looking for. I’ll try to share some results as soon as I can,

---

<div class="post-metadata">

**Author:** ![amoser](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@amoser](https://forums.unrealengine.com/u/amoser)\
**Post date:** [April 19, 2019, 6:28am UTC](https://forums.unrealengine.com/t/localized-ibl-implementation/112710/193 "2019-04-19T06:28:55Z")

</div>

> [@](#):
>
> (the process is long and tedious because the smallest change causes all shaders to be recompiled)

Yeah, so this is definitely a bit slow.

That said, I’ve made what I consider some modest progress. Right now, all I’m doing is attempting to replace the existing simple alpha underlay compositing with something that sorts by “accuracy” (i.e. how closely does the sphere projected capture ray agree with the sampled pixel’s depth)

The results look a bit like a garbled mess since there’s no fading between between captures, but it does reflect the actual scene geometry more accurately than the existing blending. I also need to find a way to ignore self-hits, since they cause quite a bit of unfortunate contamination.

![captures.gif](https://d3kjluh73b9h9o.cloudfront.net/original/3X/0/5/0533cb1cb435f153fffb82a219b5df46bb64b8f5.gif)

The next step is the actual parallax \*correction \*aspect. I think adding ray marching for this purpose will be pretty trivial to implement, since I really only need to generate multiple “virtual” captures with different radii (but the same center point and IBL data), and let the depth sorting figure out which one to use on a per-pixel basis. I’ll probably try to refine the result a bit further with the classic parallax mapping technique.

After all that is done, I should then be able to feed the result into the final accuracy sorting, which will choose from among a bunch of hopefully-now-much-more-similar options.

I’ll start a new thread and stop derailing this one.

---

<div class="post-metadata">

**Author:** ![doomgravex](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@doomgravex](https://forums.unrealengine.com/u/doomgravex)\
**Post date:** [April 21, 2019, 8:30am UTC](https://forums.unrealengine.com/t/localized-ibl-implementation/112710/194 "2019-04-21T08:30:47Z")

</div>

amazing tech. hope that this will be implemented in the engine!

---

<div class="post-metadata">

**Author:** ![dyanikoglu](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/dyanikoglu/32/1008648_2.png) [@dyanikoglu](https://forums.unrealengine.com/u/dyanikoglu)\
**Post date:** [June 12, 2019, 2:01pm UTC](https://forums.unrealengine.com/t/localized-ibl-implementation/112710/195 "2019-06-12T14:01:27Z")

</div>

Latest dev-rendering merge in master branch created serious conflicts with the implementation, we were using this actively in our development. Is there any chance to get any early implementation for 4.23?

---

<div class="post-metadata">

**Author:** ![jojo8026](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jojo8026](https://forums.unrealengine.com/u/jojo8026)\
**Post date:** [June 12, 2019, 4:51pm UTC](https://forums.unrealengine.com/t/localized-ibl-implementation/112710/196 "2019-06-12T16:51:46Z")

</div>

> [@dyanikoglu](#):
>
> Latest dev-rendering merge in master branch created serious conflicts with the implementation, we were using this actively in our development. Is there any chance to get any early implementation for 4.23?

I want to know this also 🙂

---

<div class="post-metadata">

**Author:** ![Chosker](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/chosker/32/710746_2.png) [@Chosker](https://forums.unrealengine.com/u/Chosker)\
**Post date:** [June 13, 2019, 12:54pm UTC](https://forums.unrealengine.com/t/localized-ibl-implementation/112710/197 "2019-06-13T12:54:43Z")

</div>

hi all, since Epic declined the PR I’ve been focusing on other projects. As the entire custom engine fork maintaining is a big time sink I usually just stick to ‘final’ UE4 releases  
I can’t promise an early implementation but I’ll see what I can do about 4.23

---

<div class="post-metadata">

**Author:** ![dyanikoglu](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/dyanikoglu/32/1008648_2.png) [@dyanikoglu](https://forums.unrealengine.com/u/dyanikoglu)\
**Post date:** [June 20, 2019, 3:00pm UTC](https://forums.unrealengine.com/t/localized-ibl-implementation/112710/198 "2019-06-20T15:00:52Z")

</div>

[https://github.com/ProjectBorealisAd…264a27bd0ccf46](https://github.com/ProjectBorealisAdmin/UnrealEngine/commit/067a40ae114ceef81764fcd8ec264a27bd0ccf46)

I did a quick merge for latest 4.23 branch, I will let you know when I confirm it’s working without any problem.

Edit: Unfortunately, after few attemps, I couldn’t make it work:

[https://github.com/ProjectBorealisAd…6c9e142096e89b](https://github.com/ProjectBorealisAdmin/UnrealEngine/commit/ae5e1ab7416158479be7cef23b6c9e142096e89b)  
[https://github.com/ProjectBorealisAd…5d22483ad30c90](https://github.com/ProjectBorealisAdmin/UnrealEngine/commit/fa935c4e68a9e02dcf0c9257ff5d22483ad30c90)

It would be awesome if I can get some feedback on this

Edit: Looks like it’s abandoned, I’m not suprised with that… I don’t recommend making your project’s lighting deeply bounded to this implementation. Possible replacements:

- Enlighten
- Nvidia VXGI2
- Nvidia RTGI (If you have RTX card)
- LPV
- Static Lighting

---

<div class="post-metadata">

**Author:** ![Chosker](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/chosker/32/710746_2.png) [@Chosker](https://forums.unrealengine.com/u/Chosker)\
**Post date:** [September 4, 2019, 10:08am UTC](https://forums.unrealengine.com/t/localized-ibl-implementation/112710/199 "2019-09-04T10:08:28Z")

</div>

> [@dyanikoglu](#):
>
> [https://github.com/ProjectBorealisAd…264a27bd0ccf46](https://github.com/ProjectBorealisAdmin/UnrealEngine/commit/067a40ae114ceef81764fcd8ec264a27bd0ccf46)
> 
> I did a quick merge for latest 4.23 branch, I will let you know when I confirm it’s working without any problem.
> 
> Edit: Unfortunately, after few attemps, I couldn’t make it work:
> 
> [https://github.com/ProjectBorealisAd…6c9e142096e89b](https://github.com/ProjectBorealisAdmin/UnrealEngine/commit/ae5e1ab7416158479be7cef23b6c9e142096e89b)  
> [https://github.com/ProjectBorealisAd…5d22483ad30c90](https://github.com/ProjectBorealisAdmin/UnrealEngine/commit/fa935c4e68a9e02dcf0c9257ff5d22483ad30c90)
> 
> It would be awesome if I can get some feedback on this
> 
> Edit: Looks like it’s abandoned, I’m not suprised with that… I don’t recommend making your project’s lighting deeply bounded to this implementation. Possible replacements:
> 
> - Enlighten
> - Nvidia VXGI2
> - Nvidia RTGI (If you have RTX card)
> - LPV
> - Static Lighting

sorry I missed your reply  
It’s not abandoned. I have many things to do so I can’t actively work on maintaining this on partial UE4 releases.  
the latest UE4 release is 4.22 and this works on 4.22 - can’t really call it abandoned  
once the ‘final’ 4.23 comes I’ll port it over

---

<div class="post-metadata">

**Author:** ![Chosker](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/chosker/32/710746_2.png) [@Chosker](https://forums.unrealengine.com/u/Chosker)\
**Post date:** [September 11, 2019, 6:49pm UTC](https://forums.unrealengine.com/t/localized-ibl-implementation/112710/200 "2019-09-11T18:49:52Z")

</div>

quick update: I got this implemented on 4.23.  
I have to double-check but I think I have some issue on translucent objects, but shouldn’t take much longer.  
unfortunately I’ll be out until early next week so at minimum next week there will be no working release from me  
cheers

---

<div class="post-metadata">

**Author:** ![Chosker](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/chosker/32/710746_2.png) [@Chosker](https://forums.unrealengine.com/u/Chosker)\
**Post date:** [September 21, 2019, 11:48am UTC](https://forums.unrealengine.com/t/localized-ibl-implementation/112710/201 "2019-09-21T11:48:50Z")

</div>

Localized IBL for UE4 4.23 is now updated  
grab it on my github: [https://github.com//UnrealEngine/tree/4.23](https://github.com//UnrealEngine/tree/4.23)

I’ll update the original post in the following days but there’s one big thing to consider:  
Translucency with Local IBL only works using the 2 Surface lighting modes - the other 4 modes (the volumetric ones) had some big issues that I could not fix. I suspect they were always there before but I never noticed them.  
As a result I’ve disabled skylight on volumetric-lighting-models translucency entirely - otherwise the translucent objects without local IBL would display the skylight which is exactly what this system attempts to avoid. This results in translucent objects being pitch-black on non-lit interiors with local IBL - so you might want to add some subtle ambient light in your translucent materials. If you still want the old behavior and have the skylight to show on them just comment out lines 562 and 567 on BasePassPixelShader.usf

also I tested it on Forward Rendering and it works well

---

<div class="post-metadata">

**Author:** ![Chosker](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/chosker/32/710746_2.png) [@Chosker](https://forums.unrealengine.com/u/Chosker)\
**Post date:** [September 24, 2019, 5:47pm UTC](https://forums.unrealengine.com/t/localized-ibl-implementation/112710/202 "2019-09-24T17:47:53Z")

</div>

alright I’ve updated the original post with more details of the current state of things.

btw if anyone is using this system please post here (bonus cookies if showing screenshots) - in general it would be nice to gauge the benefit this is providing. in short, if I understand that no one is using this system I will stop maintaining it.

[Previous page](https://forums.unrealengine.com/t/localized-ibl-implementation/112710.md?page=9)

[Next page](https://forums.unrealengine.com/t/localized-ibl-implementation/112710.md?page=11)
