Volume rendering, implemented in Unity3D. Want to support my project? Donate some money to Red Cross and send me a screenshot/message/issue, and I'll be greatly motivated! :) Any amount is welcome!
Перейти к файлу
Matias Lavik 075a9a2865 Improved the slice rendering window: Added support for moving slice by clicking and dragging mouse. Added more descriptions. Added support for showing more than one slice rendering window. 2019-05-12 16:01:05 +02:00
Assets Improved the slice rendering window: Added support for moving slice by clicking and dragging mouse. Added more descriptions. Added support for showing more than one slice rendering window. 2019-05-12 16:01:05 +02:00
DataFiles Initial commit (currently only works in scene view) 2019-02-11 18:22:12 +01:00
Packages Initial commit (currently only works in scene view) 2019-02-11 18:22:12 +01:00
ProjectSettings Initial commit (currently only works in scene view) 2019-02-11 18:22:12 +01:00
Screenshots Add files via upload 2019-04-05 10:35:10 +02:00
.gitignore Initial commit 2019-02-11 17:16:36 +01:00
CONTRIBUTING.md Create CONTRIBUTING.md 2019-04-04 19:49:14 +02:00
LICENSE Initial commit 2019-02-11 17:16:36 +01:00
README.md Update README.md 2019-04-05 10:35:59 +02:00

README.md

UnityVolumeRendering

A volume renderer, made in Unity3D. See slides from presentation here: https://speakerdeck.com/mlavik1/volume-rendering-in-unity3d

alt tag

Requirements:

  • Unity 2018 1.5 (should also work with other versions, but I haven't tested)

How to use sample scene

  • Open "TestScene.unity"
  • Click "Volume Rendering" in the menu bar
  • Select "Load Asset"
  • Pick a file in the "DataFiles" folder (I recommend manix.dat)
  • Click the "import"-button

How to use in your own project

  • Create an instance of an importer (for example RawDatasetImporter):
    DatasetImporterBase importer = new RawDatasetImporter(fileToImport, dimX, dimY, dimZ, DataContentFormat.Int16, 6);
  • Call the Import()-function, which returns a Dataset:
    VolumeDataset dataset = importer.Import();
  • Use VolumeObjectFactory to create an object from the dataset:
    VolumeRenderedObject obj = VolumeObjectFactory.CreateObject(dataset);

See "DatasetImporterEditorWIndow.cs" for an example.

How to change the visualisation

  • Changing rendering mode: Select the object, find "Volume Rendered Object" in the inspector and expand the "Render mode" dropdown.
  • Modifying transfer functions: Click "Volume Rendering" in the menu bar and select "1D Transfer Function" or "2D Transfer Function"
    • 1D Transfer Function: X-axis represents density and Y-axis represents alpha (opaccity). Move the grey alpha knots to create a curve for opacity by density. Right-click to add new alpha knots. The bottom gradient-coloured panel maps colour to density. Right-click to add new knots and click on an existing colour knot to modify its colour.
    • 2D Transfer Function: X-axis represents density and Y-axis represents gradient magnitude. Click "add rectangle" to add a new rectangle-shape. Move the four sliders (bottom left) to modify size/position. Modify the two sliders to the right to change min/max alpha/opacity. Each rectangle can have one colour (see colour picker).

Note:

THe RawDatasetImporter imports raw datasets, where the data is stored sequentially. Some raw datasets contain a header where you can read information about how the data is stored (content format, dimension, etc.), while some datasets expect you to know the layout and format. The importer takes the following parameters:

  • filePath: Filepath of the dataset
  • dimX: X-dimension (number of samples in the X-axis)
  • dimY: Y-dimension
  • dimZ: Z-dimension
  • contentFormat: Value type of the data (Int8, Uint8, Int16, Uint16, etc..)
  • skipBytes: Number of bytes to skip (offset to where the data begins). This is usually the same as the header size, and will be 0 if there is no header.

Todo:

  • DICOM support
  • Improve 2D Transfer Function editor: Better GUI, more shapes (triangles)
  • Optimise histogram generation
  • Support very large datasets (currently we naively try to create 3D textures with the same dimension as the data)

alt tag alt tag alt tag alt tag alt tag alt tag alt tag