Hi,
while the given examples do exactly what was asked for, this may be a nice case to demonstrate how to get more information from rtrace than (ir)radiance.
Given an input-file scene.rad, this Makefile renders any object of known identifier as a falsecolor representation of the local illuminance and combines it with a regular (luminance) image of the scene.
# Example how to render selected surfaces in a Radiance scene by a
# falsecolor representation of local illuminance.
# 2022 Lars O. Grobe
# Use at own risk - this may overwrite existing files!
# Surfaces with object name <NAME> will be rendered as falsecolor
NAME="sphereObj"
# View string
VW=-vp 0 -5 2.5 -vd 0 1 0
# Resolution of the rendering, will be scaled to 50%
RES=-x 1600 -y 900
# Upper boundary of the illuminance range for falsecolor
FCMAX=80000
# Resulting image.
# This assumes that the Radiance scene is names accordingly (with .rad extension).
all: scene.hdr
.PHONY: clean
clean:
rm -f scene.fg scene.bg scene.fc scene.hdr
rm -f scene.oct scene.txt scene.leg scene.com
scene.leg : %.leg : %.fg
pcomb -x 1 -y 1 -o $< | \
falsecolor -s $(FCMAX) > $@
scene.com: %.com : %.fg %.bg %.fc
pcomb -e 'ro=if(li(1)-1e-6,ri(3),ri(2));' \
-e 'go=if(li(1)-1e-6,gi(3),gi(2));' \
-e 'bo=if(li(1)-1e-6,bi(3),bi(2));' \
-o $^ > $@
scene.hdr : %.hdr : %.com %.leg
pcompos $(word 1, $^) 0 0 $(word 2, $^) 4 4 > $@
scene.fc : %.fc : %.oct
vwrays $(VW) $(RES) | \
rtrace -i -fac `vwrays -d $(RES)` -ab 1 scene.oct | \
pfilt -x /2 -y /2 -r .7 | \
falsecolor -lw 0 -s $(FCMAX) > $@
scene.txt: %.txt : %.oct
vwrays $(VW) $(RES) | \
rtrace -faa -ab 0 -x 0 -os scene.oct | \
awk '{a="0.0 0.0 0.0";if($$1=="sphereObj"){a="1.0 1.0 1.0"}; print a;}' > $@
scene.fg : %.fg : %.txt
pvalue `vwrays -d $(RES) | awk '{print $$1, $$2, $$3, $$4}'` -r -d -h -H $< | \
pfilt -x /2 -y /2 -r .7 > $@
scene.bg: %.bg : %.oct
vwrays $(VW) $(RES) | \
rtrace -fac `vwrays -d $(RES)` -ab 1 scene.oct | \
pfilt -x /2 -y /2 -r .7 > $@
scene.oct: %.oct : %.rad
oconv $< > $@
Note the required leading tabs in a Makefile!
Similary, one can select surfaces by modifier, distance, orientation… just by adjusting the evaluated output of rtrace (-os in the scene.txt target). And this does not require any modification of the scene.
This is an example scene with the result:
# all material definitions:
void plastic whiteMat
0
0
5 .9 .9 .9
0 0
void metal blueMat
0
0
5 0 .1 .8
.8 .02
void plastic redMat
0
0
5 .5 .1 .1
.2 .04
void plastic grayMat
0
0
5 .2 .2 .2
0 0
void trans screenMat
0
0
7 1 1 1
1 0
1 1
# a simple box 1m x .6m x 3m
!genbox redMat boxObj 1 .6 3 | xform -rz -30 -t 4 8 0
# a cylinder of diamter 0.8m, 2.4m height
whiteMat cylinder cylObj
0
0
7 -1 4 0
-1 4 2.4
.4
# a blue sphere
blueMat sphere sphereObj
0
0
4 .5 2 .8
.8
# a dark gray ground-plane
grayMat ring groundObj
0
0
8 0 0 0
0 0 1
0 24
# a sunny sky
!gensky 3 21 14 +s
skyfunc glow skyGlow
0
0
4 1 1 1
0
skyGlow source skyObj
0
0
4 0 0 1
360
Please take this just as an illustration of rtrace’s capabilities and be aware that the commands would overwrite or delete the files
scene.fg scene.bg scene.fc scene.hdr scene.oct scene.txt scene.leg scene.com
if present in the same directory.
Best, Lars.