From 1f0e85657247973a10c271899d0c6731f39393b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20G=C3=BCnther?= Date: Tue, 15 May 2018 12:16:20 +0200 Subject: [PATCH 01/15] Reformat/clarify/consistency changelog --- CHANGELOG.md | 118 +++++++++++++++++++++++++++------------------------ 1 file changed, 63 insertions(+), 55 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4abfe5f3c2..08271f0e50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,62 +3,67 @@ Version History ### Changes in v1.6.0: -- Updated ISPC device to use Embree v3.1+ -- Added new `ospShutdown` API function to aid in correctness and determinism - of OSPRay API cleanup -- Added Principled and CarPaint materials to the path tracer +- Updated ispc device to use Embree3 (minimum required Embree + version is 3.1) +- Added new `ospShutdown()` API function to aid in correctness and + determinism of OSPRay API cleanup +- Added "`Principled`" and "`CarPaint"` materials to the path tracer - Improved flexibility of the tone mapper -- Improvements to `UnstructuredVolume` - - Implemented support for wedges (in addition to tets and hexes) - - Implemented support for implicit isosurface geometry - - Implemented support for cell-centered data (as an alternative to - per-vertex data) - - Added an option to precompute normals, providing a memory/performance - tradeoff for applications -- Implemented `QuadMesh` geometry type to handle quads directly -- Implemented the ability to set 'void' cell values in all volume types - - When `nan` is present as a volume's cell value the volume sample will be - ignored by the `scivis` renderer -- Fixed support for color strides which were not multiples of `sizeof(float)` -- Added support for RGBA8 color format to Spheres, which can be set by - specifying the "colorFormat" parameter as `OSP_UCHAR4`, or passing the - "colorData" through an `OSPData` of `OSP_UCHAR4`. -- Added ability to configure Embree scene flags via `OSPModel` parameters -- `ospFreeFrameBuffer` has been deprecated in favor of using `ospRelease` to - free frame buffer handles -- Fixed memory leak caused by incorrect parameter reference counts in ISPC - device -- Fixed occasional crashes in the `MPIOffload` device on shutdown +- Improvements to unstructured volume + - Support for wedges (in addition to tets and hexes) + - Support for implicit isosurface geometry + - Support for cell-centered data (as an alternative to per-vertex + data) + - Added an option to precompute normals, providing a + memory/performance trade-off for applications +- Implemented "`quads`" geometry type to handle quads directly +- Implemented the ability to set "void" cell values in all volume + types: when `NaN` is present as a volume's cell value the volume + sample will be ignored by the SciVis renderer +- Fixed support for color strides which were not multiples of + `sizeof(float)` +- Added support for RGBA8 color format to spheres, which can be set by + specifying the "`color_format`" parameter as `OSP_UCHAR4`, or + passing the "`color`" array through an `OSPData` of type + `OSP_UCHAR4`. +- Added ability to configure Embree scene flags via `OSPModel` + parameters +- `ospFreeFrameBuffer()` has been deprecated in favor of using + `ospRelease()` to free frame buffer handles +- Fixed memory leak caused by incorrect parameter reference counts in + ispc device +- Fixed occasional crashes in the `mpi_offload` device on shutdown - Various improvements to sample apps and `ospray_sg` - Added new `generator` nodes, allowing the ability to inject programmatically generated scene data (only C++ for now) - - Bugfixes and improvements to enhance stability and usability + - Bug fixes and improvements to enhance stability and usability ### Changes in v1.5.0: -- TetrahedralVolume now generalized to take both tet and hex data, now called - `UnstructuredVolume` -- New function for creating materials (`ospNewMaterial2`) which takes the - renderer type string, not a renderer instance (the old version is now - deprecated) +- Unstructured tetrahedral volume now generalized to also support + hexahedral data, now called `unstructured_volume` +- New function for creating materials (`ospNewMaterial2()`) which + takes the renderer type string, not a renderer instance (the old + version is now deprecated) - New `tonemapper` PixelOp for tone mapping final frames - Streamlines now support per-vertex radii and smooth interpolation - `ospray_sg` headers are now installed alongside the SDK - Core OSPRay ispc device now implemented as a module - - Devices which implement the public API are no longer required to link - the dependencies to core OSPRay (e.g. Embree v2.x) - - By default, `ospInit` will load the ispc module if a device was not - created via `--osp:mpi` or `--osp:device:[name]` -- MPI devices can now accept an existing world communicator instead of always - creating their own -- Added ability to control ISPC specific optimization flags via CMake options - - See the various `ISPC_FLAGS_*` variables to control which flags get used + - Devices which implement the public API are no longer required to + link the dependencies to core OSPRay (e.g. Embree v2.x) + - By default, `ospInit()` will load the ispc module if a device + was not created via `--osp:mpi` or `--osp:device:[name]` +- MPI devices can now accept an existing world communicator instead of + always creating their own +- Added ability to control ISPC specific optimization flags via CMake + options. See the various `ISPC_FLAGS_*` variables to control which + flags get used - Enhancements to sample applications - - `ospray_sg` (and thus `ospExampleViewer`/`ospBenchmark`) can now be - extended with new scene data importers via modules or the SDK - - Updated ospTutorial examples to properly call ospRelease() - - New options in the ospExampleViewer GUI to showcase new features - - SRGB frame buffers, tone mapping, etc. + - `ospray_sg` (and thus `ospExampleViewer`/`ospBenchmark`) can now + be extended with new scene data importers via modules or the SDK + - Updated `ospTutorial` examples to properly call `ospRelease()` + - New options in the `ospExampleViewer` GUI to showcase new + features (sRGB frame buffers, tone mapping, etc.) - General bug fixes - Fixes to geometries with multiple emissive materials - Improvements to precision of ray-sphere intersections @@ -67,21 +72,24 @@ Version History - Several bug fixes - Fixed potential issue with static initialization order - - Correct compiler flags for Debug config + - Correct compiler flags for `Debug` config - Spheres `postIntersect` shading is now 64-bit safer ### 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 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 + - Fixed a crash in MPI mode when creating lights without a + renderer + - Fixed an issue with camera lens samples not initialized 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: @@ -179,8 +187,8 @@ Version History - Deprecated `ospCreateDevice()`; use `ospNewDevice()` instead - Improved error handling - Various API functions now return an `OSPError` value - - `ospDeviceSetStatusFunc` replaces the deprecated - `ospDeviceSetErrorMsgFunc` + - `ospDeviceSetStatusFunc()` replaces the deprecated + `ospDeviceSetErrorMsgFunc()` - New API functions to query the last error (`ospDeviceGetLastErrorCode()` and `ospDeviceGetLastErrorMsg()`) or to register an error callback with `ospDeviceSetErrorFunc()` From 8328f97c1c6b95d6980b5aabb3522162e7600383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20G=C3=BCnther?= Date: Tue, 15 May 2018 12:17:27 +0200 Subject: [PATCH 02/15] First fixes for quad mesh --- README.md | 115 ++++++++++++++++++++---------- doc/api.md | 30 ++++++-- ospray/common/safe_gather.ih | 5 +- ospray/geometry/QuadMesh.cpp | 16 ++--- ospray/geometry/QuadMesh.ih | 3 +- ospray/geometry/QuadMesh.ispc | 102 +++++++++++++++----------- ospray/geometry/TriangleMesh.ispc | 30 ++++---- 7 files changed, 185 insertions(+), 116 deletions(-) diff --git a/README.md b/README.md index f4579619bc..cc90a0ad81 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ OSPRay ====== -This is release v1.6.0 of OSPRay. For changes and new features -see the [changelog](CHANGELOG.md). Also visit http://www.ospray.org for -more information. +This is release v1.6.0 of OSPRay. For changes and new features see the +[changelog](CHANGELOG.md). Also visit http://www.ospray.org for more +information. OSPRay Overview =============== @@ -355,7 +355,7 @@ all devices: Parameters shared by all devices. - + @@ -1039,11 +1039,12 @@ like the structured volume equivalent, but they only modify the root ### Unstructured Volumes -Unstructured volumes can contain tetrahedral or hexahedral cell types, -and are defined by three arrays: vertices, corresponding field values, -and eight indices per cell (first four are -1 for tetrahedral cells). An -unstructred volume type is created by passing the type string -“`unstructured_volume`” to `ospNewVolume`. +Unstructured volumes can contain tetrahedral, wedge, or hexahedral cell +types, and are defined by three arrays: vertices, corresponding field +values, and eight indices per cell (first four are -1 for tetrahedral +cells, first two are -2 for wedge cells). An unstructured volume type is +created by passing the type string “`unstructured_volume`” to +`ospNewVolume`. Field values can be specified per-vertex (`field`) or per-cell (`cellField`). If both values are set, `cellField` takes precedence. @@ -1055,8 +1056,12 @@ rendering. Note that the index order for each tetrahedron does not matter, as OSPRay internally calculates vertex normals to ensure proper sampling and interpolation. +For wedge cells, each wedge is formed by a group of six indices into the +vertices and data value. Vertex ordering is the same as `VTK_WEDGE` - +three bottom vertices counterclockwise, then top three counterclockwise. + For hexahedral cells, each hexahedron is formed by a group of eight -indices into the vertics and data value. Vertex ordering is the same as +indices into the vertices and data value. Vertex ordering is the same as `VTK_HEXAHEDRON` – four bottom vertices counterclockwise, then top four counterclockwise. @@ -1079,13 +1084,13 @@ counterclockwise. vec3f[] -vertex +vertices data array of vertex positions float[] -vertex.field +field data array of vertex data values to be sampled @@ -1097,7 +1102,7 @@ counterclockwise. vec4i[] -index +indices data array of tetrahedra indices (into vertices and field) @@ -1175,9 +1180,30 @@ triangle mesh recognizes the following parameters: : Parameters defining a triangle mesh geometry. -The `vertex` and `index` arrays are mandatory to creat a valid triangle +The `vertex` and `index` arrays are mandatory to create a valid triangle mesh. +### Quad Mesh + +A mesh consisting of quads is created by calling `ospNewGeometry` with +type string “`quads`”. Once created, a quad mesh recognizes the +following parameters: + +| Type | Name | Description | +|:-----------------------|:----------------|:---------------------------------------------------------------| +| vec3f(a)\[\] | vertex | [data](#data) array of vertex positions | +| vec3f(a)\[\] | vertex.normal | [data](#data) array of vertex normals | +| vec4f\[\] / vec3fa\[\] | vertex.color | [data](#data) array of vertex colors (RGBA/RGB) | +| vec2f\[\] | vertex.texcoord | [data](#data) array of vertex texture coordinates | +| vec4i\[\] | index | [data](#data) array of quad indices (into the vertex array(s)) | + +: Parameters defining a quad mesh geometry. + +The `vertex` and `index` arrays are mandatory to create a valid quad +mesh. A quad is internally handled as a pair of two triangles, thus +mixing triangles and quad is supported by encoding a triangle as a quad +with the last two vertex indices being identical (`w=z`). + ### Spheres A geometry consisting of individual spheres, each of which can have an @@ -1191,10 +1217,10 @@ of specifying the data of center position and radius within a ----++++ @@ -1236,11 +1262,35 @@ of specifying the data of center position and radius within a - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1349,8 +1399,8 @@ table below.
Parameters defining a spheres geometry.
offset (in bytes) of each sphere’s “float radius” within the spheres array (-1 means disabled and use radius)
vec4f[] / vec3f(a)[]intoffset_colorID-1offset (in bytes) of each sphere’s “int colorID” within the spheres array (-1 means disabled and use the shared material color)
vec4f[] / vec3f(a)[] / vec4uc color NULL data array of colors (RGBA/RGB), color is constant for each sphere
intcolor_offset0offset (in bytes) to the start of the color data in color
intcolor_formatcolor.data_typethe format of the color data. Can be one of: OSP_FLOAT4, OSP_FLOAT3, OSP_FLOAT3A or OSP_UCHAR4. Defaults to the type of data in color
intcolor_stridesizeof(color_format)stride (in bytes) between each color element in the color array. Defaults to the size of a single element of type color_format
vec2f[] texcoord
--++ @@ -1565,9 +1615,9 @@ special parameters: -+-+ @@ -1724,13 +1774,13 @@ void ospRemoveVolume(OSPModel, OSPVolume); ``` Finally, Models can be configured with parameters for making various -feature/performance tradeoffs: +feature/performance trade-offs:
Parameters defining a streamlines geometry. Special parameters understood by the SciVis renderer.
-+ @@ -1745,7 +1795,7 @@ feature/performance tradeoffs: - + @@ -2712,7 +2762,7 @@ supports the special parameters listed in the table below. -+ @@ -2903,15 +2953,6 @@ application driving a display wall may well generate an intermediate framebuffer and eventually transfer its pixel to the individual displays using an `OSPPixelOp` [pixel operation](#pixel-operation). -A framebuffer can be freed again using - -``` {.cpp} -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 @@ -2977,7 +3018,7 @@ below. -+ diff --git a/doc/api.md b/doc/api.md index e6b37e725e..802a64992b 100644 --- a/doc/api.md +++ b/doc/api.md @@ -592,7 +592,7 @@ the vertices and data value. Vertex ordering is the same as counterclockwise. For hexahedral cells, each hexahedron is formed by a group of eight -indices into the vertics and data value. Vertex ordering is the same as +indices into the vertices and data value. Vertex ordering is the same as `VTK_HEXAHEDRON` -- four bottom vertices counterclockwise, then top four counterclockwise. @@ -672,9 +672,31 @@ triangle mesh recognizes the following parameters: ------------------ ---------------- ------------------------------------------------- : Parameters defining a triangle mesh geometry. -The `vertex` and `index` arrays are mandatory to creat a valid triangle +The `vertex` and `index` arrays are mandatory to create a valid triangle mesh. +### Quad Mesh + +A mesh consisting of quads is created by calling `ospNewGeometry` with +type string "`quads`". Once created, a quad mesh recognizes the +following parameters: + + Type Name Description + ------------------ ---------------- ------------------------------------------------- + vec3f(a)[] vertex [data] array of vertex positions + vec3f(a)[] vertex.normal [data] array of vertex normals + vec4f[] / vec3fa[] vertex.color [data] array of vertex colors (RGBA/RGB) + vec2f[] vertex.texcoord [data] array of vertex texture coordinates + vec4i[] index [data] array of quad indices (into the vertex array(s)) + ------------------ ---------------- ------------------------------------------------- + : Parameters defining a quad mesh geometry. + +The `vertex` and `index` arrays are mandatory to create a valid quad +mesh. A quad is internally handled as a pair of two triangles, thus +mixing triangles and quad is supported by encoding a triangle as a quad +with the last two vertex indices being identical (`w=z`). + + ### Spheres A geometry consisting of individual spheres, each of which can have an @@ -1027,12 +1049,12 @@ An existing geometry or volume can be removed from a model with void ospRemoveVolume(OSPModel, OSPVolume); Finally, Models can be configured with parameters for making various -feature/performance tradeoffs: +feature/performance trade-offs: ------------- ---------------- -------- ------------------------------------- Type Name Default Description ------------- ---------------- -------- ------------------------------------- - bool dyanmicScene false use RTC_SCENE_DYNAMIC flag (faster + bool dynamicScene false use RTC_SCENE_DYNAMIC flag (faster BVH build, slower ray traversal), otherwise uses RTC_SCENE_STATIC flag (faster ray traversal, slightly diff --git a/ospray/common/safe_gather.ih b/ospray/common/safe_gather.ih index eb6e123710..4dbd8bbd23 100644 --- a/ospray/common/safe_gather.ih +++ b/ospray/common/safe_gather.ih @@ -129,6 +129,7 @@ __define_gather_stride(uint32); __define_gather_stride(vec2f); __define_gather_stride(vec4f); +__define_gather_stride(vec4i); __define_gather(float); __define_gather(int32); @@ -136,6 +137,7 @@ __define_gather(uint32); __define_gather(vec2f); __define_gather(vec4f); +__define_gather(vec4i); __define_gather_vec_byte_stride(float, f, 3); __define_gather_vec_byte_stride(float, f, 4); @@ -144,6 +146,3 @@ __define_gather_vec_byte_stride(int, i, 4); __define_gather_vec3_stride(float, f); __define_gather_vec3_stride(int, i); - -__define_gather_vec4_stride(int, i); - diff --git a/ospray/geometry/QuadMesh.cpp b/ospray/geometry/QuadMesh.cpp index 614d678cf2..b736b19009 100644 --- a/ospray/geometry/QuadMesh.cpp +++ b/ospray/geometry/QuadMesh.cpp @@ -57,11 +57,11 @@ namespace ospray { RTCScene embreeSceneHandle = model->embreeSceneHandle; - vertexData = getParamData("vertex",getParamData("position")); - normalData = getParamData("vertex.normal",getParamData("normal")); - colorData = getParamData("vertex.color",getParamData("color")); - texcoordData = getParamData("vertex.texcoord",getParamData("texcoord")); - indexData = getParamData("index",getParamData("quad")); + vertexData = getParamData("vertex"); + normalData = getParamData("vertex.normal"); + colorData = getParamData("vertex.color"); + texcoordData = getParamData("vertex.texcoord"); + indexData = getParamData("index"); prim_materialIDData = getParamData("prim.materialID"); geom_materialID = getParam1i("geom.materialID",-1); @@ -95,7 +95,6 @@ namespace ospray { size_t numQuads = -1; size_t numVerts = -1; - size_t numCompsInQuad = 4; size_t numCompsInVtx = 0; size_t numCompsInNor = 0; switch (indexData->type) { @@ -126,7 +125,7 @@ namespace ospray { auto eMeshGeom = rtcNewGeometry(ispc_embreeDevice(), RTC_GEOMETRY_TYPE_QUAD); rtcSetSharedGeometryBuffer(eMeshGeom,RTC_BUFFER_TYPE_INDEX,0,RTC_FORMAT_UINT4, - indexData->data,0,numCompsInQuad*sizeof(int),numQuads); + indexData->data,0,4*sizeof(int),numQuads); rtcSetSharedGeometryBuffer(eMeshGeom,RTC_BUFFER_TYPE_VERTEX,0,RTC_FORMAT_FLOAT3, vertexData->data,0,numCompsInVtx*sizeof(int),numVerts); rtcCommitGeometry(eMeshGeom); @@ -148,10 +147,9 @@ namespace ospray { eMeshGeom, eMeshID, numQuads, - numCompsInQuad, numCompsInVtx, numCompsInNor, - (int*)index, + (ispc::vec4i*)index, (float*)vertex, (float*)normal, (ispc::vec4f*)color, diff --git a/ospray/geometry/QuadMesh.ih b/ospray/geometry/QuadMesh.ih index 6188d5cc8e..d1dd309078 100644 --- a/ospray/geometry/QuadMesh.ih +++ b/ospray/geometry/QuadMesh.ih @@ -21,10 +21,9 @@ //! ispc-equivalent of the ospray::QuadMesh geometry struct QuadMesh { Geometry super; //!< inherited geometry fields - int32 idxSize; //!< stride of quad indices, in int32 elements int32 vtxSize; //!< stride of vertex positions, in float32 elements int32 norSize; //!< stride of normals, in float32 elements - int *index; //!< mesh's quad index array + vec4i *index; //!< mesh's quad index array float *vertex; //!< mesh's vertex position array float *normal; //!< mesh's vertex normal array vec4f *color; //!< mesh's vertex color array diff --git a/ospray/geometry/QuadMesh.ispc b/ospray/geometry/QuadMesh.ispc index d06b213004..331bd3282d 100644 --- a/ospray/geometry/QuadMesh.ispc +++ b/ospray/geometry/QuadMesh.ispc @@ -38,6 +38,15 @@ __define_quad_interpolate(vec2f); __define_quad_interpolate(vec3f); __define_quad_interpolate(vec4f); +int32 QuadMesh_getMaterialID( + const Geometry *uniform const _self + , const int32 primID + ) +{ + const QuadMesh *const uniform self = (const QuadMesh *uniform)_self; + return self->prim_materialID ? self->prim_materialID[primID] : self->geom_materialID; +} + static void QuadMesh_postIntersect(uniform Geometry *uniform _self, uniform Model *uniform model, varying DifferentialGeometry &dg, @@ -47,7 +56,7 @@ static void QuadMesh_postIntersect(uniform Geometry *uniform _self, QuadMesh *uniform self = (QuadMesh *uniform)_self; dg.Ng = dg.Ns = ray.Ng; const uniform bool huge_mesh = self->huge_mesh; - const vec4i index = gather_vec4i(huge_mesh, self->index, self->idxSize, ray.primID); + const vec4i index = gather_vec4i(huge_mesh, self->index, ray.primID); const float u = ray.u; const float v = ray.v; const vec4f uv = make_vec4f((1-v)*(1-u), (1-v)*u, v*u, v*(1-u)); @@ -83,14 +92,13 @@ static void QuadMesh_postIntersect(uniform Geometry *uniform _self, } else dg.st = make_vec2f(0.0f, 0.0f); - //TODO, fix for quads if (flags & DG_TANGENTS) { uniform bool fallback = true; if (self->texcoord) { const uniform vec2f *uniform texcoord = self->texcoord; const vec2f a = gather_vec2f(huge_mesh, texcoord, index.x); const vec2f b = gather_vec2f(huge_mesh, texcoord, index.y); - const vec2f c = gather_vec2f(huge_mesh, texcoord, index.z); + const vec2f c = gather_vec2f(huge_mesh, texcoord, index.w); // XXX const vec2f dst02 = a - c; const vec2f dst12 = b - c; const float det = dst02.x * dst12.y - dst02.y * dst12.x; @@ -101,7 +109,7 @@ static void QuadMesh_postIntersect(uniform Geometry *uniform _self, const uniform int32 vtxSize = self->vtxSize; const vec3f a = gather_vec3f(huge_mesh, vertex, vtxSize, index.x); const vec3f b = gather_vec3f(huge_mesh, vertex, vtxSize, index.y); - const vec3f c = gather_vec3f(huge_mesh, vertex, vtxSize, index.z); + const vec3f c = gather_vec3f(huge_mesh, vertex, vtxSize, index.w); const vec3f dp02 = a - c; const vec3f dp12 = b - c; dg.dPds = (dst12.y * dp02 - dst02.y * dp12) * invDet; @@ -116,15 +124,8 @@ static void QuadMesh_postIntersect(uniform Geometry *uniform _self, } } - if (flags & DG_MATERIALID) { - if (self->prim_materialID) { - dg.materialID = self->prim_materialID[ray.primID]; - } - // TODO: gather material ID from index array if indexSize==4 - else { - dg.materialID = self->geom_materialID; - } - } + if (flags & DG_MATERIALID) + dg.materialID = QuadMesh_getMaterialID(_self, ray.primID); } SampleAreaRes QuadMesh_sampleArea( @@ -138,33 +139,49 @@ SampleAreaRes QuadMesh_sampleArea( const QuadMesh *const uniform self = (const QuadMesh *uniform)_self; SampleAreaRes res; - //TODO, fix for quads // gather vertices const uniform bool huge_mesh = self->huge_mesh; - const vec3i index = gather_vec3i(huge_mesh, self->index, self->idxSize, primID); + const vec4i index = gather_vec4i(huge_mesh, self->index, primID); const uniform float *uniform vertex = self->vertex; const uniform int32 vtxSize = self->vtxSize; + // triangles a b c and d c b const vec3f a = gather_vec3f(huge_mesh, vertex, vtxSize, index.x); const vec3f b = gather_vec3f(huge_mesh, vertex, vtxSize, index.y); - const vec3f c = gather_vec3f(huge_mesh, vertex, vtxSize, index.z); + const vec3f c = gather_vec3f(huge_mesh, vertex, vtxSize, index.w); + const vec3f d = gather_vec3f(huge_mesh, vertex, vtxSize, index.z); - const vec3f localPos = uniformSampleTriangle(a, b, c, s); - res.pos = xfmPoint(xfm, localPos); + // painfully slow: re-calculate areas to decide which triangle to sample + const vec3f e1 = xfmVector(xfm, a-c); + const vec3f e2 = xfmVector(xfm, b-c); + const vec3f e3 = xfmVector(xfm, d-b); + const vec3f m1 = cross(e1, e2); + const vec3f m2 = cross(e3, e2); + const float a1 = length(m1); + const float a2 = length(m2); + const float p1 = a1*rcp(a1+a2); - const vec3f e1 = a-c; - const vec3f e2 = b-c; - res.normal = normalize(cross(xfmVector(xfm, e1), xfmVector(xfm, e2))); + res.normal = m1; + vec3f v0 = a; + vec3f v1 = b; + vec3f v2 = c; - return res; -} + vec2f sp; + sp.y = s.y; -int32 QuadMesh_getMaterialID( - const Geometry *uniform const _self - , const int32 primID - ) -{ - const QuadMesh *const uniform self = (const QuadMesh *uniform)_self; - return self->prim_materialID ? self->prim_materialID[primID] : self->geom_materialID; + if (s.x < p1) { + sp.x = s.x * rcp(p1); // reproject + } else { // sample second tri + sp.x = (s.x - p1) * rcp(1.f - p1); // reproject + v0 = d; + v1 = c; + v2 = b; + res.normal = m2; + } + + const vec3f localPos = uniformSampleTriangle(v0, v1, v2, sp); + res.normal = normalize(res.normal); + res.pos = xfmPoint(xfm, localPos); + return res; } void QuadMesh_getAreas( @@ -177,18 +194,20 @@ void QuadMesh_getAreas( { const QuadMesh *const uniform self = (const QuadMesh *uniform)_self; - const uniform int32 idxSize = self->idxSize; const float *const uniform vertex = self->vertex; const uniform int64 vtxSize = self->vtxSize; // TODO vectorize this loop, with foreach or ProgramCount & ProgramIndex for (uniform int32 i = 0; i < numPrims; i++) { - int *uniform index = self->index + primIDs[i] * idxSize; - const uniform vec3f a = *((vec3f*)(vertex + vtxSize * *index)); - const uniform vec3f b = *((vec3f*)(vertex + vtxSize * *(index+1))); - const uniform vec3f c = *((vec3f*)(vertex + vtxSize * *(index+2))); + vec4i uniform index = self->index[primIDs[i]]; + // triangles a b c and d c b + const uniform vec3f a = *((vec3f*)(vertex + vtxSize * index.x)); + const uniform vec3f b = *((vec3f*)(vertex + vtxSize * index.y)); + const uniform vec3f c = *((vec3f*)(vertex + vtxSize * index.w)); + const uniform vec3f d = *((vec3f*)(vertex + vtxSize * index.z)); const uniform vec3f e1 = xfmVector(xfm, a-c); const uniform vec3f e2 = xfmVector(xfm, b-c); - areas[i] = 0.5f * length(cross(e1, e2)); + const uniform vec3f e3 = xfmVector(xfm, d-b); + areas[i] = length(cross(e1, e2)) + length(cross(e2, e3)); } } @@ -200,10 +219,9 @@ void QuadMesh_Constructor(uniform QuadMesh *uniform mesh, RTCGeometry geom, uniform int32 geomID, uniform int32 numQuads, - uniform int32 idxSize, uniform int32 vtxSize, uniform int32 norSize, - uniform int *uniform index, + uniform vec4i *uniform index, uniform float *uniform vertex, uniform float *uniform normal, uniform vec4f *uniform color, @@ -227,7 +245,6 @@ void QuadMesh_Constructor(uniform QuadMesh *uniform mesh, mesh->normal = normal; mesh->color = color; mesh->texcoord = texcoord; - mesh->idxSize = idxSize; mesh->vtxSize = vtxSize; mesh->norSize = norSize; mesh->prim_materialID = prim_materialID; @@ -240,7 +257,7 @@ export void *uniform QuadMesh_create(void *uniform cppEquivalent) { QuadMesh *uniform mesh = uniform new QuadMesh; QuadMesh_Constructor(mesh, cppEquivalent, - NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, + NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, -1, NULL, NULL, true, false); return mesh; } @@ -250,10 +267,9 @@ export void *uniform QuadMesh_set(void *uniform _mesh, RTCGeometry geom, uniform int32 geomID, uniform int32 numQuads, - uniform int32 idxSize, uniform int32 vtxSize, uniform int32 norSize, - uniform int *uniform index, + uniform vec4i *uniform index, uniform float *uniform vertex, uniform float *uniform normal, uniform vec4f *uniform color, @@ -273,7 +289,7 @@ export void *uniform QuadMesh_set(void *uniform _mesh, geom, geomID, numQuads, - idxSize, vtxSize, norSize, + vtxSize, norSize, index, vertex, normal, diff --git a/ospray/geometry/TriangleMesh.ispc b/ospray/geometry/TriangleMesh.ispc index 91bc075493..dc781c6ec4 100644 --- a/ospray/geometry/TriangleMesh.ispc +++ b/ospray/geometry/TriangleMesh.ispc @@ -21,6 +21,16 @@ #include "math/LinearSpace.ih" #include "math/sampling.ih" +int32 TriangleMesh_getMaterialID( + const Geometry *uniform const _self + , const int32 primID + ) +{ + // TODO: gather material ID from index array if indexSize==4 + const TriangleMesh *const uniform self = (const TriangleMesh *uniform)_self; + return self->prim_materialID ? self->prim_materialID[primID] : self->geom_materialID; +} + static void TriangleMesh_postIntersect(uniform Geometry *uniform _self, uniform Model *uniform model, varying DifferentialGeometry &dg, @@ -93,15 +103,8 @@ static void TriangleMesh_postIntersect(uniform Geometry *uniform _self, } } - if (flags & DG_MATERIALID) { - if (self->prim_materialID) { - dg.materialID = self->prim_materialID[ray.primID]; - } - // TODO: gather material ID from index array if indexSize==4 - else { - dg.materialID = self->geom_materialID; - } - } + if (flags & DG_MATERIALID) + dg.materialID = TriangleMesh_getMaterialID(_self, ray.primID); } SampleAreaRes TriangleMesh_sampleArea( @@ -134,15 +137,6 @@ SampleAreaRes TriangleMesh_sampleArea( return res; } -int32 TriangleMesh_getMaterialID( - const Geometry *uniform const _self - , const int32 primID - ) -{ - const TriangleMesh *const uniform self = (const TriangleMesh *uniform)_self; - return self->prim_materialID ? self->prim_materialID[primID] : self->geom_materialID; -} - void TriangleMesh_getAreas( const Geometry *const uniform _self , const int32 *const uniform primIDs From ca386c2564ba467726417186935c8996224fe605 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20G=C3=BCnther?= Date: Thu, 24 May 2018 11:03:27 +0200 Subject: [PATCH 03/15] Use proper data array names for quad mesh in OBJ importer --- apps/common/sg/importer/importOBJ.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/common/sg/importer/importOBJ.cpp b/apps/common/sg/importer/importOBJ.cpp index e6cee56f95..d20314016f 100644 --- a/apps/common/sg/importer/importOBJ.cpp +++ b/apps/common/sg/importer/importOBJ.cpp @@ -230,11 +230,11 @@ namespace ospray { auto vi = createNode("index", "DataVector3i")->nodeAs(); vi->v.reserve(numSrcIndices / 3); - auto vn = createNode("normal", "DataVector3f")->nodeAs(); + auto vn = createNode("vertex.normal", "DataVector3f")->nodeAs(); vn->v.reserve(numSrcIndices); auto vt = - createNode("texcoord", "DataVector2f")->nodeAs(); + createNode("vertex.texcoord", "DataVector2f")->nodeAs(); vt->v.reserve(numSrcIndices); for (size_t i = 0; i < shape.mesh.indices.size(); i += 3) { From 91e716e6079186163445b995fb502fc1a0adf3ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20G=C3=BCnther?= Date: Thu, 24 May 2018 17:45:07 +0200 Subject: [PATCH 04/15] Fix interpolation of tri fallback for quads --- ospray/geometry/QuadMesh.ispc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/ospray/geometry/QuadMesh.ispc b/ospray/geometry/QuadMesh.ispc index 331bd3282d..c2d2e343bb 100644 --- a/ospray/geometry/QuadMesh.ispc +++ b/ospray/geometry/QuadMesh.ispc @@ -59,7 +59,18 @@ static void QuadMesh_postIntersect(uniform Geometry *uniform _self, const vec4i index = gather_vec4i(huge_mesh, self->index, ray.primID); const float u = ray.u; const float v = ray.v; - const vec4f uv = make_vec4f((1-v)*(1-u), (1-v)*u, v*u, v*(1-u)); + vec4f uv; +#if 1 // bilinear for quads + if (index.z == index.w) + uv = make_vec4f(1.f-u-v, u, v, 0.f); + else + uv = make_vec4f((1-v)*(1-u), (1-v)*u, v*u, v*(1-u)); +#else // always as triangles + if (u+v < 1.0f) + uv = make_vec4f(1.f-u-v, u, 0.f, v); + else + uv = make_vec4f(0.f, 1.f-v, u+v-1.f, 1.f-u); +#endif if (flags & DG_NS && self->normal) { const uniform float *uniform normal = self->normal; @@ -98,7 +109,7 @@ static void QuadMesh_postIntersect(uniform Geometry *uniform _self, const uniform vec2f *uniform texcoord = self->texcoord; const vec2f a = gather_vec2f(huge_mesh, texcoord, index.x); const vec2f b = gather_vec2f(huge_mesh, texcoord, index.y); - const vec2f c = gather_vec2f(huge_mesh, texcoord, index.w); // XXX + const vec2f c = gather_vec2f(huge_mesh, texcoord, index.w); const vec2f dst02 = a - c; const vec2f dst12 = b - c; const float det = dst02.x * dst12.y - dst02.y * dst12.x; From 21496115af509c436058c5236eb0376b16cd9de5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20G=C3=BCnther?= Date: Mon, 28 May 2018 15:15:38 +0200 Subject: [PATCH 05/15] Fix makeShadingFrame for normal mapping --- ospray/render/pathtracer/materials/Material.ih | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ospray/render/pathtracer/materials/Material.ih b/ospray/render/pathtracer/materials/Material.ih index 237ed5195c..34255a1a35 100644 --- a/ospray/render/pathtracer/materials/Material.ih +++ b/ospray/render/pathtracer/materials/Material.ih @@ -109,10 +109,9 @@ inline linear3f makeShadingFrame(const DifferentialGeometry& dg, const uniform linear2f& normalRot, uniform float normalScale = 1.f) { - linear3f f = makeShadingFrame(dg); - if (valid(normalMap)) { + linear3f f = make_LinearSpace3f(normalize(dg.dPds), normalize(dg.dPdt), dg.Ns); // get normal from texture vec3f localN = getNormal(normalMap, dg.st) * make_vec3f(normalScale, normalScale, 1.f); // rotate in 2D (tangent space) to account for tc transformations @@ -123,6 +122,6 @@ inline linear3f makeShadingFrame(const DifferentialGeometry& dg, } else { - return f; + return makeShadingFrame(dg); } -} \ No newline at end of file +} From 797baa856b8c65f11a449cc42b8c589b6c978533 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20G=C3=BCnther?= Date: Mon, 28 May 2018 15:26:23 +0200 Subject: [PATCH 06/15] Fix ranges --- README.md | 42 +++++++++++++++++++++--------------------- doc/api.md | 38 +++++++++++++++++++------------------- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index cc90a0ad81..9334fb142b 100644 --- a/README.md +++ b/README.md @@ -203,9 +203,9 @@ Documentation ============= The following [API -documentation](http://www.sdvis.org/ospray/download/OSPRay_readme_devel.pdf "OSPRay Documentation") +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_devel.pdf "OSPRay Documentation"). +document](http://www.sdvis.org/ospray/download/OSPRay_readme.pdf "OSPRay Documentation"). For a deeper explanation of the concepts, design, features and performance of OSPRay also have a look at the IEEE Vis 2016 paper @@ -2162,19 +2162,19 @@ table below. - + - + - + @@ -2186,7 +2186,7 @@ table below. - + @@ -2210,13 +2210,13 @@ table below. - + - + @@ -2240,13 +2240,13 @@ table below. - + - + @@ -2270,7 +2270,7 @@ table below. - + @@ -2282,7 +2282,7 @@ table below. - + @@ -2294,7 +2294,7 @@ table below. - + @@ -2359,7 +2359,7 @@ CarPaint material, pass the type string “`CarPaint`” to - + @@ -2371,25 +2371,25 @@ CarPaint material, pass the type string “`CarPaint`” to - + - + - + - + @@ -2413,7 +2413,7 @@ CarPaint material, pass the type string “`CarPaint`” to - + @@ -3035,13 +3035,13 @@ below. - + - + diff --git a/doc/api.md b/doc/api.md index 802a64992b..6832851676 100644 --- a/doc/api.md +++ b/doc/api.md @@ -1337,15 +1337,15 @@ listed in the table below. vec3f edgeColor white edge tint (metallic only) float metallic 0 mix between dielectric (diffuse and/or specular) - and metallic (specular only with complex IOR) in [0-1] + and metallic (specular only with complex IOR) in [0–1] - float diffuse 1 diffuse reflection weight in [0-1] + float diffuse 1 diffuse reflection weight in [0–1] - float specular 1 specular reflection/transmission weight in [0-1] + float specular 1 specular reflection/transmission weight in [0–1] float ior 1 dielectric index of refraction - float transmission 0 specular transmission weight in [0-1] + float transmission 0 specular transmission weight in [0–1] vec3f transmissionColor white attenuated color due to transmission (Beer's law) @@ -1355,9 +1355,9 @@ listed in the table below. float roughness 0 diffuse and specular roughness in [0–1], 0 is perfectly smooth - float anisotropy 0 amount of specular anisotropy in [0-1] + float anisotropy 0 amount of specular anisotropy in [0–1] - float rotation 0 rotation of the direction of anisotropy in [0-1], 1 is + float rotation 0 rotation of the direction of anisotropy in [0–1], 1 is going full circle float normal 1 normal map/scale @@ -1367,11 +1367,11 @@ listed in the table below. float thickness 1 thickness of the material (thin only), affects the amount of color attenuation due to specular transmission - float backlight 0 amount of diffuse transmission (thin only) in [0-2], + float backlight 0 amount of diffuse transmission (thin only) in [0–2], 1 is 50% reflection and 50% transmission, 2 is transmission only - float coat 0 clear coat layer weight in [0-1] + float coat 0 clear coat layer weight in [0–1] float coatIor 1.5 clear coat index of refraction @@ -1380,15 +1380,15 @@ listed in the table below. float coatThickness 1 clear coat thickness, affects the amount of color attenuation - float coatRoughness 0 clear coat roughness in [0-1], 0 is perfectly smooth + float coatRoughness 0 clear coat roughness in [0–1], 0 is perfectly smooth float coatNormal 1 clear coat normal map/scale - float sheen 0 sheen layer weight in [0-1] + float sheen 0 sheen layer weight in [0–1] vec3f sheenColor white sheen color tint - float sheenRoughness 0.2 sheen roughness in [0-1], 0 is perfectly smooth + float sheenRoughness 0.2 sheen roughness in [0–1], 0 is perfectly smooth float opacity 1 cut-out opacity/transparency, 1 is fully opaque ------------------------------------------------------------------------------------------- @@ -1416,19 +1416,19 @@ in the table below. float normal 1 normal map/scale - float flakeDensity 0 density of metallic flakes in [0-1], 0 disables flakes, + float flakeDensity 0 density of metallic flakes in [0–1], 0 disables flakes, 1 fully covers the surface with flakes float flakeScale 100 scale of the flake structure, higher values increase the amount of flakes - float flakeSpread 0.3 flake spread in [0-1] + float flakeSpread 0.3 flake spread in [0–1] - float flakeJitter 0.75 flake randomness in [0-1] + float flakeJitter 0.75 flake randomness in [0–1] - float flakeRoughness 0.3 flake roughness in [0-1], 0 is perfectly smooth + float flakeRoughness 0.3 flake roughness in [0–1], 0 is perfectly smooth - float coat 1 clear coat layer weight in [0-1] + float coat 1 clear coat layer weight in [0–1] float coatIor 1.5 clear coat index of refraction @@ -1437,7 +1437,7 @@ in the table below. float coatThickness 1 clear coat thickness, affects the amount of color attenuation - float coatRoughness 0 clear coat roughness in [0-1], 0 is perfectly smooth + float coatRoughness 0 clear coat roughness in [0–1], 0 is perfectly smooth float coatNormal 1 clear coat normal map/scale @@ -1955,10 +1955,10 @@ customized using the parameters listed in the table below. Type Name Default Description ----- --------- -------- ----------------------------------------- float contrast 1.6773 contrast (toe of the curve); typically is - in [1-2] + in [1–2] float shoulder 0.9714 highlight compression (shoulder of the - curve); typically is in [0.9-1] + curve); typically is in [0.9–1] float midIn 0.18 mid-level anchor input; default is 18% gray From 9de2d4b69144f56934cf07d639cb7e8da4912262 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20G=C3=BCnther?= Date: Mon, 28 May 2018 17:08:42 +0200 Subject: [PATCH 07/15] Fix nasty memory corruption --- ospray/render/pathtracer/GeometryLight.ispc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ospray/render/pathtracer/GeometryLight.ispc b/ospray/render/pathtracer/GeometryLight.ispc index 5f4436c602..d993a26aa1 100644 --- a/ospray/render/pathtracer/GeometryLight.ispc +++ b/ospray/render/pathtracer/GeometryLight.ispc @@ -138,7 +138,7 @@ export void* uniform GeometryLight_create(void* uniform _geo } else if (numEmissivePrims < geo->numPrimitives) { // save memory int32 *uniform newPrimIDs = uniform new uniform int32[numEmissivePrims]; - memcpy(newPrimIDs, self->primIDs, numEmissivePrims*sizeof(int32)); + memcpy(newPrimIDs, self->primIDs, numEmissivePrims*sizeof(uniform int32)); delete[] self->primIDs; self->primIDs = newPrimIDs; } From 7abb7c732e1fb225bebd20d67f2e520150308a35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20G=C3=BCnther?= Date: Tue, 29 May 2018 10:33:58 +0200 Subject: [PATCH 08/15] Fix quad sampling and optimize tri fallback --- ospray/geometry/QuadMesh.ispc | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/ospray/geometry/QuadMesh.ispc b/ospray/geometry/QuadMesh.ispc index c2d2e343bb..25b551cc01 100644 --- a/ospray/geometry/QuadMesh.ispc +++ b/ospray/geometry/QuadMesh.ispc @@ -161,32 +161,33 @@ SampleAreaRes QuadMesh_sampleArea( const vec3f c = gather_vec3f(huge_mesh, vertex, vtxSize, index.w); const vec3f d = gather_vec3f(huge_mesh, vertex, vtxSize, index.z); - // painfully slow: re-calculate areas to decide which triangle to sample const vec3f e1 = xfmVector(xfm, a-c); const vec3f e2 = xfmVector(xfm, b-c); - const vec3f e3 = xfmVector(xfm, d-b); const vec3f m1 = cross(e1, e2); - const vec3f m2 = cross(e3, e2); - const float a1 = length(m1); - const float a2 = length(m2); - const float p1 = a1*rcp(a1+a2); res.normal = m1; vec3f v0 = a; vec3f v1 = b; vec3f v2 = c; + vec2f sp = s; - vec2f sp; - sp.y = s.y; + if (index.z != index.w) { + // painfully slow: re-calculate areas to decide which triangle to sample + const vec3f e3 = xfmVector(xfm, d-b); + const vec3f m2 = cross(e3, e2); + const float a1 = length(m1); + const float a2 = length(m2); + const float p1 = a1*rcp(a1+a2); - if (s.x < p1) { - sp.x = s.x * rcp(p1); // reproject - } else { // sample second tri - sp.x = (s.x - p1) * rcp(1.f - p1); // reproject - v0 = d; - v1 = c; - v2 = b; - res.normal = m2; + if (s.x < p1) { + sp.x *= rcp(p1); // reproject + } else { // sample second tri + sp.x = (s.x - p1) * rcp(1.f - p1); // reproject + v0 = d; + v1 = c; + v2 = b; + res.normal = m2; + } } const vec3f localPos = uniformSampleTriangle(v0, v1, v2, sp); @@ -218,7 +219,7 @@ void QuadMesh_getAreas( const uniform vec3f e1 = xfmVector(xfm, a-c); const uniform vec3f e2 = xfmVector(xfm, b-c); const uniform vec3f e3 = xfmVector(xfm, d-b); - areas[i] = length(cross(e1, e2)) + length(cross(e2, e3)); + areas[i] = 0.5f*(length(cross(e1, e2)) + length(cross(e2, e3))); } } From dc14ab4979d27a9099a1d5a64ae33fb16fbbbd6b Mon Sep 17 00:00:00 2001 From: Jefferson Amstutz Date: Tue, 29 May 2018 11:52:32 -0500 Subject: [PATCH 09/15] remove unused True/False constants --- components/ospcommon/constants.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/components/ospcommon/constants.h b/components/ospcommon/constants.h index a52878582d..24d6cafef2 100644 --- a/components/ospcommon/constants.h +++ b/components/ospcommon/constants.h @@ -33,14 +33,6 @@ namespace ospcommon /* we consider floating point numbers in that range as valid input numbers */ static float FLT_LARGE = 1.844E18f; - static struct TrueTy { - __forceinline operator bool( ) const { return true; } - } True MAYBE_UNUSED; - - static struct FalseTy { - __forceinline operator bool( ) const { return false; } - } False MAYBE_UNUSED; - static struct ZeroTy { __forceinline operator double ( ) const { return 0; } From ffeb509a07376623f9bf34c31b1ea89a9962ea06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20G=C3=BCnther?= Date: Fri, 1 Jun 2018 14:28:58 +0200 Subject: [PATCH 10/15] Update changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08271f0e50..f4ec694e88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ Version History --------------- +### Changes in v1.6.1: + +- Many bug fixes + - Quad mesh interpolation and sampling + - Cornercases with normal mapping in path tracer materials + - Memory corruption with partly emitting mesh lights + ### Changes in v1.6.0: - Updated ispc device to use Embree3 (minimum required Embree From 15947c6d3607d26c1e166cf5bc1dd189680ab94f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20G=C3=BCnther?= Date: Fri, 1 Jun 2018 13:11:20 +0200 Subject: [PATCH 11/15] Deferred commit for sg::UnstructuredVolume as well --- apps/common/sg/volume/UnstructuredVolume.cpp | 5 +++-- ospray/volume/unstructured/UnstructuredVolume.cpp | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/common/sg/volume/UnstructuredVolume.cpp b/apps/common/sg/volume/UnstructuredVolume.cpp index 54b7181769..3197558aa6 100644 --- a/apps/common/sg/volume/UnstructuredVolume.cpp +++ b/apps/common/sg/volume/UnstructuredVolume.cpp @@ -39,7 +39,9 @@ namespace ospray { { auto ospVolume = valueAs(); - if (!ospVolume) { + if (ospVolume) { + ospCommit(ospVolume); + } else { if (!hasChild("vertices")) throw std::runtime_error("#osp:sg UnstructuredVolume -> no 'vertices' array!"); else if (!hasChild("indices")) @@ -121,7 +123,6 @@ namespace ospray { child("isosurface") = (voxelRange.y + voxelRange.x) / 2.f; } - ospCommit(ospVolume); if (child("isosurfaceEnabled").valueAs() == true && isosurfacesGeometry) { OSPData isovaluesData = ospNewData(1, OSP_FLOAT, diff --git a/ospray/volume/unstructured/UnstructuredVolume.cpp b/ospray/volume/unstructured/UnstructuredVolume.cpp index 02459e27f2..07a16f36c6 100644 --- a/ospray/volume/unstructured/UnstructuredVolume.cpp +++ b/ospray/volume/unstructured/UnstructuredVolume.cpp @@ -175,8 +175,7 @@ namespace ospray { if (!verticesData || !indicesData || (!fieldData && !cellFieldData)) { throw std::runtime_error( - "#osp: missing correct data arrays in " - " UnstructuredVolume!"); + "#osp: missing correct data arrays in UnstructuredVolume!"); } nVertices = verticesData->size(); From d3bc9bee290c8f99b2f39af8603bff5c7d9fa754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20G=C3=BCnther?= Date: Tue, 5 Jun 2018 15:40:31 +0200 Subject: [PATCH 12/15] Another fix for makeShadingFrame --- CHANGELOG.md | 2 +- doc/api.md | 2 +- ospray/render/pathtracer/materials/Material.ih | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f4ec694e88..c18a1f9440 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ Version History - Many bug fixes - Quad mesh interpolation and sampling - - Cornercases with normal mapping in path tracer materials + - Normal mapping in path tracer materials - Memory corruption with partly emitting mesh lights ### Changes in v1.6.0: diff --git a/doc/api.md b/doc/api.md index 6832851676..036994bade 100644 --- a/doc/api.md +++ b/doc/api.md @@ -852,7 +852,7 @@ than the curvature radius of the Bézier curve at each location on the curve. A streamlines geometry can contain multiple disjoint streamlines, each -streamline is specified as a list of linear segments (or links) +streamline is specified as a list of segments (or links) referenced via `index`: each entry `e` of the `index` array points the first vertex of a link (`vertex[index[e]]`) and the second vertex of the link is implicitly the directly following one (`vertex[index[e]+1]`). diff --git a/ospray/render/pathtracer/materials/Material.ih b/ospray/render/pathtracer/materials/Material.ih index 34255a1a35..4337ecce03 100644 --- a/ospray/render/pathtracer/materials/Material.ih +++ b/ospray/render/pathtracer/materials/Material.ih @@ -83,7 +83,8 @@ inline linear3f makeShadingFrame(const DifferentialGeometry& dg) inline linear3f makeShadingFrame(const linear3f& f, const vec3f& localN) { - vec3f N = f * localN; // transform normal to world space + // in general f is not ortho-normal, thus need to re-normalize + vec3f N = normalize(f * localN); // transform normal to world space vec3f U = f.vx; vec3f V = cross(N, U); if (dot(V,V) > 0.f) From c50e5ddef7d47c76c47329910fe19785658c5e7e Mon Sep 17 00:00:00 2001 From: Jefferson Amstutz Date: Wed, 6 Jun 2018 11:51:43 -0500 Subject: [PATCH 13/15] fix logic for setting thread affinity --- ospray/api/Device.cpp | 8 ++++---- ospray/api/Device.h | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ospray/api/Device.cpp b/ospray/api/Device.cpp index 77bd96c0f2..6f7f15442d 100644 --- a/ospray/api/Device.cpp +++ b/ospray/api/Device.cpp @@ -128,11 +128,11 @@ namespace ospray { numThreads = 1; } + threadAffinity = AUTO_DETECT; + auto OSPRAY_SET_AFFINITY = utility::getEnvVar("OSPRAY_SET_AFFINITY"); - if (OSPRAY_SET_AFFINITY) { - threadAffinity = OSPRAY_SET_AFFINITY.value() == 0 ? DEAFFINITIZE : - AFFINITIZE; - } + if (OSPRAY_SET_AFFINITY) + threadAffinity = OSPRAY_SET_AFFINITY.value(); threadAffinity = getParam("setAffinity", threadAffinity); diff --git a/ospray/api/Device.h b/ospray/api/Device.h index c3997db10f..68774d29c5 100644 --- a/ospray/api/Device.h +++ b/ospray/api/Device.h @@ -231,8 +231,11 @@ namespace ospray { /*! whether we're running in debug mode (cmdline: --osp:debug) */ bool debugMode {false}; - enum OSP_THREAD_AFFINITY {AUTO_DETECT, AFFINITIZE, DEAFFINITIZE}; + enum OSP_THREAD_AFFINITY + {DEAFFINITIZE = 0, AFFINITIZE = 1, AUTO_DETECT = 2}; + int threadAffinity {AUTO_DETECT}; + /*! logging level (cmdline: --osp:loglevel \) */ // NOTE(jda) - Keep logLevel static because the device factory function // needs to have a valid value for the initial Device creation From eecf7680e77c49d07e3eb6d57729342f0e8ae68b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20G=C3=BCnther?= Date: Fri, 8 Jun 2018 08:49:01 +0200 Subject: [PATCH 14/15] Bump version --- cmake/ospray_options.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/ospray_options.cmake b/cmake/ospray_options.cmake index eec627c78b..4829baa5d2 100644 --- a/cmake/ospray_options.cmake +++ b/cmake/ospray_options.cmake @@ -20,7 +20,7 @@ SET(OSPRAY_VERSION_MAJOR 1) SET(OSPRAY_VERSION_MINOR 6) -SET(OSPRAY_VERSION_PATCH 0) +SET(OSPRAY_VERSION_PATCH 1) SET(OSPRAY_VERSION_GITHASH 0) IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git) FIND_PACKAGE(Git) From 91f9ad96af0cf28c4de56813d9f6be24fea7e42b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20G=C3=BCnther?= Date: Fri, 8 Jun 2018 08:50:48 +0200 Subject: [PATCH 15/15] Update docu --- CHANGELOG.md | 1 + README.md | 12 ++++++------ doc/news.md | 7 +++++++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c18a1f9440..b281a3f62e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ Version History - Quad mesh interpolation and sampling - Normal mapping in path tracer materials - Memory corruption with partly emitting mesh lights + - Logic for setting thread affinity ### Changes in v1.6.0: diff --git a/README.md b/README.md index 9334fb142b..17ccc8877a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ OSPRay ====== -This is release v1.6.0 of OSPRay. For changes and new features see the +This is release v1.6.1 of OSPRay. For changes and new features see the [changelog](CHANGELOG.md). Also visit http://www.ospray.org for more information. @@ -1459,11 +1459,11 @@ the radius needs to be smaller than the curvature radius of the Bézier curve at each location on the curve. A streamlines geometry can contain multiple disjoint streamlines, each -streamline is specified as a list of linear segments (or links) -referenced via `index`: each entry `e` of the `index` array points the -first vertex of a link (`vertex[index[e]]`) and the second vertex of the -link is implicitly the directly following one (`vertex[index[e]+1]`). -For example, two streamlines of vertices `(A-B-C-D)` and `(E-F-G)`, +streamline is specified as a list of segments (or links) referenced via +`index`: each entry `e` of the `index` array points the first vertex of +a link (`vertex[index[e]]`) and the second vertex of the link is +implicitly the directly following one (`vertex[index[e]+1]`). For +example, two streamlines of vertices `(A-B-C-D)` and `(E-F-G)`, respectively, would internally correspond to five links (`A-B`, `B-C`, `C-D`, `E-F`, and `F-G`), and would be specified via an array of vertices `[A,B,C,D,E,F,G]`, plus an array of link indices `[0,1,2,4,5]`. diff --git a/doc/news.md b/doc/news.md index 893f5c0181..3bb962646b 100644 --- a/doc/news.md +++ b/doc/news.md @@ -1,6 +1,13 @@ News, Updates, and Announcements ================================ +Jun 8, 2018: Version v1.6.1 now released on GitHub +--------------------------------------------------- + +New release version 1.6.1 is now available on the [OSPRay GitHub +page](https://github.com/ospray/OSPRay/releases/v1.6.1). + + May 14, 2018: Version v1.6.0 now released on GitHub ---------------------------------------------------
Parameters understood by Models
booldyanmicScenedynamicScene false use RTC_SCENE_DYNAMIC flag (faster BVH build, slower ray traversal), otherwise uses RTC_SCENE_STATIC flag (faster ray traversal, slightly slower BVH build)
Parameters accepted by the tone mapper.
float metallic 0mix between dielectric (diffuse and/or specular) and metallic (specular only with complex IOR) in [0-1]mix between dielectric (diffuse and/or specular) and metallic (specular only with complex IOR) in [0–1]
float diffuse 1diffuse reflection weight in [0-1]diffuse reflection weight in [0–1]
float specular 1specular reflection/transmission weight in [0-1]specular reflection/transmission weight in [0–1]
floatfloat transmission 0specular transmission weight in [0-1]specular transmission weight in [0–1]
vec3ffloat anisotropy 0amount of specular anisotropy in [0-1]amount of specular anisotropy in [0–1]
float rotation 0rotation of the direction of anisotropy in [0-1], 1 is going full circlerotation of the direction of anisotropy in [0–1], 1 is going full circle
floatfloat backlight 0amount of diffuse transmission (thin only) in [0-2], 1 is 50% reflection and 50% transmission, 2 is transmission onlyamount of diffuse transmission (thin only) in [0–2], 1 is 50% reflection and 50% transmission, 2 is transmission only
float coat 0clear coat layer weight in [0-1]clear coat layer weight in [0–1]
floatfloat coatRoughness 0clear coat roughness in [0-1], 0 is perfectly smoothclear coat roughness in [0–1], 0 is perfectly smooth
floatfloat sheen 0sheen layer weight in [0-1]sheen layer weight in [0–1]
vec3ffloat sheenRoughness 0.2sheen roughness in [0-1], 0 is perfectly smoothsheen roughness in [0–1], 0 is perfectly smooth
floatfloat flakeDensity 0density of metallic flakes in [0-1], 0 disables flakes, 1 fully covers the surface with flakesdensity of metallic flakes in [0–1], 0 disables flakes, 1 fully covers the surface with flakes
floatfloat flakeSpread 0.3flake spread in [0-1]flake spread in [0–1]
float flakeJitter 0.75flake randomness in [0-1]flake randomness in [0–1]
float flakeRoughness 0.3flake roughness in [0-1], 0 is perfectly smoothflake roughness in [0–1], 0 is perfectly smooth
float coat 1clear coat layer weight in [0-1]clear coat layer weight in [0–1]
floatfloat coatRoughness 0clear coat roughness in [0-1], 0 is perfectly smoothclear coat roughness in [0–1], 0 is perfectly smooth
floatfloat contrast 1.6773contrast (toe of the curve); typically is in [1-2]contrast (toe of the curve); typically is in [1–2]
float shoulder 0.9714highlight compression (shoulder of the curve); typically is in [0.9-1]highlight compression (shoulder of the curve); typically is in [0.9–1]
float