Difference between revisions of "User:Caio/GSoC2023/FinalReport"

From BRL-CAD
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<h1>Final Report</h1>
 
<h1>Final Report</h1>
  
The main goal of this project is to add support for VDB in BRL-CAD. To achieve this goal, the open source C++ library called OpenVDB library was used and a VDB object is stored into a new primitive called vdb. In order to visualize the object, the necessary functions to ray trace a VDB object was added.
+
The main goal of this project is to add support for VDB in BRL-CAD. To achieve this goal, the open source C++ library called OpenVDB library was used and a VDB object is stored into a new primitive called vdb. In order to visualize the object, the necessary functions to ray trace a VDB object were added.
  
The final report presents how to load and render a VDB object, lists the functions and structures that were implemented and features that could be implemented in the future.
+
The final report presents how to load and render a VDB object, lists the functions and structures that were implemented and presents features that could be implemented in the future.
  
 
Branch: https://github.com/cjsb/brlcad/tree/vdb
 
Branch: https://github.com/cjsb/brlcad/tree/vdb
Line 9: Line 9:
 
<h2>Usage</h2>
 
<h2>Usage</h2>
  
To load a VDB object, the user must use the ''in'' command. After that, the user interface will ask for 3 information: 1) The name of the object; 2) The type of the object (The user must type ''vdb''); 3) The path for the VDB file.
+
To load a VDB object, the user must use the ''in'' command. After that, the user interface will ask for 3 pieces of information: 1) The name of the object; 2) The type of the object (The user must type ''vdb''); 3) The path for the VDB file.
  
 
The application ''mged'' was used to load and visualize a VDB object, as can be seen in the image below.
 
The application ''mged'' was used to load and visualize a VDB object, as can be seen in the image below.
  
[[File:MgedVDB.PNG]]
+
[[File:MgedVDBnew.PNG]]
  
 
Once the object is loaded, the bounding box of the object will appear in the preview interface. After that, the user can perform a ray tracing of the scene and the object will be renderer, as can be seen below.
 
Once the object is loaded, the bounding box of the object will appear in the preview interface. After that, the user can perform a ray tracing of the scene and the object will be renderer, as can be seen below.
Line 19: Line 19:
 
[[File:SphereVDB.png|300px]]
 
[[File:SphereVDB.png|300px]]
  
Note that the user must change the ''# of Processors'' to 1 in ''Advanced Settings'' since the parallel operations for VDB ray intersector is not implemented. Also, the vdb primitive support only ray tracing of level set VDB objects. Several samples can downloaded in the [https://www.openvdb.org/download/ OpenVDB website].
+
Note that the user must change the ''# of Processors'' to 1 in ''Advanced Settings'' since the parallel ray intersection of VDB ray is not implemented. Also, the vdb primitive supports only ray tracing of level-set VDB objects. Several samples can downloaded in the [https://www.openvdb.org/download/ OpenVDB website].
  
 
<h2>Implemented functions and structures</h2>
 
<h2>Implemented functions and structures</h2>
Line 25: Line 25:
  
 
* rt_vdb_internal: structure that stores the name of the VDB file and a pointer to the grid handle of the VDB object.
 
* rt_vdb_internal: structure that stores the name of the VDB file and a pointer to the grid handle of the VDB object.
* vdb_specific: structure that is prepared before the ray tracing and stores a pointer to the VDB grid.
+
* vdb_specific: structure that is prepared before the ray tracing. It stores a pointer to the VDB grid and stores the normal and world position of a hit.  
  
 
<h3>Functions</h3>
 
<h3>Functions</h3>
  
*A
+
* rt_vdb_plot: Plot VDB's bounding box
*B
+
* rt_vdb_import5: Import VDB from the database format to the internal structure.
 +
* rt_vdb_export5: Export VDB.
 +
* rt_vdb_bbox: Compute the VDB's bounding box (max and min points).
 +
* rt_vdb_prep: Prepare the data for the ray tracing.
 +
* rt_vdb_shot: Intersect a ray with a VDB.
 +
* rt_vdb_norm: Compute the normal if a ray intersects a VDB.
  
 
<h2>Results</h2>
 
<h2>Results</h2>
Several rendering of VDB objects can be found below.
+
Several renderings of VDB objects can be found below.
  
 
[[File:TorusVDB.png|450px]]  [[File:DragonVDB.png|450px]]
 
[[File:TorusVDB.png|450px]]  [[File:DragonVDB.png|450px]]
Line 39: Line 44:
 
[[File:BuddhaVDB.png|450px]] [[File:BunnyVDB.png|450px]]
 
[[File:BuddhaVDB.png|450px]] [[File:BunnyVDB.png|450px]]
  
Note that the red square is due the bounding box visualization.  
+
Note that the red square is due to the bounding box visualization.  
  
 
<h2>Future Work</h2>
 
<h2>Future Work</h2>
 
* Add support to Linux build.
 
* Add support to Linux build.
* Add support to different VDB scenes, being able to support VDB files with fully volumetric scenes and point cloud.
+
* Add support to different VDB scenes, being able to render VDB files with fully volumetric scenes and point cloud.
 
* Add support to multithreading in the ray tracing which would allow faster image generation.
 
* Add support to multithreading in the ray tracing which would allow faster image generation.
 
* Add support to load nanovdb file.
 
* Add support to load nanovdb file.
 +
 +
<h2>Final Remarks</h2>
 +
I think that the GSoC experience was great. I was able to contribute to BRL-CAD and also learn about OpenVDB which is an established library used in feature film production. I would like to thank BRL-CAD for the opportunity to do this project. And I also would like to thank my mentor and developers of BRL-CAD as they were always there to help me with any question or problem.

Latest revision as of 01:03, 7 October 2023

Final Report

The main goal of this project is to add support for VDB in BRL-CAD. To achieve this goal, the open source C++ library called OpenVDB library was used and a VDB object is stored into a new primitive called vdb. In order to visualize the object, the necessary functions to ray trace a VDB object were added.

The final report presents how to load and render a VDB object, lists the functions and structures that were implemented and presents features that could be implemented in the future.

Branch: https://github.com/cjsb/brlcad/tree/vdb

Usage

To load a VDB object, the user must use the in command. After that, the user interface will ask for 3 pieces of information: 1) The name of the object; 2) The type of the object (The user must type vdb); 3) The path for the VDB file.

The application mged was used to load and visualize a VDB object, as can be seen in the image below.

MgedVDBnew.PNG

Once the object is loaded, the bounding box of the object will appear in the preview interface. After that, the user can perform a ray tracing of the scene and the object will be renderer, as can be seen below.

SphereVDB.png

Note that the user must change the # of Processors to 1 in Advanced Settings since the parallel ray intersection of VDB ray is not implemented. Also, the vdb primitive supports only ray tracing of level-set VDB objects. Several samples can downloaded in the OpenVDB website.

Implemented functions and structures

Structures

  • rt_vdb_internal: structure that stores the name of the VDB file and a pointer to the grid handle of the VDB object.
  • vdb_specific: structure that is prepared before the ray tracing. It stores a pointer to the VDB grid and stores the normal and world position of a hit.

Functions

  • rt_vdb_plot: Plot VDB's bounding box
  • rt_vdb_import5: Import VDB from the database format to the internal structure.
  • rt_vdb_export5: Export VDB.
  • rt_vdb_bbox: Compute the VDB's bounding box (max and min points).
  • rt_vdb_prep: Prepare the data for the ray tracing.
  • rt_vdb_shot: Intersect a ray with a VDB.
  • rt_vdb_norm: Compute the normal if a ray intersects a VDB.

Results

Several renderings of VDB objects can be found below.

TorusVDB.png DragonVDB.png

BuddhaVDB.png BunnyVDB.png

Note that the red square is due to the bounding box visualization.

Future Work

  • Add support to Linux build.
  • Add support to different VDB scenes, being able to render VDB files with fully volumetric scenes and point cloud.
  • Add support to multithreading in the ray tracing which would allow faster image generation.
  • Add support to load nanovdb file.

Final Remarks

I think that the GSoC experience was great. I was able to contribute to BRL-CAD and also learn about OpenVDB which is an established library used in feature film production. I would like to thank BRL-CAD for the opportunity to do this project. And I also would like to thank my mentor and developers of BRL-CAD as they were always there to help me with any question or problem.