[Radiance-general] How to visualize a sky vector?

Greg Ward gregoryjward at gmail.com
Fri Dec 4 07:33:03 PST 2015


Hi Wouter,

Germán's idea is very clever, but may be more difficult to automate.  You can stick with Andy's original method, yet reduce the file i/o by converting the uncompressed Radiance images produced by rfluxmtx into compressed ones that take much less space.  You just need to run "ra_rgbe -r orig_image.hdr smaller_image.hdr" on each image in your dcx/ directory.

-Greg

> From: Germán Molina Larrain <germolinal at gmail.com>
> Subject: Re: [Radiance-general] How to visualize a sky vector?
> Date: December 4, 2015 4:20:09 PM GMT+01:00
> 
> Hello Wouter, 
> 
> I remember doing this quite a while ago. My approach was to create a sky with the actual patch values and render just one image. To do this I:
> 
> Generate the sky vector values using... using -h for removing the header might be useful.
> gensky XXXXXXX | genskyvec -h | rcalc -e '$1 = $1*0.265+$2*0.67+$3*0.065
> This will lead to one a vector of one value per sky patch.
> modified the reinhartb.cal file to create a mod_reinhartb.cal (see below). Be aware of modifying the MF parameter according to your needs.
> Paste the vector generated on Step 1 in the mod_reinhartb.cal
> Write the sky.rad file.
> oconv sky.rad > octree.oct
> rpict -vth -vd 0 0 1 -vu 0 1 0 -vh 180 -vv 180 -vp 0 0 0 -ab 3 octree.oct > sky.hdr
> You can also plot the values generated on step 1
> 
> Hope this help
> 
> Germán
> 
> 
> #sky.rad
> 
> void brightfunc skyfunc
> 2 rad ./mod_reinhartb.cal
> 0
> 0
> 
> skyfunc glow skyglow 
> 0 
> 0 
> 4 1 1 1 0
> 
> skyglow source sky 
> 0 
> 0 
> 4 0 0 1 180
> 
> 
> 
> ######################################
> ######################
> 
> 
> ### mod_reinhartb.cal
> { RCSid $Id: reinhartb.cal,v 2.6 2015/03/27 18:58:06 greg Exp $ }
> {
> 	Compute Reinhart high-density sky patch bin (rbin)
> 
> 	MF		- Subdivision value (usually a power of two)
> 	Dx,Dy,Dz	- Incident direction (normalized, towards surface face)
> 	rNx,rNy,rNz	- Surface normal (normalized, away from surface)
> 	Ux,Uy,Uz	- Up direction vector (does not need to be normalized)
> 
> 	Modified from reinhart.cal
> 
> 	July 2014	G. Ward
> }
> 				{ Useful factors and functions }
> DEGREE : PI/180;
> Asin(x) : if(x-1, PI/2, if(-1-x, -PI/2, asin(x))) / DEGREE;
> posangle(a) : if(-a, a + 2*PI, a) / DEGREE;
> Atan2(y,x) : posangle(atan2(y,x));
> 
> 				{ Default to Tregenza sky }
> MF = 1;
> 				{ Set to -1 for left-handed coordinate system }
> RHS = 1;
> 				{ Default axis orientation (+Y == north) }
> rNx = 0; rNy = 0; rNz = -1;
> Ux = 0; Uy = 1; Uz = 0;
> 				{ Compute oriented axis angles }
> inc_dz = -Dx*rNx-Dy*rNy-Dz*rNz;
> inc_rx = -RHS*(Dx*(Uy*rNz-Uz*rNy) + Dy*(Uz*rNx-Ux*rNz) + Dz*(Ux*rNy-Uy*rNx));
> inc_ry = Dx*Ux+Dy*Uy+Dz*Uz + inc_dz*(rNx*Ux+rNy*Uy+rNz*Uz);
> 
> r_alt = Asin(inc_dz);
> r_azi = Atan2(inc_rx,inc_ry);
> 
> alpha = 90/(MF*7 + .5);		{ Separation between rows in degrees }
> 				{ Number of patches per row }
> tnaz(r) : select(r, 30, 30, 24, 24, 18, 12, 6);
> rnaz(r) = if(r-(7*MF-.5), 1, MF*tnaz(floor((r+.5)/MF) + 1));
> 
> raccum(r) = if(r-.5, rnaz(r-1) + raccum(r-1), 0);
> 
> r_row = floor(r_alt/alpha);
> 
> r_inc = 360/rnaz(r_row);
> 
> r_azn = if(359.9999-.5*r_inc - r_azi, floor((r_azi +.5*r_inc)/r_inc), 0);
> 
> 				{ Final bin value, -1 for "ground" }
> rbin = if (r_alt, raccum(r_row) + r_azn, -1);
> 
> Nrbins = raccum(7*MF+1);	{ total number of bins }
> 
> 
> rad = select(rbin,
> 	0.8778734094,
>         0.3797278557,
>         ..... one value per patch.
>         ..... Paste the vector generated on step 1 here
> );
> 
> 
> 2015-12-04 11:31 GMT-03:00 ascendilex | Wouter Beck <wouter.beck at ascendilex.nl>:
> In several places I see nice false color luminance representations of Perez skies.
> Trying to render or preferably plot such a representation from a sky vector appears not to be so easy.
> 
> I looked at Andy's McNeil_BSDFsandPhases.pdf and see that using an adaptation of 
> 
>  vwrays -ff -vf views/back.vf -x 600 -y 600 \
> | rfluxmtx `vwrays -vf views/back.vf -x 600 -y 600 -d` \
> -ffc -ab 12 -ad 50000 -lw 2e-5 \
> - skies/sky.rad \
> materials/testroom.mat objects/testroom.rad
> 
> followed by an adaptation of 
> 
> dctimestep dcx/g_%03d.hdr skies/12_21_15.skv \
> > images/122115_clear_dcx.hdr
> 
> could do the trick. For a MF:4 sky I'll be generating 2305 images. Generating these and combining them takes quite long and a lot of disk IO.
> (I did not bother to use a ram disk). Somehow this approach appears to be a bit of a detour.
> 
> Before proceeding on this path: Isn't there a simpler way?
> 
> Basically it should be possible to just plot the sky vector values using something like gnuplot.  
> 
> Best regards,
> Wouter
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.radiance-online.org/pipermail/radiance-general/attachments/20151204/cf0949a4/attachment.html>


More information about the Radiance-general mailing list