HDR Skymap support #91

Finomnis opened this Issue Mar 13, 2013 · 9 comments


None yet

2 participants


Increasing realistic daylight lighting a lot by adding HDR Support for .hdr skymaps from cgskies.com (website even promoted at http://chunky.llbit.se)


Further reading:

But without rendering to RGBE format, all we can really do is truncate the precision afforded by it.

In the meantime, you can open the .hdr in GIMP or Photoshop and simply export it to PNG.


No, my point was to not scale it down to PNG or truncate the precision.

I don't quite understand what you mean by rendering to RGBE format.
My point was... can't you directly use the HDR skymap to use it as an HDR light source, so that you get realistic shadows from the skymap, without having to use a manual light source for the shadows?

Or do I misunderstand the way the chunky path tracer works?


Chunky uses the Sun as a single light source, which is configured separately from the skymap. The skymap contributes no lighting to the scene at all and simply exists to provide a more visually stimulating background for the render.

To read and simulate lighting from a skymap without a major refactoring would require a specialized algorithm for creating a large number of emitters in the sky to generate the extra light in the proper detail. It's just not feasible.

However, it might be interesting if it were possible to place a texture with alpha (transparency) between the Sun and the world (sandwiching the Sun between the existing skymap and the new texture) to occlude (block/cover) the Sun, partially or completely.

The occlusions would cast shadows or attenuate (darken) the light which could probably create a much similar look with the right image and configuration, and wouldn't be nearly as computationally expensive. And if you're good with Photoshop or GIMP, it'd be possible to extract the texture from an existing HDR skymap.


Ok, I didn't realize that the renderer works like this. I thought the sky already IS a single light source that a ray would intersect with as soon as it doesn't hit any world objects. I mean ... the skymap already counts for things like ... directed reflections like glass, oceans, and technically a shadow is nothing but a very diffuse reflection of the sky...

But looking at your answer, I guess the path tracing algorithm does differentiate between shadows, diffuse reflections and mirroring reflections...
Although that doesn't make sense from my current understanding of how path tracing works...


But if my request would require a major refactoring, I totally do understand why it won't be implemented.


I'm not exactly sure how Chunky's path tracing works. I was possibly thinking of ray tracing instead, bouncing a ray from screen pixel to light source. They're closely related algorithms.

If it does work as such, then it makes sense that an HDR skymap could be used for lighting a scene. The way the sky contributes color to the ray would have to be refactored to include the extended brightness information, and the coefficient tuned (or made configurable to play around with) to make sure that it doesn't completely wash out the scene, but it's definitely viable.

From my new perspective, this feature would actually be pretty awesome, and shouldn't take an extreme amount of work to implement. It still requires a bit of refactoring in the path tracing code, and implementation of an HDR image format (RGBE) parser.

Fortunately, the Apache Commons Imaging Library includes an RGBE parser implementation.


Well, doesn't help if llbit doesn't care about it :)
Although this ain't any criticism, don't misunderstand.
He did a very good job so far, hope he kinda finds time now and then to continue his work on it.


Implementing an RGBE parser shouldn't be the problem at all.
I think the bigger problem would be indeed that this could take some refactoring, although I didn't look into the code yet and probably never will be, so ... well. Basically what I am trying to say is ... I don't have any idea.
I just thought it was a cool Idea and would improve the visual quality of the renders a lot. (At least the daytime ones) as, right now, it's really hard to adjust the sun so that it matches the picture (e.g. sunset pictures) without showing the artificial sun on the sky.
Like this... http://i.imgur.com/7h9RE.jpg


Maybe a simple option to add would be one that hides the sun but keeps the light it emits, so that you can match the lighting without worrying about a big blocky sun breaking up your beautiful skymap.

@llbit llbit added a commit that closed this issue Aug 3, 2014
@llbit Added more sky rendering modes
+ Improved cloud rendering
+ Added more controls for sky parameters
+ Added gradient editor
+ Added color picker
+ HDRI textures

fixes #91 (github)
@llbit llbit closed this in fe07dfa Aug 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment