# Makefile (for gnumake) to translate OBJ files to Radiance octree representing # an exemplary model of a cellular office (one work desk with small meeting # desk) as a realistic setting for daylight simulation. # Modelling and assignment of material names in Blender, export to Wavefront OBJ. # Furniture is modelled by collections in Blender with marker triangles for # replmarks, these get material Marker with .obj being the file- # name of the exported, detailed geometry. The latter are exported with the main # model but mapped to void by obj2rad. # Oct 2020, Lars O. Grobe # Lucerne University of Applied Sciences and Arts HSLU, Switzerland # This work is licensed under a Creative Commons Attribution 4.0 International # License: https://creativecommons.org/licenses/by/4.0/ # Begin model configuration ==================================================== # Name of this model, will be used to name scene files name = Cellular # Switch artificial lighting on (<0) or off (=0) export lighting=0 # Glazing definition # Overwrite default (red, green, blue) properties of window groups by defining # wgTopMat, wgMiddleMat, wgBottoMat and point variable to the file here glazingMat = glazingMatDef.mat # Sky definition # Overwrite default by given file sky = skies/skyDef.sky # Radiance object files to be included by xform (use only for simple geometries) objects = desk.rad locker.rad sideBoard.rad lamp.rad workstation.rad # Radiance meshes to be compiled from Wavefront OBJs meshes = chair1.rtm chair2.rtm poster1.rtm poster2.rtm # window group descriptions for e.g. Three Phase Method windowGroups = wgTop.rad wgMiddle.rad wgBottom.rad # Number of processort cores / parallel processes to fork NCPU=1 # End model configuration ====================================================== # Main scene file, may contain triangular markers processed by replmarks octree = $(name).oct blackOctree = $(name)Black.oct scene = $(name).rad ambfile = $(name).amb unffile = $(name).unf # render settings for test rvuopt = -n $(NCPU) -ab 2 -ad 1024 -as 512 -aa .15 -st 0 -ss 16 -lw 2e-3 # render settings for unfiltered HDR rtpictopt = -n $(NCPU) -ab 3 -ad 2048 -as 1024 -aa .1 -st 0 -ss 16 -lw 1e-4 -af $(ambfile) -x 2400 -y 2400 # markers must be have modifier name Marker, where is the basenam # of the compiled mesh (without suffix .rtm) meshMarkers := $(foreach mesh, $(meshes),-I $(mesh) $(subst .rtm,Marker,$(mesh))) objectMarkers := $(foreach object, $(objects),-x $(object) $(subst .rad,Marker,$(object))) replmarksStr = $(meshMarkers) $(objectMarkers) # Complete RAYPATH variable myRAYPATH = $(RAYPATH):$(glazingPath) vpath %.obj obj # Wavefront OBJ files vpath %.map mat # Mapping from Wavefront materials to Radiance modifiers vpath %.mat mat # Radiance modifiers vpath %.sky skies # Sky desciptions vpath %.vf vf # View descriptions # recipes from here .PHONY: clean debug octree # default target debug : fisheye.vf $(octree) RAYPATH=$(myRAYPATH); rvu $(rvuopt) -vf $^ octree : $(octree) blackOctree : $(blackOctree) windowGroups : $(windowGroups) unf : fisheye.vf $(octree) RAYPATH=$(myRAYPATH); rtpict $(rtpictopt) -x 64 -y 64 -vf $^ > /dev/null RAYPATH=$(myRAYPATH); rtpict $(rtpictopt) -vf $^ > $(unffile) # Convert scene and replace markers by objects or meshes $(scene) : %.rad : %.mat $(glazingMat) %.map %.obj $(meshes) $(objects) cat $< $(word 2, $^) > $@ obj2rad -m $(word 3, $^) $(word 4, $^) | replmarks $(replmarksStr) >> $@ # Extract window group descriptions from OBJ $(windowGroups) : %.rad : $(glazingMat) %.map $(name).obj echo '#@rfluxmtx u=Z h=kf' > $@ cat $< >> $@ obj2rad -m $(word 2, $^) $(word 3, $^) >> $@ # Map file per window group %.map : echo "void ;" > $@ echo $(subst .map,Mat,$@) '(Material "'$(subst .map,Mat,$@)'");' >> $@ # Convert Wavefront OBJs to Radiance meshes %.rtm : %.mat %.obj obj2mesh -w -a $^ $@ # Convert Wavefront OBJs to Radiance objects $(objects) : %.rad : %.mat %.obj cat $< > $@ obj2rad $(lastword $^) >> $@ # Compile scene into octree $(octree) : $(scene) $(sky) oconv $^ > $@ $(blackOctree) : $(scene) $(windowGroups) RAYPATH=$$RAYPATH:.; echo "void plastic blackMat 0 0 5 0 0 0 0 0" | cat - $^ | \ xform -c -m blackMat | oconv - > $@ clean : rm -f $(meshes) $(objects) $(scene) $(octree) $(ambfile) $(windowGroups) $(foreach wg, $(windowGroups), $(subst .rad,.map,$(wg) ) )