raytraverse.renderer¶
Rtrace¶
- class raytraverse.renderer.Rtrace(rayargs=None, scene=None, nproc=None, default_args=True, direct=False)[source]¶
Bases:
Rtrace
singleton wrapper for c++ raytraverse.crenderer.cRtrace class
this class sets default arguments, helps with initialization and setting cpu limits of the cRtrace instance. see raytraverse.crenderer.cRtrace for more details.
- Parameters:
rayargs (str, optional) – argument string (options and flags only) raises ValueError if arguments are not recognized by cRtrace.
scene (str, optional) – path to octree
nproc (int, optional) – if None, sets nproc to cpu count, or the RAYTRAVERSE_PROC_CAP environment variable
default_args (bool, optional) – if True, prepend default args to rayargs parameter
direct (bool, optional) – if True use Rtrace.directargs in place of default (also if True, sets default_args to True.
Examples
Basic Initialization and call:
r = renderer.Rtrace(args, scene) ans = r(vecs) # ans.shape -> (vecs.shape[0], 1)
If rayargs include cache files (ambient cache or photon map) be careful with updating sources. If you are going to swap sources, update the arguments as well with the new paths:
r = renderer.Rtrace(args, scene) r.set_args(args.replace("temp.amb", "temp2.amb")) r.load_source(srcdef)
Note that if you are using ambient caching, you must give an ambient file, because without a file ambient values are not shared across processes or successive calls to the instance.
- instance = <craytraverse.crenderer.rtrace_c.cRtrace object>¶
craytraverse.crenderer.cRtrace
- defaultargs = '-u+ -ab 16 -av 0 0 0 -aa 0 -as 0 -dc 1 -dt 0 -lr -14 -ad 1000 -lw 0.00004 -st 0 -ss 16 -w-'¶
- directargs = '-w- -av 0 0 0 -ab 0 -lr 1 -n 1 -st 0 -ss 16 -lw 0.00004'¶
- usedirect = False¶
- nproc = None¶
- ospec = 'Z'¶
Rcontrib¶
- class raytraverse.renderer.Rcontrib(rayargs=None, scene=None, nproc=None, skyres=15, modname='skyglow', ground=True, default_args=True, adpatch=50)[source]¶
Bases:
Rcontrib
singleton wrapper for c++ raytrraverse.crenderer.cRcontrib class
this class sets default arguments, helps with initialization and setting cpu limits of the cRcontrib instance. see raytrraverse.crenderer.cRcontrib for more details.
- Parameters:
rayargs (str, optional) – argument string (options and flags only) raises ValueError if arguments are not recognized by cRtrace.
scene (str, optional) – path to octree
nproc (int, optional) – if None, sets nproc to cpu count, or the RAYTRAVERSE_PROC_CAP environment variable
skyres (int, optional) – resolution of sky patches (sqrt(patches / hemisphere)). So if skyres=18, each patch will be 100 sq. degrees (0.03046174197 steradians) and there will be 18 * 18 = 324 sky patches.
modname (str, optional) – passed the -m option of cRcontrib initialization
ground (bool, optional) – if True include a ground source (included as a final bin)
default_args (bool, optional) – if True, prepend default args to rayargs parameter
adpatch (int, optional) – when using default_args, ad is set to this times srcn
Examples
Basic Initialization and call:
r = renderer.Rcontrib(args, scene) ans = r(vecs) # ans.shape -> (vecs.shape[0], 325)
- instance = <craytraverse.crenderer.rcontrib_c.cRcontrib object>¶
- adpatch = 50¶
- nproc = None¶
- classmethod set_args(args, nproc=None)[source]¶
prepare arguments to call engine instance initialization
- Parameters:
args (str) – rendering options
nproc (int, optional) – cpu limit
- classmethod setup(scene=None, ground=True, modname='skyglow', skyres=15)[source]¶
set class attributes for proper argument initialization
- Parameters:
scene (str, optional) – path to octree
ground (bool, optional) – if True include a ground source (included as a final bin)
modname (str, optional) – passed the -m option of cRcontrib initialization
skyres (float, optional) – resolution of sky patches (sqrt(patches / hemisphere)). So if skyres=10, each patch will be 100 sq. degrees (0.03046174197 steradians) and there will be 18 * 18 = 324 sky patches.
- Returns:
scene – path to scene with added sky definition
- Return type:
str
ImageRenderer¶
- class raytraverse.renderer.ImageRenderer(scene, viewmapper=None, method='linear', color=False, uv=False)[source]¶
Bases:
object
interface to treat image data as the source for ray tracing results
not implemented as a singleton, so multiple instances can exist in parallel.
- Parameters:
scene (str) – path to hdr image file with projection matching ViewMapper
viewmapper (raytraverse.mapper.ViewMapper, optional) – if None, assumes 180 degree angular fisheye (vta)
method (str, optional) – passed to scipy.interpolate.RegularGridInterpolator
SpRenderer¶
- class raytraverse.renderer.SpRenderer(rayargs=None, scene=None, nproc=None, default_args=True)[source]¶
Bases:
object
sub-process renderer for calling external executables
- args = None¶
- scene = None¶
- name = 'rtrace'¶
- defaultargs = ''¶
- nproc = None¶
- run(*args, **kwargs)[source]¶
alias for call, for consistency with SamplerPt classes for nested dimensions of evaluation