All Projects → mlavik1 → Unityvolumerendering

mlavik1 / Unityvolumerendering

Licence: mit
Volume rendering, implemented in Unity3D.

Projects that are alternatives of or similar to Unityvolumerendering

Holoshield
Highly customizable sci-fi shield / force field shader for Unity3D. Allows you to set edge power & color, inner texture scrolling, waviness, scale pulsation and procedural intensity noise. Implements tessellation for low-poly base meshes.
Stars: ✭ 401 (+293.14%)
Mutual labels:  unity, unity3d, shaders
Texturepanner
This repository hosts a shader for Unity3D whose main goal is to facilitate the creation of neon-like signs, conveyor belts and basically whatever based on scrolling textures
Stars: ✭ 528 (+417.65%)
Mutual labels:  unity, unity3d, shaders
Verticaldissolve
Procedural vertical dissolve shader. Highly customizable. Tweak edge color, noisiness & waviness, rim light, emission scrolling and more.
Stars: ✭ 434 (+325.49%)
Mutual labels:  unity, unity3d, shaders
Unity3dcrosssectionshader
CG shader for unity3D to create a cross section through meshes
Stars: ✭ 333 (+226.47%)
Mutual labels:  unity, unity3d, shaders
Unity Shader Resources List
📋 Unity Shader相关学习资源与链接珍藏 | A list of amazing resources for learning shader writing in Unity.
Stars: ✭ 98 (-3.92%)
Mutual labels:  unity, shaders, computer-graphics
Unity Shadersketches
Sketches made with ShaderLab in Unity.
Stars: ✭ 362 (+254.9%)
Mutual labels:  unity, unity3d, shaders
Unity Shadergraph Sandbox
✏️ Collection of ShaderGraph examples for Unity.
Stars: ✭ 525 (+414.71%)
Mutual labels:  unity, unity3d, shaders
Alloy
Alloy physical shader framework for Unity.
Stars: ✭ 244 (+139.22%)
Mutual labels:  unity, unity3d, shaders
Shadergraph Custom Nodes
🔨 Collection of custom nodes for ShaderGraph.
Stars: ✭ 53 (-48.04%)
Mutual labels:  unity, unity3d, shaders
Radialprogressbar
Customizable radial progress bar shader for Unity3D. Allows you to set arc range, minimum and maximum colors, textures, radius, and a few more things. Create HP Bars, Speedometers, rank progress, etc!
Stars: ✭ 714 (+600%)
Mutual labels:  unity, unity3d, shaders
Spheredissolve
Customizable procedural spherical dissolve shader for Unity3D, for all your customizable procedural spherical dissolve needs!
Stars: ✭ 311 (+204.9%)
Mutual labels:  unity, unity3d, shaders
3dxrayshader unity
Surface shader. Clips a Model with given plane , applies fresnel on clipped part and highlights the cross section.
Stars: ✭ 73 (-28.43%)
Mutual labels:  unity, unity3d, shaders
Unity Script Collection
A maintained collection of useful & free unity scripts / library's / plugins and extensions
Stars: ✭ 3,640 (+3468.63%)
Mutual labels:  unity, unity3d, shaders
Unity Wireframe
General purpose wireframe shaders for use in Unity.
Stars: ✭ 378 (+270.59%)
Mutual labels:  unity, unity3d, shaders
Cloner
An example of use of procedural instancing.
Stars: ✭ 260 (+154.9%)
Mutual labels:  unity, unity3d, shaders
Unity Frosted Glass
❄️ Test of a frosted glass material in Unity.
Stars: ✭ 506 (+396.08%)
Mutual labels:  unity, unity3d, shaders
Ssrt
Real-time indirect diffuse illuminaton using screen-space information for Unity.
Stars: ✭ 176 (+72.55%)
Mutual labels:  unity, unity3d, shaders
Unity Shaders
✨ Shader demo - More than 300 examples
Stars: ✭ 198 (+94.12%)
Mutual labels:  unity, unity3d, shaders
Hologramshader
✏️ Test of an hologram material made in Unity.
Stars: ✭ 684 (+570.59%)
Mutual labels:  unity, unity3d, shaders
3d Game Shaders For Beginners
🎮 A step-by-step guide to implementing SSAO, depth of field, lighting, normal mapping, and more for your 3D game.
Stars: ✭ 11,698 (+11368.63%)
Mutual labels:  unity, unity3d, shaders

UnityVolumeRendering

A volume renderer, made in Unity3D. I have written a tutorial explaining the basic implementation. Have any questions? Find my contact info here.

I also have a tutorial video that shows how to use the project

alt tag

Requirements:

  • Unity 2018 1.5 or newer (should also work with some older 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

Step-by-step instructions

1. Import model

Raw datasets:

In the menu bar, click "Volume Rendering" and "Load raw dataset"

Then select the dataset you wish to import. Currently only raw datasets are supported (you can add your own importer for other datasets).

In the next menu you can optionally set the import setting for the raw dataset. For the sample files you don't need to change anything.

DICOM:

To import a DICOM dataset, click "Volume Rendering" and "Load DICOM" and select the folder containing your DICOM files. The dataset must be of 3D nature, and contain several files - each being a slice along the Z axis.

2. Moving the model

You can move the model like any other GameObject. Simply select it in the scene view or scene hierarchy, and move/rotate it like normal.

3. Changing the visualisation

Select the model and find the "Volume Render Object" in the inspector.

Here you can change the "Render mode":

Example:

There are 3 render modes:

  • Direct Volume Rendering (using transfer functions)
  • Maximum Intensity Projection (shows the maximum density)
  • Isosurface Rendering

Direct Volume Rendering

Direct volume rendering is the most standard rendering mode. It sends rays through the dataset, and uses "transfer functions" (1D or 2D) to determine the colour and opacity. Transfer functions map density (2D: also gradient magnitude) to a colour and opacity.

  • 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).

Isosurface Rendering

Isosurface rendering draws the first thing the ray hits, with a density higher than some threshold. You can set this threshold yourself, by selecting the object and changing the "Visible value range" in the inspector. These can also be used with direct volume rendering mode.

(VR) performance

Since VR requires two cameras to render each frame, you can expect worse performance. However, you can improve the FPS in two ways:

  • Open DirectVolumeRenderingShader.shader and reduce the value of NUM_STEPS inthe frag_dvr function. This will sacrifice quality for performance.
  • Disable the DEPTHWRITE_ON shader variant. You can do this from code, or just remove the line "#pragma multi_compile DEPTHWRITE_ON DEPTHWRITE_OFF" in DirectVolumeRenderingShader.shader. Note: this will remove depth writing, so you won't be able to intersect multiple datasets.

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); (alternatively, use the DICOMImporter)
  • 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.

Explanation of the raw dataset importer:

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.

All this info can be added to a ".ini"-file, which the importer will use (if it finds any). See the sample files (in the "DataFiles" folder for an example).

Todo:

  • 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

See ACKNOWLEDGEMENTS.txt for libraries used by this project.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].