{"id":17222785,"url":"https://github.com/cheind/volplay","last_synced_at":"2025-04-14T00:16:35.769Z","repository":{"id":15068219,"uuid":"17794510","full_name":"cheind/volplay","owner":"cheind","description":"Manipulating, rendering and interacting with volumetric data","archived":false,"fork":false,"pushed_at":"2015-04-04T17:38:25.000Z","size":1152,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T00:16:26.490Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cheind.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-03-16T07:40:46.000Z","updated_at":"2019-05-16T06:48:43.000Z","dependencies_parsed_at":"2022-07-16T21:33:03.538Z","dependency_job_id":null,"html_url":"https://github.com/cheind/volplay","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheind%2Fvolplay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheind%2Fvolplay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheind%2Fvolplay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheind%2Fvolplay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cheind","download_url":"https://codeload.github.com/cheind/volplay/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248799951,"owners_count":21163404,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T04:06:20.914Z","updated_at":"2025-04-14T00:16:35.742Z","avatar_url":"https://github.com/cheind.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# volplay\n\n_volplay_ is a library for creating, manipulating and interacting with volumetric data. Focus of this library is clean, reference code. All computations carried out on CPU with minimal focus on parallelism.\n\n## Creating and Manipulating Signed Distance Fields\n\nA signed distance field in _volplay_ is represented by a hierarchy of `volplay::SDFNode`. Leaf nodes represent primitives such as spheres, boxes and planes. Intermediate nodes encapsulate functions on other nodes such as intersection, union, difference, repetition and transformation. \n\nTo start creating a signed distance field use `volplay::make()`.\n\n```cpp\n#include \u003cvolplay/volplay.h\u003e\n\nnamespace vp = volplay;\n\nvp::SDFNodePtr u = vp::make()\n    .join()\n        .sphere().radius(0.5)\n        .transform().translate(vp::Vector(5, 0, 0))\n            .sphere().radius(0.2)\n        .end()\n    .end();\n```\n\nHere the `join()` member method creates a new `volplay::SDFUnion`. Its children are an `volplay::SDFSphere` node with radius 0.5 and a transformed `volplay::SDFSphere` with radius 0.2. The complete graph is shown below. The domain specific language chosen comes quite close to a natural language one would prefer to create hierarchies.\n\n![Image](etc/images/samplediagram.png?raw=true)\n\n## Ray-tracing Signed Distance Fields\n\nThe namespace `volplay::rendering` provides methods to directly visualize the signed distance field by ray-tracing it. Besides the signed distance field itself, rendering can make use of material properties of individual nodes. The ray-tracing pipeline is implemented in `volplay::rendering::Renderer` and involves the following other entities: \n - A scene `volplay::SDFNode` to be rendered. Each node can be attributed with materials `volplay::rendering::Material`\n - A camera `volplay::rendering::Camera` defining the viewpoint and lens parameters.\n - A set of lights `volplay::rendering::Lights`.\n - A set of image generators `volplay::rendering::ImageGenerator` encapsulating the types of images to be generated.\n\nThe example [example_raytracer.cpp](examples/example_raytracer.cpp) demonstrates rendering of two spheres resting on a plane.\nWhen executed the following set of images is generated. From left to right: Blinn-Phong shaded image with shadows and materials applied, depth image of scene and heat image of scene showing hotspots of raytracing.\n\n![BlinnPhong shaded image](etc/images/raytrace.png?raw=true)\n\n## Surface Reconstruction from Signed Distance Fields\n\nThe namespace `volplay::surface` provides methods to explicitly generate a polygonal mesh from an iso-surface in a signed distance field. Currently an implementation of Dual Contouring `volplay::surface::DualContouring` is available. Results can be exported in .OFF format. Here is an example\n\n```cpp\n#include \u003cvolplay/volplay.h\u003e\n\nnamespace vp = volplay;\nnamespace vps = volplay::surface;\n\nvp::SDFNodePtr scene = vp::make()\n    .difference()\n        .join()\n            .sphere().radius(1)\n            .transform().translate(vp::Vector(0.8f, 0.8f, 0.8f))\n                .sphere().radius(1)\n            .end()\n        .end()\n        .plane().normal(vp::Vector::UnitZ())\n    .end();\n\nvps::DualContouring dc;\ndc.setLowerBounds(vp::Vector(-2,-2,-2));\ndc.setUpperBounds(vp::Vector(2,2,2));\ndc.setResolution(vp::Vector::Constant(vp::S(0.05)));\nvps::IndexedSurface surface = dc.compute(scene);\n\nvps::OFFExport off; \noff.exportSurface(\"surface.off\", surface);\n```\n\nThis produces the surface below. One of the big benefits of Dual Contouring  is that it naturally preserves sharp features.\n\n![Dual Contouring](etc/images/dualcontouring.png?raw=true)\n\n\n# References\n\nhttp://aka-san.halcy.de/distance_fields_prefinal.pdf\nhttp://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm\nhttp://www.ronaldperry.org/SIG2006Course_FriskenPerryDistFields.pdf\nhttp://cg.ibds.kit.edu/downloads/IntModelingSDF.pdf\nhttp://iquilezles.org/www/material/nvscene2008/rwwtt.pdf\nhttp://elib.uni-stuttgart.de/opus/volltexte/2010/5229/pdf/DIP_2970.pdf\nhttp://csokavar.hu/raytrace/imm6392.pdf\nhttp://9bitscience.blogspot.co.at/2013/07/raymarching-distance-fields_14.html\nhttp://www.arcsynthesis.org/gltut/Illumination/Tut12%20Monitors%20and%20Gamma.html\nhttp://www.cambridgeincolour.com/tutorials/gamma-correction.htm\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheind%2Fvolplay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcheind%2Fvolplay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheind%2Fvolplay/lists"}