# Сolor depth map for PhotoDome

**URL:** <https://forum.babylonjs.com/t/olor-depth-map-for-photodome/34696>\
**Category:** Questions\
**Created:** [October 11, 2022, 2:21pm UTC](https://forum.babylonjs.com/t/olor-depth-map-for-photodome/34696 "2022-10-11T14:21:03Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![D\_Taylor](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/d_taylor/32/27277_2.png) [@D\_Taylor](https://forum.babylonjs.com/u/D_Taylor)\
**Post date:** [October 11, 2022, 2:21pm UTC](https://forum.babylonjs.com/t/olor-depth-map-for-photodome/34696/1 "2022-10-11T14:21:03Z")

</div>

Hello.  
In this PhotoDome depth map example, a grayscale depth map is used.

> **[Babylon.js Playground](https://playground.babylonjs.com/#WP9WDU%2331)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

I’m trying to apply a color depth map and it doesn’t work correctly.  
 ![pano2_dmap_best](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/6/f/6f95c189c6f0697c4e27b3f961c50bf207b33113.jpeg)

 ![pano2](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/e/0/e0778994f5657e23be70042a7e12eecf679787f2.jpeg)

What should I do? Convert color depth map to grayscale, how to do it?  
Help me please.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [October 11, 2022, 2:37pm UTC](https://forum.babylonjs.com/t/olor-depth-map-for-photodome/34696/2 "2022-10-11T14:37:38Z")

</div>

Why not converting the data in gray scale ?

---

<div class="post-metadata">

**Author:** ![D\_Taylor](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/d_taylor/32/27277_2.png) [@D\_Taylor](https://forum.babylonjs.com/u/D_Taylor)\
**Post date:** [October 11, 2022, 2:45pm UTC](https://forum.babylonjs.com/t/olor-depth-map-for-photodome/34696/3 "2022-10-11T14:45:53Z")

</div>

I only have a color depth map.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [October 11, 2022, 2:49pm UTC](https://forum.babylonjs.com/t/olor-depth-map-for-photodome/34696/4 "2022-10-11T14:49:31Z")

</div>

what does the color represents in this case ? a conversion needs to happen

---

<div class="post-metadata">

**Author:** ![D\_Taylor](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/d_taylor/32/27277_2.png) [@D\_Taylor](https://forum.babylonjs.com/u/D_Taylor)\
**Post date:** [October 11, 2022, 2:58pm UTC](https://forum.babylonjs.com/t/olor-depth-map-for-photodome/34696/5 "2022-10-11T14:58:02Z")

</div>

As far as I understand, the distance is measured here approximately on such a scale, dark blue (closer) and dark red (further).  
 ![colormap_turbo](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/6/3/63f57243825010fb7b8eddf57dcf123ea7d932dc.png)

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [October 11, 2022, 3:07pm UTC](https://forum.babylonjs.com/t/olor-depth-map-for-photodome/34696/6 "2022-10-11T15:07:08Z")

</div>

I would suggest to recreate in the playground something similar to this [mesh onready observable · BabylonJS/Babylon.js@8e19ab8 · GitHub](https://github.com/BabylonJS/Babylon.js/commit/8e19ab89417606cbb4c997bf9d1959db297a52ee) in the playground as it is not much code to adapt to your scale and if interesting for others as well, this could be a nice contribution 🙂

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [November 8, 2022, 1:51pm UTC](https://forum.babylonjs.com/t/olor-depth-map-for-photodome/34696/7 "2022-11-08T13:51:52Z")

</div>

Hello! Just checking in if you still have questions @D_Taylor

---

<div class="post-metadata">

**Author:** ![D\_Taylor](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/d_taylor/32/27277_2.png) [@D\_Taylor](https://forum.babylonjs.com/u/D_Taylor)\
**Post date:** [November 8, 2022, 2:13pm UTC](https://forum.babylonjs.com/t/olor-depth-map-for-photodome/34696/8 "2022-11-08T14:13:19Z")

</div>

no, the solution was to convert the color scale to grayscale

---

<div class="post-metadata">

**Author:** ![Kartik\_Kumar](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/kartik_kumar/32/36013_2.png) [@Kartik\_Kumar](https://forum.babylonjs.com/u/Kartik_Kumar)\
**Post date:** [August 26, 2024, 1:53pm UTC](https://forum.babylonjs.com/t/olor-depth-map-for-photodome/34696/9 "2024-08-26T13:53:54Z")

</div>

@D_Taylor @sebavan Is there a way to do opposite operation ? that is…  
from a grayscale depth map → to a color depth map ?

Color scale can be rainbow, magma or plasma…

---

<div class="post-metadata">

**Author:** ![imerso](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/imerso/32/46445_2.png) [@imerso](https://forum.babylonjs.com/u/imerso)\
**Post date:** [August 26, 2024, 2:14pm UTC](https://forum.babylonjs.com/t/olor-depth-map-for-photodome/34696/10 "2024-08-26T14:14:42Z")

</div>

Yes. Assuming that your depth map is in the 0 … 1 range, then think with me, it can be used as a uv for a texture.

So, you can just create a color texture with the color grad you want, and sample from it using the depth as u, having v always zero.

If your depth is not in the 0 … 1 range, you can easily convert, by dividing the current depth of a pixel by the maximum depth, and then mapping to uv and sampling from the color texture.

Not at home now but I can build a playground later, if you still need.
