diff --git a/CHANGELOG.md b/CHANGELOG.md index caffb9aaee..957159dadb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,19 @@ Version History --------------- +### Changes in v1.4.2: + +- Several cleanups and bug fixes + - Fixed memory leak where the Embree BVH was never released when an + OSPModel was released + - Fixed a crash when API logging was enabled in certain situations + - Fixed a crash in MPI mode when creating lights without a renderer + - Fixed an issue with camera lens samples not initilized when spp <= 0 + - Fixed an issue in ospExampleViewer when specifying multiple data files +- The C99 tutorial is now indicated as the default; the C++ wrappers do not + change the semantics of the API (memory management) so the C99 version + should be considered first when learning the API + ### Changes in v1.4.1: - Several cleanups and bug fixes diff --git a/README.md b/README.md index 41f12779b7..41956c4868 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ OSPRay ====== -This is release v1.4.1 of OSPRay. For changes and new features see the +This is release v1.4.2 of OSPRay. For changes and new features see the [changelog](CHANGELOG.md). Also visit http://www.ospray.org for more information. @@ -166,8 +166,8 @@ way to configure OSPRay and to create the Visual Studio solution files: e.g. "Visual Studio 15 2017 Win64". - If the configuration fails because some dependencies could not be - found then follow the instructions given in the error message, e.g. - set the variable `embree_DIR` to the folder where Embree was + found then follow the instructions given in the error message, + e.g. set the variable `embree_DIR` to the folder where Embree was installed. - Optionally change the default build options, and then click @@ -186,7 +186,7 @@ console. In the Visual Studio command prompt type: cmake -G "Visual Studio 12 2013 Win64" [-D VARIABLE=value] .. cmake --build . --config Release -Use `-D` to set variables for CMake, e.g. the path to Embree with +Use `-D` to set variables for CMake, e.g. the path to Embree with "`-D embree_DIR=\path\to\embree`". You can also build only some projects with the `--target` switch. @@ -203,11 +203,11 @@ The following [API documentation](http://www.sdvis.org/ospray/download/OSPRay_readme.pdf "OSPRay Documentation") of OSPRay can also be found as a [pdf document](http://www.sdvis.org/ospray/download/OSPRay_readme.pdf "OSPRay Documentation") -(3.3MB). +(3.6MB). For a deeper explanation of the concepts, design, features and performance of OSPRay also have a look at the IEEE Vis 2016 paper -"[OSPRay – A CPU Ray Tracing Framework for Scientific +"[OSPRay -- A CPU Ray Tracing Framework for Scientific Visualization](http://www.sdvis.org/ospray/download/talks/IEEEVis2016_OSPRay_paper.pdf)" (49MB, or get the [smaller version](http://www.sdvis.org/ospray/download/talks/IEEEVis2016_OSPRay_paper_small.pdf) @@ -251,70 +251,70 @@ is important to note that the arguments passed to `ospInit()` are processed in order they are listed. The following parameters (which are prefixed by convention with "`--osp:`") are understood: - - +
Command line parameters accepted by OSPRay's ospInit.
+--++ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + +
Command line parameters accepted by OSPRay’s ospInit.
ParameterDescriptionParameterDescription
--osp:debugenables various extra checks and debug output, and disables multi-threading--osp:debugenables various extra checks and debug output, and disables multi-threading
--osp:numthreads <n>use n threads instead of per default using all detected hardware threads--osp:numthreads <n>use n threads instead of per default using all detected hardware threads
--osp:loglevel <n>set logging level, default 0; increasing n means increasingly verbose log messages--osp:loglevel <n>set logging level, default 0; increasing n means increasingly verbose log messages
--osp:verboseshortcut for --osp:loglevel 1--osp:verboseshortcut for --osp:loglevel 1
--osp:vvshortcut for --osp:loglevel 2--osp:vvshortcut for --osp:loglevel 2
--osp:module:<name>load a module during initialization; equivalent to calling ospLoadModule(name)--osp:module:<name>load a module during initialization; equivalent to calling ospLoadModule(name)
--osp:mpienables MPI mode for parallel rendering with the mpi_offload device, to be used in conjunction with mpirun; this will automatically load the "mpi" module if it is not yet loaded or linked--osp:mpienables MPI mode for parallel rendering with the mpi_offload device, to be used in conjunction with mpirun; this will automatically load the “mpi” module if it is not yet loaded or linked
--osp:mpi-offloadsame as --osp:mpi--osp:mpi-offloadsame as --osp:mpi
--osp:mpi-distributedsame as --osp:mpi, but will create an mpi_distributed device instead; Note that this will likely require application changes to work properly--osp:mpi-distributedsame as --osp:mpi, but will create an mpi_distributed device instead; Note that this will likely require application changes to work properly
--osp:logoutput <dst>convenience for setting where status messages go; valid values for dst are cerr and cout--osp:logoutput <dst>convenience for setting where status messages go; valid values for dst are cerr and cout
--osp:erroroutput <dst>convenience for setting where error messages go; valid values for dst are cerr and cout--osp:erroroutput <dst>convenience for setting where error messages go; valid values for dst are cerr and cout
--osp:device:<name>use name as the type of device for OSPRay to create; e.g. --osp:device:default gives you the default local device; Note if the device to be used is defined in a module, remember to pass --osp:module:<name> first--osp:device:<name>use name as the type of device for OSPRay to create; e.g. --osp:device:default gives you the default local device; Note if the device to be used is defined in a module, remember to pass --osp:module:<name> first
--osp:setaffinity <n>if 1, bind software threads to hardware threads; 0 disables binding; default is 1 on KNL and 0 otherwise--osp:setaffinity <n>if 1, bind software threads to hardware threads; 0 disables binding; default is 1 on KNL and 0 otherwise
@@ -353,50 +353,50 @@ void ospDeviceSetString(OSPDevice, const char *id, const char *val); to set parameters on the device. The following parameters can be set on all devices: - +
---+++ - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + +
Parameters shared by all devices.
TypeNameDescriptionTypeNameDescription
intnumThreadsnumber of threads which OSPRay should useintnumThreadsnumber of threads which OSPRay should use
intlogLevellogging levelintlogLevellogging level
stringlogOutputconvenience for setting where status messages go; valid values are cerr and coutstringlogOutputconvenience for setting where status messages go; valid values are cerr and cout
stringerrorOutputconvenience for setting where error messages go; valid values are cerr and coutstringerrorOutputconvenience for setting where error messages go; valid values are cerr and cout
intdebugset debug mode; equivalent to logLevel=2 and numThreads=1intdebugset debug mode; equivalent to logLevel=2 and numThreads=1
intsetAffinitybind software threads to hardware threads if set to 1; 0 disables binding omitting the parameter will let OSPRay chooseintsetAffinitybind software threads to hardware threads if set to 1; 0 disables binding omitting the parameter will let OSPRay choose
@@ -462,7 +462,7 @@ The following errors are currently used by OSPRay: | OSP\_OUT\_OF\_MEMORY | there is not enough memory to execute the command | | OSP\_UNSUPPORTED\_CPU | the CPU is not supported (minimum ISA is SSE4.1) | -: Possible error codes, i.e. valid named constants of type `OSPError`. +: Possible error codes, i.e. valid named constants of type `OSPError`. These error codes are either directly return by some API functions, or are recorded to be later queried by the application via @@ -551,7 +551,7 @@ The commit semantic allow for batching up multiple small changes, and specifies exactly when changes to objects will occur. This is important to ensure performance and consistency for devices crossing a PCI bus, or across a network. In our MPI implementation, for example, we can easily -guarantee consistency among different nodes by MPI barrier’ing on every +guarantee consistency among different nodes by MPI barrier'ing on every commit. Note that OSPRay uses reference counting to manage the lifetime of all @@ -701,19 +701,91 @@ or else an `OSPVolume` handle. The common parameters understood by all volume variants are summarized in the table below. -| Type | Name | Default| Description | -|:------|:------------------------|---------:|:----------------------------------------------------------------------------------| -| vec2f | voxelRange | | minimum and maximum of the scalar values | -| bool | gradientShadingEnabled | false| volume is rendered with surface shading wrt. to normalized gradient | -| bool | preIntegration | false| use pre-integration for [transfer function](#transfer-function) lookups | -| bool | singleShade | true| shade only at the point of maximum intensity | -| bool | adaptiveSampling | true| adapt ray step size based on opacity | -| float | adaptiveScalar | 15| modifier for adaptive step size | -| float | adaptiveMaxSamplingRate | 2| maximum sampling rate for adaptive sampling | -| float | samplingRate | 0.125| sampling rate of the volume (this is the minimum step size for adaptive sampling) | -| vec3f | specular | gray 0.3| specular color for shading | -| vec3f | volumeClippingBoxLower | disabled| lower coordinate (in object-space) to clip the volume values | -| vec3f | volumeClippingBoxUpper | disabled| upper coordinate (in object-space) to clip the volume values | + + ++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Configuration parameters shared by all volume types.
TypeNameDefaultDescription
vec2fvoxelRangeminimum and maximum of the scalar values
boolgradientShadingEnabledfalsevolume is rendered with surface shading wrt. to normalized gradient
boolpreIntegrationfalseuse pre-integration for transfer function lookups
boolsingleShadetrueshade only at the point of maximum intensity
booladaptiveSamplingtrueadapt ray step size based on opacity
floatadaptiveScalar15modifier for adaptive step size
floatadaptiveMaxSamplingRate2maximum sampling rate for adaptive sampling
floatsamplingRate0.125sampling rate of the volume (this is the minimum step size for adaptive sampling)
vec3fspeculargray 0.3specular color for shading
vec3fvolumeClippingBoxLowerdisabledlower coordinate (in object-space) to clip the volume values
vec3fvolumeClippingBoxUpperdisabledupper coordinate (in object-space) to clip the volume values
: Configuration parameters shared by all volume types. @@ -760,17 +832,79 @@ this function. The common parameters understood by both structured volume variants are summarized in the table below. -| Type | Name | Default| Description | -|:-------|:------------|------------:|:--------------------------------------------------| -| vec3i | dimensions | | number of voxels in each dimension $(x, y, z)$ | -| string | voxelType | | data type of each voxel, currently supported are: | -| | | | "uchar" (8 bit unsigned integer) | -| | | | "short" (16 bit signed integer) | -| | | | "ushort" (16 bit unsigned integer) | -| | | | "float" (32 bit single precision floating point) | -| | | | "double" (64 bit double precision floating point) | -| vec3f | gridOrigin | $(0, 0, 0)$| origin of the grid in world-space | -| vec3f | gridSpacing | $(1, 1, 1)$| size of the grid cells in world-space | + + ++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Additional configuration parameters for structured volumes.
TypeNameDefaultDescription
vec3idimensionsnumber of voxels in each dimension (x, y, z)
stringvoxelTypedata type of each voxel, currently supported are:
“uchar” (8 bit unsigned integer)
“short” (16 bit signed integer)
“ushort” (16 bit unsigned integer)
“float” (32 bit single precision floating point)
“double” (64 bit double precision floating point)
vec3fgridOrigin(0, 0, 0)origin of the grid in world-space
vec3fgridSpacing(1, 1, 1)size of the grid cells in world-space
: Additional configuration parameters for structured volumes. @@ -799,52 +933,52 @@ Then for each brick, the application should create an `OSPData` array of `OSPData` handles, where each handle is the data per-brick. Currently we only support `float` voxels. - +
----++++ - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + +
Additional configuration parameters for AMR volumes.
TypeNameDefaultDescriptionTypeNameDefaultDescription
vec3fgridOrigin(0, 0, 0)origin of the grid in world-spacevec3fgridOrigin(0, 0, 0)origin of the grid in world-space
vec3fgridSpacing(1, 1, 1)size of the grid cells in world-spacevec3fgridSpacing(1, 1, 1)size of the grid cells in world-space
stringamrMethodcurrentsampling method; valid values are "finest", "current", or "octant"stringamrMethodcurrentsampling method; valid values are “finest”, “current”, or “octant”
OSPDatabrickInfoarray of info defining each brickOSPDatabrickInfoarray of info defining each brick
OSPDatabrickDataarray of handles to per-brick voxel dataOSPDatabrickDataarray of handles to per-brick voxel data
@@ -944,64 +1078,64 @@ representations in the application this geometry allows a flexible way of specifying the data of center position and radius within a [data](#data) array: - +
----++++ - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + +
Parameters defining a spheres geometry.
TypeNameDefaultDescriptionTypeNameDefaultDescription
floatradius0.01radius of all spheres (if offset_radius is not used)floatradius0.01radius of all spheres (if offset_radius is not used)
OSPDataspheresNULLmemory holding the spatial data of all spheresOSPDataspheresNULLmemory holding the spatial data of all spheres
intbytes_per_sphere16size (in bytes) of each sphere within the spheres arrayintbytes_per_sphere16size (in bytes) of each sphere within the spheres array
intoffset_center0offset (in bytes) of each sphere's "vec3f center" position (in object-space) within the spheres arrayintoffset_center0offset (in bytes) of each sphere’s “vec3f center” position (in object-space) within the spheres array
intoffset_radius-1offset (in bytes) of each sphere's "float radius" within the spheres array (-1 means disabled and use radius)intoffset_radius-1offset (in bytes) of each sphere’s “float radius” within the spheres array (-1 means disabled and use radius)
vec4f[] / vec3f(a)[]colorNULLdata array of colors (RGBA/RGB), color is constant for each spherevec4f[] / vec3f(a)[]colorNULLdata array of colors (RGBA/RGB), color is constant for each sphere
vec2f[]texcoordNULLdata array of texture coordinates, coordinate is constant for each spherevec2f[]texcoordNULLdata array of texture coordinates, coordinate is constant for each sphere
@@ -1019,77 +1153,77 @@ flexible way of specifying the data of offsets for start position, end position and radius within a [data](#data) array. All parameters are listed in the table below. - +
----++++ - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + +
Parameters defining a cylinders geometry.
TypeNameDefaultDescriptionTypeNameDefaultDescription
floatradius0.01radius of all cylinders (if offset_radius is not used)floatradius0.01radius of all cylinders (if offset_radius is not used)
OSPDatacylindersNULLmemory holding the spatial data of all cylindersOSPDatacylindersNULLmemory holding the spatial data of all cylinders
intbytes_per_cylinder24size (in bytes) of each cylinder within the cylinders arrayintbytes_per_cylinder24size (in bytes) of each cylinder within the cylinders array
intoffset_v00offset (in bytes) of each cylinder's "vec3f v0" position (the start vertex, in object-space) within the cylinders arrayintoffset_v00offset (in bytes) of each cylinder’s “vec3f v0” position (the start vertex, in object-space) within the cylinders array
intoffset_v112offset (in bytes) of each cylinder's "vec3f v1" position (the end vertex, in object-space) within the cylinders arrayintoffset_v112offset (in bytes) of each cylinder’s “vec3f v1” position (the end vertex, in object-space) within the cylinders array
intoffset_radius-1offset (in bytes) of each cylinder's "float radius" within the cylinders array (-1 means disabled and use radius instead)intoffset_radius-1offset (in bytes) of each cylinder’s “float radius” within the cylinders array (-1 means disabled and use radius instead)
vec4f[] / vec3f(a)[]colorNULLdata array of colors (RGBA/RGB), color is constant for each cylindervec4f[] / vec3f(a)[]colorNULLdata array of colors (RGBA/RGB), color is constant for each cylinder
OSPDatatexcoordNULLdata array of texture coordinates, in pairs (each a vec2f at vertex v0 and v1)OSPDatatexcoordNULLdata array of texture coordinates, in pairs (each a vec2f at vertex v0 and v1)
: Parameters defining a cylinders geometry. -For texturing each cylinder is seen as a 1D primitive, i.e. a line +For texturing each cylinder is seen as a 1D primitive, i.e. a line segment: the 2D texture coordinates at its vertices v0 and v1 are linearly interpolated. @@ -1184,16 +1318,73 @@ The call returns `NULL` if that type of renderer is not known, or else an `OSPRenderer` handle to the created renderer. General parameters of all renderers are -| Type | Name | Default| Description | -|:-------------|:------------------|--------:|:------------------------------------------------------------------------------| -| OSPModel | model | | the [model](#model) to render | -| OSPCamera | camera | | the [camera](#cameras) to be used for rendering | -| OSPLight\[\] | lights | | [data](#data) array with handles of the [lights](#lights) | -| float | epsilon | 10^-6^| ray epsilon to avoid self-intersections, relative to scene diameter | -| int | spp | 1| samples per pixel | -| int | maxDepth | 20| maximum ray recursion depth | -| float | minContribution | 0.001| sample contributions below this value will be neglected to speed-up rendering | -| float | varianceThreshold | 0| threshold for adaptive accumulation | + + ++++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Parameters understood by all renderers.
TypeNameDefaultDescription
OSPModelmodelthe model to render
OSPCameracamerathe camera to be used for rendering
OSPLight[]lightsdata array with handles of the lights
floatepsilon10-6ray epsilon to avoid self-intersections, relative to scene diameter
intspp1samples per pixel
intmaxDepth20maximum ray recursion depth
floatminContribution0.001sample contributions below this value will be neglected to speed-up rendering
floatvarianceThreshold0threshold for adaptive accumulation
: Parameters understood by all renderers. @@ -1212,64 +1403,64 @@ created by passing the type string "`scivis`" or "`raytracer`" to understood by all renderers the SciVis renderer supports the following special parameters: - +
----++++ - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + +
Special parameters understood by the SciVis renderer.
TypeNameDefaultDescriptionTypeNameDefaultDescription
boolshadowsEnabledfalsewhether to compute (hard) shadowsboolshadowsEnabledfalsewhether to compute (hard) shadows
intaoSamples0number of rays per sample to compute ambient occlusionintaoSamples0number of rays per sample to compute ambient occlusion
floataoDistance1020maximum distance to consider for ambient occlusionfloataoDistance1020maximum distance to consider for ambient occlusion
boolaoTransparencyEnabledfalsewhether object transparency is respected when computing ambient occlusion (slower)boolaoTransparencyEnabledfalsewhether object transparency is respected when computing ambient occlusion (slower)
booloneSidedLightingtrueif true back-facing surfaces (wrt. light source) receive no illuminationbooloneSidedLightingtrueif true back-facing surfaces (wrt. light source) receive no illumination
float / vec3f / vec4fbgColorblack, transparentbackground color and alpha (RGBA)float / vec3f / vec4fbgColorblack, transparentbackground color and alpha (RGBA)
OSPTexture2DmaxDepthTextureNULLscreen-sized float texture with maximum far distance per pixelOSPTexture2DmaxDepthTextureNULLscreen-sized float texture with maximum far distance per pixel
@@ -1281,7 +1472,7 @@ light](#ambient-light). If `aoSamples` is zero (the default) then ambient lights cause ambient illumination (without occlusion). Per default the background of the rendered image will be transparent -black, i.e. the alpha channel holds the opacity of the rendered objects. +black, i.e. the alpha channel holds the opacity of the rendered objects. This facilitates transparency-aware blending of the image with an arbitrary background image by the application. The parameter `bgColor` can be used to already blend with a constant background color (and @@ -1298,50 +1489,55 @@ objects rendered by OSPRay. ### Path Tracer The path tracer supports soft shadows, indirect illumination and -realistic materials. In addition to the [general parameters](#renderer) -understood by all renderers the path tracer supports the following -special parameters: +realistic materials. This renderer is created by passing the type string +"`pathtracer`" to `ospNewRenderer`. In addition to the [general +parameters](#renderer) understood by all renderers the path tracer +supports the following special parameters: - +
----++++ - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + +
Special parameters understood by the path tracer.
TypeNameDefaultDescriptionTypeNameDefaultDescription
introuletteDepth5ray recursion depth at which to start Russian roulette terminationintrouletteDepth5ray recursion depth at which to start Russian roulette termination
floatmaxContributionsamples are clamped to this value before they are accumulated into the framebufferfloatmaxContributionsamples are clamped to this value before they are accumulated into the framebuffer
OSPTexture2DbackplateNULLtexture image used as background, replacing visible lights in infinity (e.g. the HDRI light)OSPTexture2DbackplateNULLtexture image used as background, replacing visible lights in infinity (e.g. the HDRI light)
: Special parameters understood by the path tracer. +The path tracer requires that [materials](#materials) are assigned to +[geometries](#geometries), otherwise surfaces are treated as completely +black. + ### Model Models are a container of scene data. They can hold the different @@ -1439,45 +1635,45 @@ created by passing the type string "`spot`" to `ospNewLight`. In addition to the [general parameters](#lights) understood by all lights the spot light supports the special parameters listed in the table. - +
---+++ - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + +
Special parameters accepted by the spot light.
TypeNameDescriptionTypeNameDescription
vec3f(a)positionthe center of the spot light, in world-spacevec3f(a)positionthe center of the spot light, in world-space
vec3f(a)directionmain emission direction of the spotvec3f(a)directionmain emission direction of the spot
floatopeningAnglefull opening angle (in degree) of the spot; outside of this cone is no illuminationfloatopeningAnglefull opening angle (in degree) of the spot; outside of this cone is no illumination
floatpenumbraAnglesize (angle in degree) of the "penumbra", the region between the rim (of the illumination cone) and full intensity of the spot; should be smaller than half of openingAnglefloatpenumbraAnglesize (angle in degree) of the “penumbra”, the region between the rim (of the illumination cone) and full intensity of the spot; should be smaller than half of openingAngle
floatradiusthe size of the spot light, the radius of a disk with normal directionfloatradiusthe size of the spot light, the radius of a disk with normal direction
@@ -1524,11 +1720,38 @@ illuminating it from infinity. It is created by passing the type string `intensity`](#lights) the HDRI light supports the following special parameters: -| Type | Name | Description | -|:-------------|:-----|:-----------------------------------------------------------------------------------------------------------------| -| vec3f(a) | up | up direction of the light in world-space | -| vec3f(a) | dir | direction to which the center of the texture will be mapped to (analog to [panoramic camera](#panoramic-camera)) | -| OSPTexture2D | map | environment map in latitude / longitude format | + + +++++ + + + + + + + + + + + + + + + + + + + + + + + + +
Special parameters accepted by the HDRI light.
TypeNameDescription
vec3f(a)upup direction of the light in world-space
vec3f(a)dirdirection to which the center of the texture will be mapped to (analog to panoramic camera)
OSPTexture2Dmapenvironment map in latitude / longitude format
: Special parameters accepted by the HDRI light. @@ -1582,19 +1805,19 @@ format](http://paulbourke.net/dataformats/mtl/) of Lightwave's OBJ scene files. To create an OBJ material pass the type string "`OBJMaterial`" to `ospNewMaterial`. Its main parameters are -| Type | Name | Default| Description | -|:-------------|:----------|----------:|:---------------------------------------------------| -| vec3f | Kd | white 0.8| diffuse color | -| vec3f | Ks | black| specular color | -| float | Ns | 10| shininess (Phong exponent), usually in \[2–10^4^\] | -| float | d | opaque| opacity | -| vec3f | Tf | black| transparency filter color | -| OSPTexture2D | map\_Bump | NULL| normal map | +| Type | Name | Default| Description | +|:-------------|:----------|----------:|:----------------------------------------------------| +| vec3f | Kd | white 0.8| diffuse color | +| vec3f | Ks | black| specular color | +| float | Ns | 10| shininess (Phong exponent), usually in \[2--10^4^\] | +| float | d | opaque| opacity | +| vec3f | Tf | black| transparency filter color | +| OSPTexture2D | map\_Bump | NULL| normal map | : Main parameters of the OBJ material. In particular when using the path tracer it is important to adhere to -the principle of energy conservation, i.e. that the amount of light +the principle of energy conservation, i.e. that the amount of light reflected by a surface is not larger than the light arriving. Therefore the path tracer issues a warning and renormalizes the color parameters if the sum of `Kd`, `Ks`, and `Tf` is larger than one in any color @@ -1626,7 +1849,7 @@ or invert its green channel. All parameters (except `Tf`) can be textured by passing a [texture](#texture) handle, prefixed with "`map_`". The fetched texels are multiplied by the respective parameter value. Texturing requires -[geometries](#geometries) with texture coordinates, e.g. a [triangle +[geometries](#geometries) with texture coordinates, e.g. a [triangle mesh](#triangle-mesh) with `vertex.texcoord` provided. The color textures `map_Kd` and `map_Ks` are typically in one of the sRGB gamma encoded formats, whereas textures `map_Ns` and `map_d` are usually in a @@ -1642,46 +1865,46 @@ changing roughness and realistic color shifts at edges. To create a Metal material pass the type string "`Metal`" to `ospNewMaterial`. Its parameters are - +
----++++ - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + +
Parameters of the Metal material.
TypeNameDefaultDescriptionTypeNameDefaultDescription
vec3f[]iorAluminiumdata array of spectral samples of complex refractive index, each entry in the form (wavelength, eta, k), ordered by wavelength (which is in nm)vec3f[]iorAluminiumdata array of spectral samples of complex refractive index, each entry in the form (wavelength, eta, k), ordered by wavelength (which is in nm)
vec3fetaRGB complex refractive index, real partvec3fetaRGB complex refractive index, real part
vec3fkRGB complex refractive index, imaginary partvec3fkRGB complex refractive index, imaginary part
floatroughness0.1roughness in [0–1], 0 is perfect mirrorfloatroughness0.1roughness in [0–1], 0 is perfect mirror
@@ -1730,7 +1953,7 @@ control of the color. To create an Alloy material pass the type string |:------|:----------|----------:|:--------------------------------------------| | vec3f | color | white 0.9| reflectivity at normal incidence (0 degree) | | vec3f | edgeColor | white| reflectivity at grazing angle (90 degree) | -| float | roughness | 0.1| roughness in \[0–1\], 0 is perfect mirror | +| float | roughness | 0.1| roughness in \[0--1\], 0 is perfect mirror | : Parameters of the Alloy material. @@ -1748,7 +1971,7 @@ supported as well. #### Glass The [path tracer](#path-tracer) offers a realistic a glass material, -supporting refraction and volumetric attenuation (i.e. the transparency +supporting refraction and volumetric attenuation (i.e. the transparency color varies with the geometric thickness). To create a Glass material pass the type string "`Glass`" to `ospNewMaterial`. Its parameters are @@ -1771,7 +1994,7 @@ trough a glass of thickness `attenuationDistance`. The [path tracer](#path-tracer) offers a thin glass material useful for objects with just a single surface, most prominently windows. It models -a very thin, transparent slab, i.e. it behaves as if a second, virtual +a very thin, transparent slab, i.e. it behaves as if a second, virtual surface is parallel to the real geometric surface. The implementation accounts for multiple internal reflections between the interfaces (including attenuation), but neglects parallax effects due to its @@ -1830,16 +2053,16 @@ texture. The supported texture formats are: | Name | Description | |:----------------------|:------------------------------------------------------------| -| OSP\_TEXTURE\_RGBA8 | 8 bit \[0–255\] linear components red, green, blue, alpha | +| OSP\_TEXTURE\_RGBA8 | 8 bit \[0--255\] linear components red, green, blue, alpha | | OSP\_TEXTURE\_SRGBA | 8 bit sRGB gamma encoded color components, and linear alpha | | OSP\_TEXTURE\_RGBA32F | 32 bit float components red, green, blue, alpha | -| OSP\_TEXTURE\_RGB8 | 8 bit \[0–255\] linear components red, green, blue | +| OSP\_TEXTURE\_RGB8 | 8 bit \[0--255\] linear components red, green, blue | | OSP\_TEXTURE\_SRGB | 8 bit sRGB gamma encoded components red, green, blue | | OSP\_TEXTURE\_RGB32F | 32 bit float components red, green, blue | -| OSP\_TEXTURE\_R8 | 8 bit \[0–255\] linear single component | +| OSP\_TEXTURE\_R8 | 8 bit \[0--255\] linear single component | | OSP\_TEXTURE\_R32F | 32 bit float single component | -: Supported texture formats by `ospNewTexture2D`, i.e. valid constants +: Supported texture formats by `ospNewTexture2D`, i.e. valid constants of type `OSPTextureFormat`. The texel data addressed by `source` starts with the texels in the lower @@ -1847,9 +2070,9 @@ left corner of the texture image, like in OpenGL. Similar to [data](#data) buffers the texel data can be shared by the application by specifying the `OSP_TEXTURE_SHARED_BUFFER` flag. Per default a texture fetch is filtered by performing bi-linear interpolation of the nearest -2×2 texels; if instead fetching only the nearest texel is desired (i.e. -no filtering) then pass the `OSP_TEXTURE_FILTER_NEAREST` flag. Both -texture creating flags can be combined with a bitwise OR. +2×2 texels; if instead fetching only the nearest texel is desired +(i.e. no filtering) then pass the `OSP_TEXTURE_FILTER_NEAREST` flag. +Both texture creating flags can be combined with a bitwise OR. ### Texture Transformations @@ -1868,7 +2091,7 @@ convention shall be used. The following parameters (prefixed with : Parameters to define texture coordinate transformations. The transformations are applied in the given order. Rotation, scale and -translation are interpreted "texture centric", i.e. their effect seen by +translation are interpreted "texture centric", i.e. their effect seen by an user are relative to the texture (although the transformations are applied to the texture coordinates). @@ -1903,7 +2126,7 @@ corner) and `imageEnd` (upper right corner). This can be used, for example, to crop the image, to achieve asymmetrical view frusta, or to horizontally flip the image to view scenes which are specified in a left-handed coordinate system. Note that values outside the default -range of \[0–1\] are valid, which is useful to easily realize overscan +range of \[0--1\] are valid, which is useful to easily realize overscan or film gate, or to emulate a shifted sensor. #### Perspective Camera @@ -1915,15 +2138,58 @@ rendering, but no motion blur. It is created by passing the type string parameters](#cameras) understood by all cameras the perspective camera supports the special parameters listed in the table below. -| Type | Name | Description | -|:------|:-----------------------|:-----------------------------------------------------------------------| -| float | fovy | the field of view (angle in degree) of the frame's height | -| float | aspect | ratio of width by height of the frame | -| float | apertureRadius | size of the aperture, controls the depth of field | -| float | focusDistance | distance at where the image is sharpest when depth of field is enabled | -| bool | architectural | vertical edges are projected to be parallel | -| int | stereoMode | 0: no stereo (default), 1: left eye, 2: right eye, 3: side-by-side | -| float | interpupillaryDistance | distance between left and right eye when stereo is enabled | + + +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Parameters accepted by the perspective camera.
TypeNameDescription
floatfovythe field of view (angle in degree) of the frame’s height
floataspectratio of width by height of the frame
floatapertureRadiussize of the aperture, controls the depth of field
floatfocusDistancedistance at where the image is sharpest when depth of field is enabled
boolarchitecturalvertical edges are projected to be parallel
intstereoMode0: no stereo (default), 1: left eye, 2: right eye, 3: side-by-side
floatinterpupillaryDistancedistance between left and right eye when stereo is enabled
: Parameters accepted by the perspective camera. @@ -1985,8 +2251,8 @@ by using the [general parameters](#cameras) understood by all cameras. ### Picking -To get the world-space position of the geometry (if any) seen at \[0–1\] -normalized screen-space pixel coordinates `screenPos` use +To get the world-space position of the geometry (if any) seen at +\[0--1\] normalized screen-space pixel coordinates `screenPos` use ``` {.cpp} void ospPick(OSPPickResult*, OSPRenderer, const vec2f &screenPos); @@ -2026,12 +2292,12 @@ Valid values are: | Name | Description | |:-----------------|:------------------------------------------------------------| | OSP\_FB\_NONE | framebuffer will not be mapped by the application | -| OSP\_FB\_RGBA8 | 8 bit \[0–255\] linear component red, green, blue, alpha | +| OSP\_FB\_RGBA8 | 8 bit \[0--255\] linear component red, green, blue, alpha | | OSP\_FB\_SRGBA | 8 bit sRGB gamma encoded color components, and linear alpha | | OSP\_FB\_RGBA32F | 32 bit float components red, green, blue, alpha | : Supported color formats of the framebuffer that can be passed to -`ospNewFrameBuffer`, i.e. valid constants of type +`ospNewFrameBuffer`, i.e. valid constants of type `OSPFrameBufferFormat`. The parameter `frameBufferChannels` specifies which channels the @@ -2077,8 +2343,8 @@ void ospFreeFrameBuffer(OSPFrameBuffer); Because OSPRay uses reference counting internally the framebuffer may not immediately be deleted at this time. -The application can map the given channel of a framebuffer – and thus -access the stored pixel information – via +The application can map the given channel of a framebuffer -- and thus +access the stored pixel information -- via ``` {.cpp} const void *ospMapFrameBuffer(OSPFrameBuffer, @@ -2141,7 +2407,7 @@ float ospRenderFrame(OSPFrameBuffer, OSPRenderer, The third parameter specifies what channel(s) of the framebuffer is written to[^5]. What to render and how to render it depends on the -renderer's parameters. If the framebuffer supports accumulation (i.e. it +renderer's parameters. If the framebuffer supports accumulation (i.e. it was created with `OSP_FB_ACCUM`) then successive calls to `ospRenderFrame` will progressively refine the rendered image. If additionally the framebuffer has an `OSP_FB_VARIANCE` channel then @@ -2165,7 +2431,7 @@ the following items available in your environment in order to build&run OSPRay in MPI mode: - An MPI enabled multi-node environment, such as an HPC cluster -- An MPI implementation you can build against (i.e. Intel MPI, +- An MPI implementation you can build against (i.e. Intel MPI, MVAPICH2, etc...) Enabling the MPI Module in your Build @@ -2214,7 +2480,7 @@ with the thread tasking system. The options for enabling/controlling the dynamic load balacing features on the `mpi_offload` device are found in the table below, which can be changed while the application is running. Please note that these options will likely only pay off for scenes which -have heavy rendering load (e.g. path tracing a non-trivial scene) and +have heavy rendering load (e.g. path tracing a non-trivial scene) and have a lot of variance in how expensive each tile is to render. | Type | Name | Default| Description | @@ -2230,9 +2496,9 @@ The "distributed" rendering mode is where a MPI distributed application frames. In this case, the API expects all calls (both created objects and parameters) to be the same on every application rank, except each rank can specify arbitrary geometries and volumes. Each renderer will -have its own limitations on the topology of the data (i.e. overlapping +have its own limitations on the topology of the data (i.e. overlapping data regions, concave data, etc.), but the API calls will only differ -for scene objects. Thus all other calls (i.e. setting camera, creating +for scene objects. Thus all other calls (i.e. setting camera, creating framebuffer, rendering frame, etc.) will all be assumed to be identical, but only rendering a frame and committing the model must be in lock-step. This mode targets using all available aggregate memory for @@ -2302,19 +2568,20 @@ Tutorial -------- A minimal working example demonstrating how to use OSPRay can be found -at `apps/ospTutorial.cpp`[^6]. On Linux build it in the build directory +at `apps/ospTutorial.c`[^6]. On Linux build it in the build directory with - g++ ../apps/ospTutorial.cpp -I ../ospray/include -I .. ./libospray.so -Wl,-rpath,. -o ospTutorial + gcc -std=c99 ../apps/ospTutorial.c -I ../ospray/include -I .. \ + ./libospray.so -Wl,-rpath,. -o ospTutorial -On Windows build it in the build\_directory\\\$Configuration with +On Windows build it in the "build\_directory\\\$Configuration" with - cl ..\..\apps\ospTutorial.cpp /EHsc -I ..\..\ospray\include -I ..\.. -I ..\..\components ospray.lib + cl ..\..\apps\ospTutorial.c -I ..\..\ospray\include -I ..\.. ospray.lib Running `ospTutorial` will create two images of two triangles, rendered with the Scientific Visualization renderer with full Ambient Occlusion. The first image `firstFrame.ppm` shows the result after one call to -`ospRenderFrame` – jagged edges and noise in the shadow can be seen. +`ospRenderFrame` -- jagged edges and noise in the shadow can be seen. Calling `ospRenderFrame` multiple times enables progressive refinement, resulting in antialiased edges and converged shadows, shown after ten frames in the second image `accumulatedFrames.ppm`. @@ -2334,7 +2601,7 @@ based on a prototype OSPRay scenegraph interface where its nodes are displayed in the GUI and can be manipulated interactively. For instance, simply run it as `ospExampleViewerSg teapot.obj`. -This application also functions as an OSPRay state debugger – invalid +This application also functions as an OSPRay state debugger -- invalid values will be shown in red up the hierarchy and won't change the viewer until corrected. You can also add new nodes where appropriate: for example, when "lights" is expanded right clicking on "lights" and typing @@ -2411,7 +2678,7 @@ communication. ### Interactive Viewer Rank 0 will open an interactive window with GLFW and display the -rendered image. When the application state needs to update (e.g. camera +rendered image. When the application state needs to update (e.g. camera or transfer function changes), this information is broadcasted out to the other nodes to update their scene data. @@ -2432,7 +2699,9 @@ page. [^4]: respectively $(127, 127, 255)$ for 8 bit textures -[^5]: This is currently not implemented, i.e. all channels of the +[^5]: This is currently not implemented, i.e. all channels of the framebuffer are always updated. -[^6]: A C99 version is available at `apps/ospTutorial.c`. +[^6]: A C++ version that uses the C++ conveniance wrappers of OSPRay's + C99 API via `include/ospray/ospray_cpp.h` is available at + `apps/ospTutorial.cpp`. diff --git a/apps/exampleViewer/ospExampleViewer.cpp b/apps/exampleViewer/ospExampleViewer.cpp index ca9970d6fb..c3c2ead09a 100644 --- a/apps/exampleViewer/ospExampleViewer.cpp +++ b/apps/exampleViewer/ospExampleViewer.cpp @@ -305,9 +305,11 @@ static inline void addImporterNodesToWorld(sg::Node& renderer) ss << fn.name() << "_" << i << "_" << j << "_" << k; auto importerNode_ptr = sg::createNode(ss.str(), "Importer")->nodeAs();; auto &importerNode = *importerNode_ptr; - importerNode["fileName"] = fn.str(); auto &transform = world.createChild("transform_"+ss.str(), "Transform"); + transform.add(importerNode_ptr); + importerNode["fileName"] = fn.str(); + transform["scale"] = file.transform.scale; transform["rotation"] = file.transform.rotation; if (files.size() < 2 && animatedFiles.empty()) { @@ -321,7 +323,6 @@ static inline void addImporterNodesToWorld(sg::Node& renderer) animation.setChild("rotation", rotation.shared_from_this()); } - transform.add(importerNode_ptr); renderer.traverse("verify"); renderer.traverse("commit"); auto bounds = importerNode_ptr->computeBounds(); diff --git a/apps/exampleViewer/widgets/cameraManipulator.cpp b/apps/exampleViewer/widgets/cameraManipulator.cpp index c3c2eef65a..84347166a9 100644 --- a/apps/exampleViewer/widgets/cameraManipulator.cpp +++ b/apps/exampleViewer/widgets/cameraManipulator.cpp @@ -94,6 +94,12 @@ namespace ospray { float du = (to.x - from.x) * widget->rotateSpeed; float dv = (to.y - from.y) * widget->rotateSpeed; + if (widget->upAnchored) { + const float theta = std::acos(dot(cam.up, normalize(cam.from-cam.at))); + // prevent instabilities at the poles by enforcing a minimum angle to up + dv = clamp(dv, theta-float(pi)+0.05f, theta-0.05f); + } + const vec3f pivot = cam.at; AffineSpace3fa xfm = AffineSpace3fa::translate(pivot) diff --git a/apps/ospTutorial.c b/apps/ospTutorial.c index a0a3e526c1..1352cb4be7 100644 --- a/apps/ospTutorial.c +++ b/apps/ospTutorial.c @@ -18,7 +18,7 @@ /* This is a small example tutorial how to use OSPRay in an application. * * On Linux build it in the build_directory with - * gcc -std=c99 ../apps/ospTutorial.c -I ../ospray/include -I .. ./libospray.so -Wl,-rpath,. -o ospTutorialC + * gcc -std=c99 ../apps/ospTutorial.c -I ../ospray/include -I .. ./libospray.so -Wl,-rpath,. -o ospTutorial * On Windows build it in the build_directory\$Configuration with * cl ..\..\apps\ospTutorial.c -I ..\..\ospray\include -I ..\.. ospray.lib */ @@ -146,7 +146,7 @@ int main(int argc, const char **argv) { // access framebuffer and write its content as PPM file const uint32_t * fb = (uint32_t*)ospMapFrameBuffer(framebuffer, OSP_FB_COLOR); - writePPM("firstFrameC.ppm", &imgSize, fb); + writePPM("firstFrame.ppm", &imgSize, fb); ospUnmapFrameBuffer(fb, framebuffer); @@ -155,7 +155,7 @@ int main(int argc, const char **argv) { ospRenderFrame(framebuffer, renderer, OSP_FB_COLOR | OSP_FB_ACCUM); fb = (uint32_t*)ospMapFrameBuffer(framebuffer, OSP_FB_COLOR); - writePPM("accumulatedFrameC.ppm", &imgSize, fb); + writePPM("accumulatedFrame.ppm", &imgSize, fb); ospUnmapFrameBuffer(fb, framebuffer); return 0; diff --git a/apps/ospTutorial.cpp b/apps/ospTutorial.cpp index 1cf651942c..851cf08b9f 100644 --- a/apps/ospTutorial.cpp +++ b/apps/ospTutorial.cpp @@ -148,7 +148,7 @@ int main(int argc, const char **argv) { // access framebuffer and write its content as PPM file uint32_t* fb = (uint32_t*)framebuffer.map(OSP_FB_COLOR); - writePPM("firstFrame.ppm", imgSize, fb); + writePPM("firstFrameCpp.ppm", imgSize, fb); framebuffer.unmap(fb); @@ -157,7 +157,7 @@ int main(int argc, const char **argv) { renderer.renderFrame(framebuffer, OSP_FB_COLOR | OSP_FB_ACCUM); fb = (uint32_t*)framebuffer.map(OSP_FB_COLOR); - writePPM("accumulatedFrame.ppm", imgSize, fb); + writePPM("accumulatedFrameCpp.ppm", imgSize, fb); framebuffer.unmap(fb); return 0; diff --git a/cmake/ospray_options.cmake b/cmake/ospray_options.cmake index ab0a4ed2a0..107e2dbbd6 100644 --- a/cmake/ospray_options.cmake +++ b/cmake/ospray_options.cmake @@ -20,7 +20,7 @@ SET(OSPRAY_VERSION_MAJOR 1) SET(OSPRAY_VERSION_MINOR 4) -SET(OSPRAY_VERSION_PATCH 1) +SET(OSPRAY_VERSION_PATCH 2) SET(OSPRAY_VERSION_GITHASH 0) IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git) FIND_PACKAGE(Git) diff --git a/modules/mpi/common/OSPWork.cpp b/modules/mpi/common/OSPWork.cpp index 9cc84043eb..241f192259 100644 --- a/modules/mpi/common/OSPWork.cpp +++ b/modules/mpi/common/OSPWork.cpp @@ -320,6 +320,7 @@ namespace ospray { { Renderer *renderer = (Renderer*)rendererHandle.lookup(); Light *light = nullptr; + if (renderer) light = renderer->createLight(type.c_str()); // No renderer present or the renderer doesn't intercept this diff --git a/ospray/CMakeLists.txt b/ospray/CMakeLists.txt index 1dd7f7d999..1c127cd600 100644 --- a/ospray/CMakeLists.txt +++ b/ospray/CMakeLists.txt @@ -448,11 +448,11 @@ ENDIF() OSPRAY_CREATE_LIBRARY(ospray ${OSPRAY_SOURCES} LINK ${OSPRAY_LIBS} COMPONENT lib) # build ospTutorial, for testing -ADD_EXECUTABLE(ospTutorial ../apps/ospTutorial.cpp) -TARGET_LINK_LIBRARIES(ospTutorial ospray ospray_common) -# C version -ADD_EXECUTABLE(ospTutorialC ../apps/ospTutorial.c) -TARGET_LINK_LIBRARIES(ospTutorialC ospray ospray_common) +ADD_EXECUTABLE(ospTutorial ../apps/ospTutorial.c) +TARGET_LINK_LIBRARIES(ospTutorial ospray) +# C++ version +ADD_EXECUTABLE(ospTutorialCpp ../apps/ospTutorial.cpp) +TARGET_LINK_LIBRARIES(ospTutorialCpp ospray) ############################################################## # Configure find_package files diff --git a/ospray/api/Device.cpp b/ospray/api/Device.cpp index a9855701b3..18a0655ff8 100644 --- a/ospray/api/Device.cpp +++ b/ospray/api/Device.cpp @@ -33,16 +33,14 @@ namespace ospray { // Helper functions /////////////////////////////////////////////////////// template - static inline void installStatusMsgFunc(OSTREAM_T &stream) + static inline void installStatusMsgFunc(Device& device, OSTREAM_T &stream) { - auto &device = currentDevice(); device.msg_fcn = [&](const char *msg){ stream << msg; }; } template - static inline void installErrorMsgFunc(OSTREAM_T &stream) + static inline void installErrorMsgFunc(Device& device, OSTREAM_T &stream) { - auto &device = currentDevice(); device.error_fcn = [&](OSPError e, const char *msg) { stream << "OSPRAY ERROR [" << e << "]: " << msg << std::endl; }; @@ -102,9 +100,9 @@ namespace ospray { auto dst = OSPRAY_LOG_OUTPUT.value_or(getParamString("logOutput")); if (dst == "cout") - installStatusMsgFunc(std::cout); + installStatusMsgFunc(*this, std::cout); else if (dst == "cerr") - installStatusMsgFunc(std::cerr); + installStatusMsgFunc(*this, std::cerr); else if (dst == "none") msg_fcn = [](const char*){}; @@ -113,9 +111,9 @@ namespace ospray { dst = OSPRAY_ERROR_OUTPUT.value_or(getParamString("errorOutput")); if (dst == "cout") - installErrorMsgFunc(std::cout); + installErrorMsgFunc(*this, std::cout); else if (dst == "cerr") - installErrorMsgFunc(std::cerr); + installErrorMsgFunc(*this, std::cerr); else if (dst == "none") error_fcn = [](OSPError, const char*){}; diff --git a/ospray/common/Model.cpp b/ospray/common/Model.cpp index dbd184ba04..dfdd41cb4f 100644 --- a/ospray/common/Model.cpp +++ b/ospray/common/Model.cpp @@ -33,6 +33,12 @@ namespace ospray { this->ispcEquivalent = ispc::Model_create(this); } + Model::~Model() + { + if (embreeSceneHandle) + rtcDeleteScene(embreeSceneHandle); + } + std::string Model::toString() const { return "ospray::Model"; @@ -48,6 +54,7 @@ namespace ospray { RTCDevice embreeDevice = (RTCDevice)ospray_getEmbreeDevice(); ispc::Model_init(getIE(), embreeDevice, geometry.size(), volume.size()); + embreeSceneHandle = (RTCScene)ispc::Model_getEmbreeSceneHandle(getIE()); bounds = empty; diff --git a/ospray/common/Model.h b/ospray/common/Model.h index a24a5b328b..452b5368b3 100644 --- a/ospray/common/Model.h +++ b/ospray/common/Model.h @@ -38,7 +38,7 @@ namespace ospray { struct OSPRAY_SDK_INTERFACE Model : public ManagedObject { Model(); - virtual ~Model() override = default; + virtual ~Model() override; //! \brief common function to help printf-debugging virtual std::string toString() const override; diff --git a/ospray/render/Renderer.ispc b/ospray/render/Renderer.ispc index fdc9a9c49f..f9bf26de89 100644 --- a/ospray/render/Renderer.ispc +++ b/ospray/render/Renderer.ispc @@ -57,9 +57,7 @@ unmasked void Renderer_default_renderTile(uniform Renderer *uniform self, uniform FrameBuffer *uniform fb = self->fb; uniform Camera *uniform camera = self->camera; - float pixel_du = .5f, pixel_dv = .5f; - float lens_du = 0.f, lens_dv = 0.f; - uniform int32 spp = self->spp; + const uniform int32 spp = self->spp; if (spp >= 1) { ScreenSample screenSample; @@ -97,8 +95,8 @@ unmasked void Renderer_default_renderTile(uniform Renderer *uniform self, vec3f col = make_vec3f(0.f); const uint32 pixel = z_order.xs[index] + (z_order.ys[index] * TILE_SIZE); for (uniform uint32 s = 0; s < spp; s++) { - pixel_du = precomputedHalton2(startSampleID+s); - pixel_dv = precomputedHalton3(startSampleID+s); + const float pixel_du = precomputedHalton2(startSampleID+s); + const float pixel_dv = precomputedHalton3(startSampleID+s); screenSample.sampleID.z = startSampleID+s; cameraSample.screen.x = (screenSample.sampleID.x + pixel_du) @@ -120,10 +118,8 @@ unmasked void Renderer_default_renderTile(uniform Renderer *uniform self, setRGBAZ(tile,pixel,col,screenSample.alpha,screenSample.z); } } else { - if (tile.accumID >= 0) { - pixel_du = precomputedHalton2(tile.accumID); - pixel_dv = precomputedHalton3(tile.accumID); - } + const float pixel_du = precomputedHalton2(tile.accumID); + const float pixel_dv = precomputedHalton3(tile.accumID); ScreenSample screenSample; screenSample.sampleID.z = tile.accumID; @@ -131,6 +127,9 @@ unmasked void Renderer_default_renderTile(uniform Renderer *uniform self, screenSample.alpha = 0.f; CameraSample cameraSample; + // TODO: fix correlations / better RNG + cameraSample.lens.x = precomputedHalton3(tile.accumID); + cameraSample.lens.y = precomputedHalton5(tile.accumID); const uniform int blocks = tile.accumID > 0 || spp > 0 ? 1 : min(1 << -2 * spp,