Skip to content

Instantly share code, notes, and snippets.

View sariths's full-sized avatar

Sarith Subramaniam sariths

View GitHub Profile
#!/usr/bin/env bash
#Fun with light tubes !
#Octree
oconv -f materials.rad scene.rad > room.oct
#View Matrix
vwrays -vtv -vp 2.65 -2.05 1 -vd 0.02 1 -0.01 -vu 0 0 1 -vv 35 -vh 59 -vo 3 -x 400 -y 400 -pj 0.7 -c 6 -ff | rfluxmtx -v -ffc `-vtv -vp 2.65 -2.05 1 -vd 0.02 1 -0.01 -vu 0 0 1 -vv 35 -vh 59 -vo 3 -x 400 -y 400 -d` -o matrices/vmtx/%03d.hdr -ab 5 -ad 10000 -lw 1e-5 -c 6 -n 16 - vport/vport.rad -i room.oct
@sariths
sariths / tregenza.py
Created October 11, 2017 18:45
Create colorful tregenza sky patches.
# coding=utf-8
import os
import random
import glob
def renderTregenzaPatches(outputPath='tregenzaPatch.hdr',imgResolution=200,reinhartMF=1,cleanUp=True):
"""
:param outputPath: A filepath where the created image should be written to. Defaults to tregenzaPatch.hdr in the same
directory that the script is being run in.
@sariths
sariths / resetExposure.py
Created October 5, 2017 14:34
A python script to reverse assigned exposure values to an images.
"""
Wrote a python implementation of the c-shell script discussed here:
https://www.radiance-online.org//pipermail/hdri/2011-June/000325.html
"""
# coding=utf-8
from __future__ import division
import os
import warnings
@sariths
sariths / bsdfParseWithXML.py
Created April 21, 2017 01:35
Parsing BSDF files with Python using xml library.
from xml.etree import ElementTree
import cPickle,os,json
def getXmlData(fileName):
xmlData = ElementTree.parse(fileName)
node = xmlData.find('./{http://windows.lbl.gov}ScatteringData')
for idx,node in enumerate(xmlData.iter()):
if node.text:
tagVal = node.tag.replace('{http://windows.lbl.gov}', '').strip()
"""This module contains fixes for radiance files exported through su2rad."""
from __future__ import print_function,division
import shutil
import os
def fixAliasMaterialFile(materialFilePath):
"""
@sariths
sariths / bsdfParse.py
Created January 29, 2017 02:34
Hacky parser for BSDF files...Attempt #1
def extractBsdfData(fileName):
with open(fileName) as dataFile:
xmlData=dataFile.read().replace('>',' ').replace('<',' ').replace('/','').replace(',',' ').split()
bsdfDataSet = []
quantDict = {"LBNLKlemsFull":145*145}
numericVal=[]
@sariths
sariths / pep8it.py
Created May 14, 2016 20:25
Take a string containing documentation (usually a Radiance manpage) and make it PEP8 friendly.
# coding=utf-8
"""
Take a string and make it PEP8 friendly.
"""
from __future__ import division,print_function
#This dictionary will store all the characters present in Radiance and other
# documentation which isn't really compatable with utf type. The values will
# be substituted by relevant ascii characters which can then show up on the
# pyCharm documentation.