FrankenRender

From K-3D

Jump to: navigation, search

An advanced RenderMan hack is to use BMRT as a rayserver for a render engine that doesn't natively support raytracing.

Dissecting an entry for a RenderMan engine in your ~/.k3d/options.k3d configuration file:

<renderengine type="ri" engine="aqsis" name="Aqsis">
  <render>aqsis -shaders=%shaders %p</render>
  <shaders>
    <shader shaderbinary="%p.slx">aqsl -o %b %s</shader>
  </shaders>
</renderengine>

the main thing is that we take the shader source path, "path/to/shaders/foo.sl", remove the ".sl", and substitute the results into the "shaderbinary" attribute wherever we see %p to get the target path, "path/to/shaders/foo.slx".

Then we check to see which is newer, source or target. If the source is newer or the target doesn't exist, time to compile.

We substitute the source and target paths into the command-line wherever we see %s and %b, respectively, and execute the results.

So, the problem is that you want to build two different targets from one source, a case that is unsupported by the current design. In the short-term, you could create a little helper script that builds both shaders from the source (completely untested):

#!/bin/sh
shader_source=$1
aqsis_target=$2
bmrt_target=${aqsis_target/.slx/.slc}
aqsl -o $aqsis_target $shader_source
slc -o $bmrt_target $shader_source

... then create a new render engine spec to call it (also untested):

<renderengine type="ri" engine="aqsis+bmrt" name="Aqsis + BMRT">
  <render>aqsis_bmrt_render_helper -shaders=%shaders %p</render>
  <shaders>
    <shader shaderbinary="%p.slx">aqsis_bmrt_shader_helper %b %s</shader>
  </shaders>
</renderengine>
Personal tools