Generate HDRI Sky from RADIANCE

Hi,
I was wondering if a cubemap generated with Radiance of a void scene including a sky and sun could be used as a HDRI sky.

Thank you for your help!

Used in an HDRI sky where? I don’t see why not.

Hi Greg,
Many thanks for your reply. I would like to use it in Unity to reproduce the sky+sun conditions created in Radiance for a real-time simulation. Would there be any other way to produce an HDRI sky other than the one I was thinking of?

I don’t know Unity or what types of 360° projections it accepts. I have a script that generates rays for a particular arrangement of cube faces, which you can then pass through rtrace to generate an image. This saves you from doing 6 rpict runs and assembling the results, but either method can work.

Hi Greg,
I meant Unity, the real-time 3D development platform, that I am sure you know. It uses simple cubemaps https://docs.unity3d.com/Manual/class-Cubemap.html to define a skybox https://docs.unity3d.com/Manual/skyboxes.html
Having your script would be great! Is it possible to find it somewhere?
Thank you!

I’ve heard of Unity, but I haven’t worked with it. I don’t know from the webpage description which way is up in each cube face direction. I can give you the script I have, but it won’t generate any of their accepted formats. You will need to figure out how to translate it into what you need. The output is a set of rays to use as input to rtrace. I’m hoping the script gives you the clues you need to write your own.

Generate baseball cover rays at the given origin and cube-side resolution

set fmt="-oa"
if ($#argv > 4) then
if ("$1" =~ “-o[fda]”) then
set fmt="$1"
shift argv
endif
endif
if ($#argv != 4) then
echo “Usage: $0 [-o{a|f|d}] xcent ycent zcent sqres”
exit 1
endif
set org=($argv[1-3])
set sqres=$4
@ hres = 3 * $sqres
@ vres = 2 * $sqres
cnt $vres $hres
| rcalc $fmt -e $1=$org[1] -e $2=$org[2] -e $3=$org[3]
-e sqres:$sqres -e ‘hr:3sqres;vr:2sqres’
-e ‘row=floor(($1+.5)/sqres);col=floor(($2+.5)/sqres)’
-e ‘ndx=3row+col+1’
-e ‘dx=select(ndx,-1, 0, 1, 0, 0, 0)’
-e ‘dy=select(ndx, 0, 0, 0,-1, 0, 1)’
-e ‘dz=select(ndx, 0, 1, 0, 0,-1, 0)’
-e ‘ux=select(ndx, 0, 0, 0, 1, 1, 1)’
-e ‘uy=select(ndx,-1,-1,-1, 0, 0, 0)’
-e ‘uz:0’
-e ‘rx=select(ndx, 0, 1, 0, 0, 0, 0)’
-e ‘ry=select(ndx, 0, 0, 0, 0, 1, 0)’
-e ‘rz=select(ndx, 1, 0,-1,-1, 0, 1)’
-e 'h= 2/sqres
($2+.5-sqrescol) - 1.0’
-e 'v= 1.0 - 2/sqres
($1+.5-sqresrow)’
-e '$4=dx+h
rx+vux; $5=dy+hry+vuy; $6=dz+hrz+v*uz’

Thank you Greg!

image
those are the formats automatically recognized by the software Unity. Would this tutorial https://thinkmoult.com/create-360-vr-panoramas-with-radiance.html be useful to create cubemaps for this scope also? I have only used it for panoramas.

I gave you code just now that you can adapt to generate any of the above configurations, but you need to know the “up” directions in each region, which wasn’t specified as far as I could tell on the Unity webpage. I’m sure someone knows which direction is up in the discussion forums there.

The panorama tutorial could be helpful in creating an inferior latitude-longitude map, which Unity also accepts.