<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/urp-lighting-model---custom-lighting-models---episode-20-sb8vnnyn6" -->

---
title: URP Lighting Model - Custom Lighting Models - Episode 20
description: In this video, I show how to re-create the URP lighting model using Shader Graph. Last week we created just the specular component of the lighting, and this...
canonical: https://daily.dev/posts/urp-lighting-model---custom-lighting-models---episode-20-sb8vnnyn6
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: URP Lighting Model - Custom Lighting Models - Episode 20 | daily.dev
og:description: In this video, I show how to re-create the URP lighting model using Shader Graph. Last week we created just the specular component of the lighting, and this...
og:url: https://daily.dev/posts/urp-lighting-model---custom-lighting-models---episode-20-sb8vnnyn6
og:image: https://api.daily.dev/og/posts/sb8VnNYN6.png
og:image:alt: URP Lighting Model - Custom Lighting Models - Episode 20
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# URP Lighting Model - Custom Lighting Models - Episode 20

**[Ben Cloward](https://daily.dev/sources/bencloward)** · 31 min read · 0 upvotes · 0 comments

## Summary

In this video, I show how to re-create the URP lighting model using Shader Graph. Last week we created just the specular component of the lighting, and this week we fill in the rest so you have the complete URP lighting model.

Here's the code for the Additional Lights custom function node:
---------------------------------------

Diffuse = MainDiffuse;
Specular = MainSpecular;
Color = MainColor * (MainDiffuse + MainSpecular);

#ifndef SHADERGRAPH_PREVIEW
    
    uint pixelLightCount = GetAdditionalLightsCount();
    half Roughness = pow(1 - Smoothness, 2);
    half Roughness2 = Roughness * Roughness;
 half Roughness2Minus1 = Roughness2 - 1;
 half normalizationTerm = (Roughness * half(4.0) + half(2.0));

#if USE_CLUSTER_LIGHT_LOOP
    // for Foward+ LIGHT_LOOP_BEGIN macro uses inputData.normalizedScreenSpaceUV and inputData.positionWS
    InputData inputData = (InputData)0;

    inputData.normalizedScreenSpaceUV = ScreenPosition;
    inputData.positionWS = WorldPosition;
#endif

    LIGHT_LOOP_BEGIN(pixelLightCount)
  // Convert the pixel light index to the light data index
  #if !USE_CLUSTER_LIGHT_LOOP
   lightIndex = GetPerObjectLightIndex(lightIndex);
  #endif
  // Call the URP additional light algorithm. This will not calculate shadows, since we don't pass a shadow mask value
  Light light = GetAdditionalPerObjectLight(lightIndex, WorldPosition);
  // Manually set the shadow attenuation by calculating realtime shadows
  light.shadowAttenuation = AdditionalLightRealtimeShadow(lightIndex, WorldPosition, light.direction);
        #if defined(_LIGHT_COOKIES)
            float3 cookieColor = SampleAdditionalLightCookie(lightIndex, WorldPosition);
            light.color *= cookieColor;
        #endif
        float NdotL = saturate(dot(WorldNormal, light.direction));
        float atten = light.distanceAttenuation * light.shadowAttenuation;
        float thisDiffuse = NdotL * atten;
        //DirectBRDFSpecular

        float3 lightDirectionWSFloat3 = float3(light.direction);
        float3 halfDir = SafeNormalize(lightDirectionWSFloat3 + float3(WorldView));
        float NoH = saturate(dot(float3(WorldNormal), halfDir));
        half LoH = half(saturate(dot(lightDirectionWSFloat3, halfDir)));
        float d = NoH * NoH * Roughness2Minus1 + 1.00001f;
        half LoH2 = LoH * LoH;
        half spec = Roughness2 / ((d * d) * max(0.1h, LoH2) * normalizationTerm);
        #if REAL_IS_HALF
            spec = spec - HALF_MIN;
            spec = clamp(spec, 0.0, 1000.0);
        #endif  
        float3 thisSpecular = spec * Reflectance * NdotL * atten;

        Diffuse += thisDiffuse;
        Specular += thisSpecular;

        Color += light.color * (thisDiffuse + thisSpecular);
    LIGHT_LOOP_END
    float total = Diffuse + dot(Specular, float3(0.333, 0.333, 0.333));
    Color = total &&&&= 0 ? MainColor : Color / total;
#endif

----------------------------------------------------
Be sure to replace the &&&& with a less than symbol. YouTube doesn't allow that symbol in descriptions.

Here's the set of Keywords that need to go into the Lit subgraph:

_CLUSTER_LIGHT_LOOP
_LIGHT_COOKIES
_REFLECTION_PROBE_BLENDING
_REFLECTION_PROBE_BOX_PROJECTION
_REFLECTION_PROBE_ATLAS
_SHADOWS_SOFT
_ADDITIONAL_LIGHT_SHADOWS
_MAIN_LIGHT_SHADOWS_CASCADE

Here's last week's video on URP Specular:
https://www.youtube.com/watch?v=2ABQj7qDT4E

Here's the playlist for the whole series:
https://www.youtube.com/playlist?list=PL78XDi0TS4lGnGa7L2X4o3UV-XYZEKNwj

Shader Book Recommendations
https://www.bencloward.com/resources_books.shtml

------------------------------

Theme Music
Peace in the Circuitry - Glitch Hop
http://teknoaxe.com/Link_Code_3.php?q=1526

Background Music
Speo - The Little Things
https://www.youtube.com/watch?v=kvCYuyyLgC0

#UnrealEngine #shadergraph #Unity

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=0ZCHLHPqPEs>

---

Tags: [#game-development](https://daily.dev/tags/game-development), [#unity](https://daily.dev/tags/unity)

[View this post on daily.dev](https://daily.dev/posts/urp-lighting-model---custom-lighting-models---episode-20-sb8vnnyn6)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"URP Lighting Model - Custom Lighting Models - Episode 20","url":"https://daily.dev/posts/urp-lighting-model---custom-lighting-models---episode-20-sb8vnnyn6","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/urp-lighting-model---custom-lighting-models---episode-20-sb8vnnyn6"},"datePublished":"2026-01-24T19:35:13.179Z","dateModified":"2026-01-24T21:22:56.002Z","description":"In this video, I show how to re-create the URP lighting model using Shader Graph. Last week we created just the specular component of the lighting, and this...","image":"https://i.ytimg.com/vi/0ZCHLHPqPEs/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/0ZCHLHPqPEs/sddefault.jpg","isAccessibleForFree":true,"articleSection":"Ben Cloward","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Ben Cloward","logo":"https://media.daily.dev/image/upload/s--0AMNmg3_--/f_auto,q_auto/v1769283303/logos/bencloward","url":"https://daily.dev/sources/bencloward"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/urp-lighting-model---custom-lighting-models---episode-20-sb8vnnyn6","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"game-development,unity","timeRequired":"PT31M","video":{"@type":"VideoObject","name":"URP Lighting Model - Custom Lighting Models - Episode 20","description":"In this video, I show how to re-create the URP lighting model using Shader Graph. Last week we created just the specular component of the lighting, and this...","thumbnailUrl":"https://i.ytimg.com/vi/0ZCHLHPqPEs/sddefault.jpg","uploadDate":"2026-01-24T19:35:13.179Z","duration":"PT31M","url":"https://api.daily.dev/r/sb8VnNYN6","embedUrl":"https://www.youtube.com/embed/0ZCHLHPqPEs"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Ben Cloward","item":"https://daily.dev/sources/bencloward"},{"@type":"ListItem","position":3,"name":"URP Lighting Model - Custom Lighting Models - Episode 20"}]}
```

