# \[Bug\] Light Uniform Sampling in PathTracing

**URL:** <https://forums.unrealengine.com/t/bug-light-uniform-sampling-in-pathtracing/2296717>\
**Category:** Rendering\
**Tags:** unreal-engine, question, Path-Tracing\
**Created:** [January 22, 2025, 8:24am UTC](https://forums.unrealengine.com/t/bug-light-uniform-sampling-in-pathtracing/2296717 "2025-01-22T08:24:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![user\_fdc286c4ebdd83f4e53256a83e5e32a87339769f65057e051d1ab5](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@user\_fdc286c4ebdd83f4e53256a83e5e32a87339769f65057e051d1ab5](https://forums.unrealengine.com/u/user_fdc286c4ebdd83f4e53256a83e5e32a87339769f65057e051d1ab5)\
**Post date:** [January 22, 2025, 8:24am UTC](https://forums.unrealengine.com/t/bug-light-uniform-sampling-in-pathtracing/2296717/1 "2025-01-22T08:24:57Z")

</div>

[https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Shaders/Private/PathTracing/Light/PathTracingLightSampling.ush#L128](https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Shaders/Private/PathTracing/Light/PathTracingLightSampling.ush#L128)  
For the function `SelectLight` which pick a lights by uniform samping When UNIFORM\_LIGHT\_SELECTION is defined or a RIS based on radiance CDF. However, random value (`RandSample`) always be about radiance CDF regradless of UNIFORM\_LIGHT\_SELECTION defined or not. And `InitLightPickingCdf(...)` is nowhere used. Or I understand it wrong? 😥

It’s should be no influence to user, since nobody will use very slow uniform sampling. I found the bug during learning unreal source code.
