<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Taras Tereshchenko on Medium]]></title>
        <description><![CDATA[Stories by Taras Tereshchenko on Medium]]></description>
        <link>https://medium.com/@teres4enko?source=rss-71ddd66c9688------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*5K2Jo38vMYf6HICuISXRSQ.jpeg</url>
            <title>Stories by Taras Tereshchenko on Medium</title>
            <link>https://medium.com/@teres4enko?source=rss-71ddd66c9688------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 06:00:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@teres4enko/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Retroreflection for Unreal Engine]]></title>
            <link>https://medium.com/@teres4enko/retroreflection-for-unreal-engine-754b5b0dd05e?source=rss-71ddd66c9688------2</link>
            <guid isPermaLink="false">https://medium.com/p/754b5b0dd05e</guid>
            <category><![CDATA[retroreflection]]></category>
            <category><![CDATA[videogames]]></category>
            <category><![CDATA[illumination-model]]></category>
            <category><![CDATA[unreal-engine]]></category>
            <category><![CDATA[shading-model]]></category>
            <dc:creator><![CDATA[Taras Tereshchenko]]></dc:creator>
            <pubDate>Tue, 04 Mar 2025 09:51:25 GMT</pubDate>
            <atom:updated>2025-03-04T16:15:20.215Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VPYzMY57DFPnvUukf6e6Kw.gif" /></figure><p>I’ve always been fascinated by light, but my understanding of it initially came from rendering systems in 3D editors and game engines. Over time, my curiosity grew beyond the solutions these tools provided. I began exploring how modern scientists define a physically accurate lighting model. Drawing from various publications, I developed my own understanding and created a unique illumination model scheme.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/1*j7mIllp1vQvgOQAHsBO3Hg.jpeg" /></figure><p>Of course, there’s nothing groundbreaking here, but I find it useful to have my own scheme whenever I revisit this topic at work. I’m fully aware that lighting models in game engines are incomplete for practical reasons. I also understand that implementing specular and diffuse transmission is challenging and not always necessary. However, I’ve always wondered why most game engines ignore retroreflection. It’s a simple component of the physical lighting model, easy to implement, and, most importantly, fully adheres to the law of energy conservation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*lRnATHNEAgAdsOpbHLIhMQ.jpeg" /></figure><p>Retroreflection happens when a surface reflects a significant portion of a directed light beam back toward its source. Researchers uncovered the essence of this phenomenon long ago. Nowadays, many industrial solutions exist for producing retroreflective materials. The technologies for creating such materials generally follow two main approaches: reflection combined with refraction (glass sphere reflectors) and a simple sequence of light bounces (cube-corner or prismatic reflectors).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*TaWqyRrmWyJPBH7xWHkk6w.jpeg" /></figure><p>Retroreflection materials appear brightest to observers closest to the light source. <strong><em>I believe that for some of the projects I’m familiar with, retroreflection could be an excellent solution to both visual and game design challenges.</em></strong></p><p>In this part of the article, I will explain how to add a Retroreflection shading model to Unreal Engine. Modern game engines, including Unreal Engine, use physically accurate microfacet models to simulate reflections and light scattering on rough surfaces. These models are optimized for real-time rendering, often incorporating precomputed integral calculations baked into LUT textures. Clearly, the previously illustrated schemes of light reflection and refraction are not applicable in this context. Unreal Engine uses the Cook-Torrance BRDF with GGX for reflections.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/1*rlG2cGV1OVjYJhtpinN8wA.jpeg" /></figure><p>The main calculations are performed in <strong><em>ShadingModels.ush.</em></strong> I decided that, for now, I want to limit it to direct lighting. In other words, in my model, retroreflection will come from all light sources within whose radius the object is located. The simplest way to achieve this is to override the<strong><em> DefaultLitBxDF</em></strong> function for my shading model.</p><pre>/*<br><br>These variables became the basis for the calculation:<br><br>ARGUMENT   TYPE           DESCRIPTION<br><br>GBuffer    FGBufferData   Data from the GBuffer, <br>                          including colors, roughness, <br>                          metallic, and other material parameters;<br>N          half3          Surface normal;<br>V          half3          View direction (camera vector);<br>L          half3          Light direction;<br>Falloff    float          Light attenuation coefficient;<br>NoL        half           Cosine of the angle between<br>                          the normal and the light direction<br>                          (dot(N, L)). Used for Lambertian shading;<br>*/</pre><p><strong><em>“NoL”</em></strong> became the primary target, as modifying it allows for a convincing imitation of retroreflection. The second important factor was <strong><em>“Falloff,”</em></strong> which definitely needed adjustment. I introduced two additional variables: <strong><em>“VoL”</em></strong> (the dot product between the view direction and the light direction) and <strong><em>“VoN”</em></strong> (the dot product between the view direction and the surface normal). These variables serve as interpolation weights between the original <strong><em>“NoL”</em></strong> and <strong><em>“Falloff”</em></strong> and their modified versions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*rSRQ_AoEsmhrwVWpojVsCQ.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*Eftldil9Kst0QZGFovw_4w.gif" /></figure><p>And here is the magic of retroreflection in action. Instead of detailing the embedding process, I’ll simply list the files that need to be modified. I don’t want to turn this into a tedious tutorial.</p><pre>/*<br><br>FILE                                      MODIFICATION DESCRIPTION<br><br>BasePassCommon.ush                        Add CSM to activation list;<br>ClusteredDeferredShadingPixelShader.usf   Add light greed CSM to per <br>                                          shading model pass;<br>DeferredShadingCommon.ush                 Add custom GBuffer data for CSM;<br>Definitions.usf                           Add CSM macros;<br>ShadingCommon.ush                         Add CSM ID and debug colors;<br>ShadingModels.ush                         Add CSM BRDF;<br>ShadingModelsMaterial.ush                 Fill GBuffer custom dada for CSM;<br>ShadingModelsSampling.ush                 Add CSM support in BxDF;<br>EngineTypes.h                             Register CSM in shading model<br>                                          stack;<br>HLSLMaterialTranslator.cpp                Add CSM in “Lit” environment;<br>Material.cpp                              Activate Custom Data 0 for CSM;<br>MaterialHLSLEmitter.cpp                   Add CSM in “Lit” environment;<br>MaterialShader.cpp                        Add CSM to string description<br>                                          and appropriate stats;<br>ShaderGenerationUtil.cpp                  Add fetch compile bool.<br>                                          Add custom data slot for CSM;<br>MaterialExpressionShadingModel.h          Add CSM to material interface;<br>ShaderMaterialDerivedHelpers.cpp          Add CSM derived materials<br>                                          helpers;<br>ShaderMaterial.h                          Add CSM field in<br>                                          FShaderMaterialPropertyDefines;<br><br>*Custom Shading Model - CSM<br>*/</pre><p>After modifying all this you will get additional shading model as in the picture below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*AveUqeCYTbRi4Z7D-3eqdw.jpeg" /></figure><p>I also activated the Custom Data to mask the retroreflection. And I added the multiplier for “Falloff.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*1N7u6P8glUv1WpHnsUg0iQ.jpeg" /></figure><p>It is possible to add retroreflection to non-directional lighting, but for game design reasons, it was decided to use only directional lighting.</p><p>At a time when the creation of game characters and environments has reached the limits of possibility, retroreflection can be the feature that makes your content, design, or idea unique and stand out from the rest.</p><p>I want to thank Nick Barre for providing the jacket model for testing the shading model.</p><p>I hope this material will be useful, thank you for your attention.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=754b5b0dd05e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>