# Work in progress - living room

**URL:** <https://discourse.radiance-online.org/t/work-in-progress-living-room/4669>\
**Category:** radiance-general\
**Created:** [September 16, 2018, 1:47pm UTC](https://discourse.radiance-online.org/t/work-in-progress-living-room/4669 "2018-09-16T13:47:20Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![Dion\_Moult](https://discourse.radiance-online.org/user_avatar/discourse.radiance-online.org/dion_moult/32/517_2.png) [@Dion\_Moult](https://discourse.radiance-online.org/u/Dion_Moult)\
**Post date:** [October 17, 2018, 11:24am UTC](https://discourse.radiance-online.org/t/work-in-progress-living-room/4669/14 "2018-10-17T11:24:39Z")

</div>

Update time! It’s been a rainy week down here in Sydney, Australia, so my attempts to continue to scan the backyard and photograph colours have not succeeded too well. In the meantime, I have focused on providing some image based lighting (IBL).

IBL through the use of HDRI environment / sky maps are extremely common in CG art. I would like to use the very same here, with the prerequisite that it should not adversely affect the scientific accuracy of the simulation. I had the idea to merge and calibrate an outdoor environment map with a CIE sky so that I could benefit from the accuracy of a CIE sky whilst maintaining the colourful variety that an environment map provides. I first [posted an idea here](https://discourse.radiance-online.org/t/calibrating-hdr-sky-maps-for-ibl-similar-to-cie-skies/505) last year, but never followed up with my various tests.

Anyway, to start with, I created a mask for the skymap so that the sky itself would be hidden.

 ![2018-10-07-093111_725x398_scrot](https://discourse.radiance-online.org/uploads/default/original/1X/5e78f88781cfa11bba613d9825bc9b8e60ad0219.png)

Then I combine the skymap with the CIE sky using the mask in a mixpict. However, first, I roughly calibrate the skymap’s luminance by making the ground in a sensible range of values. I can calibrate further by taking some macbethcal measurements of the grass and creating my own panoramic skymap photos, however, I don’t yet know how to do this. For now, this ballpark figure calibration will do.

I also get the impression that the skyfunc can be applied to any arbitrarily blue colour. To get some sensible sky blue, I measure the median blue in the original sky photo and try to achieve that ratio of R, G, and B.

Here is my full definition with some comments.

```auto
!gensky 9 30 14 -a -33 -o -151 -m -150 +s

void colorpict env_map
7 red green blue textures/noon_grass_16k.hdr cal/skymap.cal map_u map_v
0
1 0.5

# This is a multiplier to colour balance the env map
# In this case, it provides a rough ground luminance from 3k-5k
env_map colorfunc env_colour
4 100 100 100 .
0
0

# .37 .57 1.5 is measured from a HDRI image of how "blue" the sky is
# It is multiplied by a factor such that grey(r,g,b) = 1
skyfunc colorfunc sky_colour
4 .64 .99 2.6 .
0
0

void mixpict composite
7 env_colour sky_colour grey textures/noon_grass_2k_mask.hdr cal/skymap.cal map_u map_v
0
2 0.5 1

composite glow env_map_glow
0
0
4 1 1 1 0

env_map_glow source sky
0
0
4 0 0 1 180

env_colour glow ground_glow
0
0
4 1 1 1 0

ground_glow source ground
0
0
4 0 0 -1 180

```

This gives a result as follows. On the left is a pure CIE sky and ground glow. In the middle is my roughly calibrated skymap & CIE composite viewed in greyscale. On the right is the colour version.

 ![2018-10-07-093002_1920x1080_scrot](https://discourse.radiance-online.org/uploads/default/original/1X/29c497aa2330535e1a9cf0024539a924269953c8.jpg)

And finally, here’s the updated render with the skymap! It gives a pretty good result, and like my other tests which I did not post, does not seem to adversely affect the accuracy of the simulation.

 ![photo_v3](https://discourse.radiance-online.org/uploads/default/original/1X/4e527fd5a688db481d77fd06d2e80b7d50989c64.jpg)

---

_[View the full topic](https://discourse.radiance-online.org/t/work-in-progress-living-room/4669)._
