|
|
@@ -9,7 +9,9 @@ platform = sys.platform
|
|
|
|
|
|
SHADERS = 'shaders'
|
|
|
TEXTURES = 'textures'
|
|
|
-RES = 8192
|
|
|
+RES = 2048
|
|
|
+
|
|
|
+# /// ENV SETUP
|
|
|
|
|
|
os.environ['DL_SHADERS_PATH'] = os.path.join(root, SHADERS)
|
|
|
os.environ['DL_TEXTURES_PATH'] = os.path.join(root, TEXTURES)
|
|
|
@@ -17,10 +19,16 @@ os.environ['DL_TEXTURES_PATH'] = os.path.join(root, TEXTURES)
|
|
|
if platform == 'linux2':
|
|
|
print 'running linux'
|
|
|
DELIGHT = '/usr/local/3delight-12.0.19/Linux-x86_64'
|
|
|
- os.environ['DELIGHT'] = DELIGHT
|
|
|
- sys.path.append(os.path.join(DELIGHT, 'bin'))
|
|
|
+ #os.environ['DELIGHT'] = DELIGHT
|
|
|
+ #sys.path.append(os.path.join(DELIGHT, 'bin'))
|
|
|
elif platform == 'darwin':
|
|
|
- os.environ['DELIGHT'] = '/Applications/3Delight'
|
|
|
+ DELIGHT = '/Applications/3Delight'
|
|
|
+
|
|
|
+os.environ['DELIGHT'] = DELIGHT
|
|
|
+sys.path.append(os.path.join(DELIGHT, 'bin'))
|
|
|
+DELIGHT_BIN_FOLDER = os.path.join(DELIGHT, 'bin')
|
|
|
+DELIGHT_BIN = os.path.join(DELIGHT_BIN_FOLDER, 'renderdl')
|
|
|
+TDLMAKE_BIN = os.path.join(DELIGHT_BIN_FOLDER, 'tdlmake')
|
|
|
|
|
|
|
|
|
def cleanup():
|
|
|
@@ -38,11 +46,11 @@ def gen_includes(heightmap, disp_factor=1):
|
|
|
|
|
|
for file in glob.glob('receiver/*'):
|
|
|
basename = os.path.splitext(os.path.basename(file))[0]
|
|
|
+ dispsettings = '\n\tDisplacement "lm_disp" "float offset" [.01] \n\t"float Km" [{2}] "string texname" ["textures/tweaked_heightmap.tdl"]'
|
|
|
+
|
|
|
include = 'AttributeBegin\
|
|
|
\n\tSurface "lm_bake" "string bakefile" ["{0}"] "string texColName" [""] "string texSpecName" [""] "float Ka" [0.5] "float Kd" [0.4] "float Ks" [0.5] "float roughness" [0.1]\
|
|
|
\n\tAttribute "displacementbound" "sphere" [{3}]\
|
|
|
- \n\tDisplacement "lm_disp" "float offset" [.01]\
|
|
|
- \n\t"float Km" [{2}] "string texname" ["textures/tweaked_heightmap.tdl"]\
|
|
|
\n\tReadArchive "{1}"]\
|
|
|
\nAttributeEnd'.format(basename, file, disp_factor, disp_bound)
|
|
|
includes.append(include)
|
|
|
@@ -52,9 +60,9 @@ def bake_post_render(root, res=RES):
|
|
|
for bakefile in glob.glob(os.path.join(root, '*.bake')):
|
|
|
bake_target = os.path.splitext(bakefile)[0]
|
|
|
# tdlmake converts bake files to tdl only
|
|
|
- cmd = ['tdlmake', '-nomipmap', '-progress', '-bakeres', str(res) + 'x' + str(res), bakefile, bake_target + '.tdl']
|
|
|
+ cmd = [TDLMAKE_BIN, '-nomipmap', '-progress', '-bakeres', str(res) + 'x' + str(res), bakefile, bake_target + '.tdl']
|
|
|
subprocess.call(cmd)
|
|
|
- cmd = ['tdlmake', '-nomipmap', '-progress', bake_target + '.tdl', bake_target + '.tif']
|
|
|
+ cmd = [TDLMAKE_BIN, '-nomipmap', '-progress', bake_target + '.tdl', bake_target + '.tif']
|
|
|
subprocess.call(cmd)
|
|
|
|
|
|
for include in gen_includes('textures/tweaked_heightmap.tdl', 200):
|
|
|
@@ -62,7 +70,9 @@ for include in gen_includes('textures/tweaked_heightmap.tdl', 200):
|
|
|
|
|
|
cleanup()
|
|
|
|
|
|
-subprocess.call(['renderdl', '-res', str(RES), str(RES), '-id','-progress', 'options.rib'])
|
|
|
+
|
|
|
+
|
|
|
+subprocess.call([DELIGHT_BIN, '-res', str(RES), str(RES), '-id', '-progress', 'options.rib'])
|
|
|
bake_post_render(root)
|
|
|
|
|
|
|