# Colored lighting

**URL:** https://discussions.unity.com/t/colored-lighting/361985
**Category:** XR
**Tags:** XR, visionOS, Question
**Created:** [May 25, 2024, 1:32am UTC](https://discussions.unity.com/t/colored-lighting/361985 "2024-05-25T01:32:59Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![ina](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/ina/32/44257_2.png) [@ina](https://discussions.unity.com/u/ina)
#### Post date: [May 25, 2024, 1:32am UTC](https://discussions.unity.com/t/colored-lighting/361985/1 "2024-05-25T01:32:59Z")

</div>

can light color be controlled?

how do you set up multiple colored lighting? it seems that the light color in directional light has no effect?

---

<div class="post-metadata">

### Author: ![AndrzejUnity](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/andrzejunity/32/85212_2.png) [@AndrzejUnity](https://discussions.unity.com/u/AndrzejUnity)
#### Post date: [May 26, 2024, 7:54pm UTC](https://discussions.unity.com/t/colored-lighting/361985/2 "2024-05-26T19:54:42Z")

</div>

> [@ina](#):
>
> can light color be controlled?

Point/spot/directional lights (and their colors) will only affect shader graphs using the [PolySpatial Lighting](https://docs.unity3d.com/Packages/com.unity.polyspatial.visionos@1.2/manual/PolySpatialLighting.html) node. You can alter visionOS’s image based lighting (used for Standard, URP/Lit, and Lit shader graph targets) using the [VisionOSImageBasedLight[Receiver]](https://docs.unity3d.com/Packages/com.unity.polyspatial.visionos@1.2/manual/ImageBasedLight.html) components.

---

<div class="post-metadata">

### Author: ![ina](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/ina/32/44257_2.png) [@ina](https://discussions.unity.com/u/ina)
#### Post date: [May 31, 2024, 11:44pm UTC](https://discussions.unity.com/t/colored-lighting/361985/3 "2024-05-31T23:44:25Z")

</div>

> [@AndrzejUnity](#):
>
> VisionOSImageBasedLight[Receiver]

do you guys have an example that demonstrates this usage?

---

<div class="post-metadata">

### Author: ![ina](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/ina/32/44257_2.png) [@ina](https://discussions.unity.com/u/ina)
#### Post date: [June 1, 2024, 5:50am UTC](https://discussions.unity.com/t/colored-lighting/361985/4 "2024-06-01T05:50:49Z")

</div>

Okay i see it working on a volume camera mesh - but do you know if colored lights work on render textures?

---

<div class="post-metadata">

### Author: ![ina](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/ina/32/44257_2.png) [@ina](https://discussions.unity.com/u/ina)
#### Post date: [June 2, 2024, 11:29pm UTC](https://discussions.unity.com/t/colored-lighting/361985/5 "2024-06-02T23:29:06Z")

</div>

is there some sort of setting (?) for colored lighting and IBL to show up in render texture (not just main camera)

---

<div class="post-metadata">

### Author: ![AndrzejUnity](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/andrzejunity/32/85212_2.png) [@AndrzejUnity](https://discussions.unity.com/u/AndrzejUnity)
#### Post date: [June 3, 2024, 5:24pm UTC](https://discussions.unity.com/t/colored-lighting/361985/6 "2024-06-03T17:24:33Z")

</div>

> [@ina](#):
>
> do you guys have an example that demonstrates this usage?

We do not have an example, but it should be straightforward to follow the documentation.

> [@ina](#):
>
> is there some sort of setting (?) for colored lighting and IBL to show up in render texture (not just main camera)

When rendering to RenderTextures, you are using the Unity renderer rather than RealityKit, and will not receive image based lighting. The only option that will work on both RenderTextures and frame buffer rendering is to use shader graphs with the [PolySpatial Lighting](https://docs.unity3d.com/Packages/com.unity.polyspatial.visionos@1.2/manual/PolySpatialLighting.html) node (and colored point/spot/directional lights).

---

<div class="post-metadata">

### Author: ![ina](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/ina/32/44257_2.png) [@ina](https://discussions.unity.com/u/ina)
#### Post date: [June 4, 2024, 6:47am UTC](https://discussions.unity.com/t/colored-lighting/361985/7 "2024-06-04T06:47:50Z")

</div>

Hmm - why aren’t the default URP shaders using shader graphs with Polyspatial Lighting support?

---

<div class="post-metadata">

### Author: ![AndrzejUnity](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/andrzejunity/32/85212_2.png) [@AndrzejUnity](https://discussions.unity.com/u/AndrzejUnity)
#### Post date: [June 4, 2024, 4:15pm UTC](https://discussions.unity.com/t/colored-lighting/361985/8 "2024-06-04T16:15:15Z")

</div>

> [@ina](#):
>
> Hmm - why aren’t the default URP shaders using shader graphs with Polyspatial Lighting support?

That’s something we have on our road map to support as an option, but we don’t want to include the functionality by default, because it adds complexity (and thus draw expense) to the shader, and not everyone wants that functionality. Also, without knowing which features (dynamic lighting, light maps, etc.) to include, we would either have to include all of them (gated by boolean parameters) or generate different MaterialX outputs with all the possibilities (increasing import times).

---

<div class="post-metadata">

### Author: ![ina](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/ina/32/44257_2.png) [@ina](https://discussions.unity.com/u/ina)
#### Post date: [June 4, 2024, 9:47pm UTC](https://discussions.unity.com/t/colored-lighting/361985/9 "2024-06-04T21:47:03Z")

</div>

should def be included in the Polyspatial Samples

---

<div class="post-metadata">

### Author: ![ina](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/ina/32/44257_2.png) [@ina](https://discussions.unity.com/u/ina)
#### Post date: [June 5, 2024, 3:37am UTC](https://discussions.unity.com/t/colored-lighting/361985/10 "2024-06-05T03:37:26Z")

</div>

using skahder graph for hte first time - is there something you have to do to keep the existing UV?

---

<div class="post-metadata">

### Author: ![ina](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/ina/32/44257_2.png) [@ina](https://discussions.unity.com/u/ina)
#### Post date: [June 5, 2024, 11:14am UTC](https://discussions.unity.com/t/colored-lighting/361985/11 "2024-06-05T11:14:14Z")

</div>

I am just trying to get Polyspatial Lighting IBL to work with regular URP Lit shader… What’s wrong with my shader graph?

> **[Gyazo](https://gyazo.com/cb76f9a975ad1ef2ae25cb0cd143aeaa)**
>
> Gyazo is the easiest way to record screenshots & videos you can share instantly. Save time with async visual communication that's effortless and engaging.

---

<div class="post-metadata">

### Author: ![AndrzejUnity](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/andrzejunity/32/85212_2.png) [@AndrzejUnity](https://discussions.unity.com/u/AndrzejUnity)
#### Post date: [June 5, 2024, 4:41pm UTC](https://discussions.unity.com/t/colored-lighting/361985/12 "2024-06-05T16:41:59Z")

</div>

> [@ina](#):
>
> I am just trying to get Polyspatial Lighting IBL to work with regular URP Lit shader… What’s wrong with my shader graph?

It looks correct to me. If you submit a bug report with a repro case and an explanation of the issue, and let us know the incident number (IN-#####), we can look into it.

---

<div class="post-metadata">

### Author: ![ina](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/ina/32/44257_2.png) [@ina](https://discussions.unity.com/u/ina)
#### Post date: [June 6, 2024, 3:43am UTC](https://discussions.unity.com/t/colored-lighting/361985/13 "2024-06-06T03:43:49Z")

</div>

hmmm do you have an example lit shader working where IBL works on render texture?

---

<div class="post-metadata">

### Author: ![ina](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/ina/32/44257_2.png) [@ina](https://discussions.unity.com/u/ina)
#### Post date: [June 6, 2024, 3:45am UTC](https://discussions.unity.com/t/colored-lighting/361985/14 "2024-06-06T03:45:13Z")

</div>

being new to shader graph i’m also not too sure how to connect polyspatial lighting? do i blend it or directly connect to emission?

my test case is a default lit urp shader + IBL… main camera shows a beautiful IBL lighting on the otherwise white mesh, but rendertexture simply shows only the white mesh

@AndrzejUnity I am curious which render texture cases you have tested to work?

---

<div class="post-metadata">

### Author: ![ina](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/ina/32/44257_2.png) [@ina](https://discussions.unity.com/u/ina)
#### Post date: [June 6, 2024, 8:51am UTC](https://discussions.unity.com/t/colored-lighting/361985/15 "2024-06-06T08:51:38Z")

</div>

hmm does the render camera itself need VisionOSImageBasedLightReceiver component?

---

<div class="post-metadata">

### Author: ![AndrzejUnity](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/andrzejunity/32/85212_2.png) [@AndrzejUnity](https://discussions.unity.com/u/AndrzejUnity)
#### Post date: [June 10, 2024, 5:21pm UTC](https://discussions.unity.com/t/colored-lighting/361985/16 "2024-06-10T17:21:18Z")

</div>

> [@ina](#):
>
> hmmm do you have an example lit shader working where IBL works on render texture?

> [@AndrzejUnity](#):
>
> When rendering to RenderTextures, you are using the Unity renderer rather than RealityKit, and will not receive image based lighting. The only option that will work on both RenderTextures and frame buffer rendering is to use shader graphs with the [PolySpatial Lighting](https://docs.unity3d.com/Packages/com.unity.polyspatial.visionos@1.2/manual/PolySpatialLighting.html) node (and colored point/spot/directional lights).

As I said above, there’s no image-based lighting when rendering to RenderTextures, because the image-based lighting comes from RealityKit (and ultimately from the visionOS’s cameras), and RenderTextures are rendered using the Unity renderer.

> [@ina](#):
>
> being new to shader graph i’m also not too sure how to connect polyspatial lighting? do i blend it or directly connect to emission?

That depends on whether you want to replace the image based lighting entirely (use Unlit target, output to Base Color) or add the Unity lighting to the image based lighting (Lit target, use Emission). However, when rendering to a RenderTexture, you will only get the Unity lighting (point/spot/directional/etc.), not the image based lighting.

It’s possible that we could eventually support rendering to a texture using RealityKit’s [RealityRenderer](https://developer.apple.com/documentation/realitykit/realityrenderer), which does provide RealityKit’s image based lighting (though not from the camera–just from an environment map). If you’re interested in that, please request it on our [road map](https://discussions.unity.com/t/unity-visionos-support-roadmap/316686).
