Stream: brlcad

Topic: VDB


view this post on Zulip Caio José Dos Santos Brito (Jul 27 2023 at 17:26):

Hi everyone, I did the first PR for the GSoC Project on VDB. It creates the basic structure to run a "make vdbName vdb". It is simple because it is the first one but I will add more once I have a feedback on that. =)

view this post on Zulip Himanshu (Jul 29 2023 at 16:18):

I went through your PR and got to know something. But still I have some doubt to clarify.

  1. I saw that magic number is used here. So we can assign to variables at runtime and then check if they have been modified or used before being initialized. Btw how it works? Or it helps during debugging?
  2. ID_MAX_SOLID count changed from 47 to 48. For addition of new command I guess?
  3. vect_t minBB; vect_t maxBB;: The minimum and maximum values of a bounding box represent the extreme points in the scene that enclose the object or objects it surrounds. The value it will hold can be change dynamically like according to the user choice or it will be fixed?
  4. #define RT_VDB_CK_MAGIC(_p) BU_CKMAG(_p, RT_VDB_INTERNAL_MAGIC, "rt_vdb_internal") Here _p is a pointer but what it's actual use here?

view this post on Zulip Caio José Dos Santos Brito (Jul 31 2023 at 18:30):

Let me try to answer it:

  1. I am not sure, honestly.
  2. Yes, now there is ID_VDB.
  3. The idea was to have a simple data structure to begin and understand how to make a primitive and how the data arrives at the ray tracing function. I just did an update on the PR and the ray tracing is able to compute the ray intersection with the bounding box. I think that now I will add the vdb on it. Instead of a bounding box it will have the information of a vdb file to render. =)
  4. p is pointer to an internal data, it will check if it is the correct data (it must be rt_vdb_internal).

view this post on Zulip Himanshu (Aug 01 2023 at 17:26):

@Caio José Dos Santos Brito What will be your next milestone? Btw your dev log is not up to date. You should update it so that I can get know how you are proceeding and I can learn from you too.

view this post on Zulip Caio José Dos Santos Brito (Aug 01 2023 at 21:27):

I updated the dev log and will adding more as I progress.
My idea is to learn how to render something using the data in the vdb data structure at the moment. I was thinking of rendering a normal value. Assuming that the bounding box is like a voxel that contains one normal ((1,0,0) for instance). Once a ray hits that voxel, the normal value would be the pixel color.
Once I have that, I will probably move to add an actual vdb on the data structure. Load from file and store in the rt_vdb_internal.
What do you think?

view this post on Zulip Himanshu (Aug 03 2023 at 07:52):

/**

view this post on Zulip Himanshu (Aug 03 2023 at 08:17):

@Caio José Dos Santos Brito What is the meaning of these two lines here?

MAT4X3PNT(eip->minBB, mat, &vec[0 * ELEMENTS_PER_VECT]);
MAT4X3VEC(eip->maxBB, mat, &vec[1 * ELEMENTS_PER_VECT]);

view this post on Zulip Himanshu (Aug 03 2023 at 08:19):

I found meaning of MAT4X3VEC: Apply a 4x4 matrix to a 3-tuple which is a relative Vector in space. and MAT4X3PNT: Apply a 4x4 matrix to a 3-tuple which is an absolute Point in space. Output and input points should be separate arrays. but does it actually do here?

view this post on Zulip Caio José Dos Santos Brito (Aug 03 2023 at 11:18):

Basically, it applies a transformation to the points. In reality, it does not do anything because the transformation matrix is an identity matrix (bn_mat_identity). I got that from the "rt_ell_import4" in ell.c code. I left there because it could be useful in the future when I am using a vdb.

view this post on Zulip Daniel Rossberg (Aug 03 2023 at 16:04):

Himanshu Sekhar Nayak said:

/**

https://brlcad.org/w/images/2/2d/BRL_CAD_g_format_V5.pdf

view this post on Zulip Daniel Rossberg (Aug 03 2023 at 16:05):

It's the current format of the .g files.

view this post on Zulip Daniel Rossberg (Aug 03 2023 at 16:41):

I have the impression, that VDB has something in common with a point cloud(?) I.e., you could look at the pnts primitive to get an idea of how to implement it for VDB.

view this post on Zulip Himanshu (Aug 16 2023 at 13:30):

@Caio José Dos Santos Brito What will be our next milestone?

view this post on Zulip Himanshu (Aug 17 2023 at 16:39):

Caio José Dos Santos Brito said:

I updated the dev log and will adding more as I progress.
My idea is to learn how to render something using the data in the vdb data structure at the moment. I was thinking of rendering a normal value. Assuming that the bounding box is like a voxel that contains one normal ((1,0,0) for instance). Once a ray hits that voxel, the normal value would be the pixel color.
Once I have that, I will probably move to add an actual vdb on the data structure. Load from file and store in the rt_vdb_internal.
What do you think?

So for now the ray is hitting the bounding box right. The next part will be hitting the vdb?

view this post on Zulip Daniel Rossberg (Aug 17 2023 at 18:49):

Hi Caio, what do you mean by "normal"? In geometry, and with this in BRL-CAD, the meaning is https://en.wikipedia.org/wiki/Normal_(geometry) The color is a different value.

view this post on Zulip Himanshu (Sep 17 2023 at 19:11):

@Caio José Dos Santos Brito btw I checked out your PR but it is leading me to build errors. Here which files I have include_directories().
modified: include/ged/CMakeLists.txt modified: src/librt/CMakeLists.txt
Here what I have added to CMakeLists.txt

include_directories(
  ${CMAKE_SOURCE_DIR}/src/other/openVDB/Release/openvdb
  ${CMAKE_SOURCE_DIR}/src/other/openVDB/Release/nanovdb
  ${CMAKE_SOURCE_DIR}/src/other/openVDB/Release/build/openvdb/openvdb/openvdb
  ${CMAKE_SOURCE_DIR}/src/other/openVDB/Release/build/openvdb/openvdb
)

view this post on Zulip Caio José Dos Santos Brito (Sep 17 2023 at 22:42):

it could be the lack of the openvdb lib. What is the error?

view this post on Zulip Himanshu (Sep 18 2023 at 06:56):

Caio José Dos Santos Brito said:

it could be the lack of the openvdb lib. What is the error?

Oops I missed that. Let me include it and rebuild it.

view this post on Zulip Daniel Rossberg (Sep 18 2023 at 17:56):

Hi @Caio José Dos Santos Brito, E.g., I'm seeing the compilation error

brlcad/src/librt/primitives/vdb/vdb.cpp:14:10: fatal error: openvdb/tools/LevelSetSphere.h: File or directory not found
   14 | #include "openvdb/tools/LevelSetSphere.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

with gcc on Linux (CMake generated build). I think, you should do the changes recommended by Himanshu.

view this post on Zulip Caio José Dos Santos Brito (Sep 19 2023 at 18:18):

Himanshu Sekhar Nayak said:

Caio José Dos Santos Brito said:

it could be the lack of the openvdb lib. What is the error?

Oops I missed that. Let me include it and rebuild it.

@Himanshu Sekhar Nayak I made a few adjustments and should be working in Release. The only thing that must be done manually is to copy the .dll files from src\other\openVDB\build\openvdb\openvdb\openvdb\Release to the correct place. I will fix that later but now you should be able to compile and run. =)

view this post on Zulip Caio José Dos Santos Brito (Sep 19 2023 at 22:36):

Does anyone know where can I change to copy the list of dll files?

view this post on Zulip Daniel Rossberg (Sep 20 2023 at 17:55):

A VDB build issue on Linux:

src/librt/primitives/vdb/vdb.c:259: error: ISO C forbids an empty translation unit [-Wpedantic]
make[2]: *** [src/librt/CMakeFiles/librt-obj.dir/build.make:2694: src/librt/CMakeFiles/librt-obj.dir/primitives/vdb/vdb.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:17823: src/librt/CMakeFiles/librt-obj.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

You have two empty/unused files in src/librt/primitives/vdb. You should remove them, if you don't need them.

view this post on Zulip Caio José Dos Santos Brito (Sep 20 2023 at 18:43):

Daniel Rossberg said:

A VDB build issue on Linux:

src/librt/primitives/vdb/vdb.c:259: error: ISO C forbids an empty translation unit [-Wpedantic]
make[2]: *** [src/librt/CMakeFiles/librt-obj.dir/build.make:2694: src/librt/CMakeFiles/librt-obj.dir/primitives/vdb/vdb.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:17823: src/librt/CMakeFiles/librt-obj.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

You have two empty/unused files in src/librt/primitives/vdb. You should remove them, if you don't need them.

Thank you for the explanation (On windows worked fine). I just removed the files and I will wait if there is any other problem.

view this post on Zulip Himanshu (Sep 22 2023 at 16:30):

I am getting librt.dll not found?
image.png

view this post on Zulip Himanshu (Sep 22 2023 at 16:32):

vdb branch
main branch

view this post on Zulip Himanshu (Sep 22 2023 at 16:33):

The vdb branch have more variables than main branch.

view this post on Zulip Himanshu (Sep 22 2023 at 16:36):

I switched to vdb branch and made sure main branch build is removed. Then cmake generates from vdb branch and then I went on to build brlcad. Then tried to openvdb and it is giving librt.dll not found. Am I missing something here? @Caio José Dos Santos Brito

view this post on Zulip Caio José Dos Santos Brito (Sep 22 2023 at 17:06):

Hi @Himanshu Sekhar Nayak, you need to copy that manually, I think I mentioned that before. The dll files are on src\other\openVDB\build\openvdb\openvdb\openvdb\Release . I will fix that later (to copy automatically) but you should be able to compile and run (after the copy and paste). =)

view this post on Zulip Himanshu (Sep 22 2023 at 17:08):

Caio José Dos Santos Brito said:

Hi Himanshu Sekhar Nayak, you need to copy that manually, I think I mentioned that before. The dll files are on src\other\openVDB\build\openvdb\openvdb\openvdb\Release . I will fix that later (to copy automatically) but you should be able to compile and run (after the copy and paste). =)

Oh... my bad. I thought your cmake config fixed that. No problem I will copy it.

view this post on Zulip Caio José Dos Santos Brito (Sep 22 2023 at 17:08):

you need to copy the dll files to build\Release\bin. To make sure it is the correct folder, you can check if the mged executable file is there too.

view this post on Zulip Caio José Dos Santos Brito (Sep 22 2023 at 17:13):

to create a vdb, you put "in", "name of the object that you want to create", "vdb", "path to vdb (relative to the database that is being used)"

view this post on Zulip Caio José Dos Santos Brito (Sep 22 2023 at 17:14):

you can download a few vdb files here https://www.openvdb.org/download/
you can test with any object that is a level set (bunny, dragon, astronaut....). To visualize you run the ray tracing =)

view this post on Zulip Himanshu (Sep 22 2023 at 17:16):

Okay, I started recompiling it after I copied those dll files into build\Release\bin. I am eager to test it.

view this post on Zulip Himanshu (Sep 22 2023 at 19:18):

394>C:\Users\Himanshu\Desktop\Workspace\brlcadBuild\Debug\bin\librt.dll : fatal error LNK1120: 6 unresolved externals
394>Done building project "librt.vcxproj" -- FAILED.

view this post on Zulip Himanshu (Sep 22 2023 at 19:20):

Why librt.dll is failing here? Switching to VDB branch and making sure all the dll file present in C:\Users\Himanshu\Desktop\Workspace\brlcadBuild\Debug\bin @Caio José Dos Santos Brito

view this post on Zulip Caio José Dos Santos Brito (Sep 22 2023 at 19:31):

The dll should not be a problem with the build. Normally it is only asked when it is running the code. What is that link error? Which function? Which file? It could try in Release to check if it has the same issue.

view this post on Zulip Himanshu (Sep 24 2023 at 15:55):

Caio José Dos Santos Brito said:

The dll should not be a problem with the build. Normally it is only asked when it is running the code. What is that link error? Which function? Which file? It could try in Release to check if it has the same issue.

I copied those dll files to brlcadBuild\Debug\bin because mged executable is there. @Caio José Dos Santos Brito

view this post on Zulip Caio José Dos Santos Brito (Sep 24 2023 at 16:05):

Hi @Himanshu Sekhar Nayak , great! That is a post build step. I am assuming that you were able to compile and run mged, since you sent the picture that the dll was missing. Now you just copy the dll to the folder and run it again, there is no need to compile everything again.

view this post on Zulip Himanshu (Sep 24 2023 at 16:09):

Caio José Dos Santos Brito said:

Hi Himanshu Sekhar Nayak , great! That is a post build step. I am assuming that you were able to compile and run mged, since you sent the picture that the dll was missing. Now you just copy the dll to the folder and run it again, there is no need to compile everything again.

Oh.. that's why it is creating an issue. I am recompiling it which is creating this issue.

view this post on Zulip Daniel Rossberg (Sep 24 2023 at 19:36):

Just for your information:
Just saw that openVDB is C++17 but brlcad is C++ 14 (line 353 in its main CMakeLists.txt). This can probably be easily solved, but then I get a bunch of error: declaration of ‘grid’ shadows a previous local [-Werror=shadow] with lines 430 ff in src/other/openVDB/nanovdb/nanovdb/util/IO.h.

I.e., it looks like the integration of openVDB in the brlcad build won't be trivial.

view this post on Zulip Caio José Dos Santos Brito (Sep 25 2023 at 02:42):

I changed the c++ version in the projects that use openVDB (libged and librt, If I'm not mistaken). I am not sure why you are getting this error. I created a solution from scratch and only these projects had the c++ changed and it worked fine.

view this post on Zulip Himanshu (Sep 25 2023 at 18:00):

I build vdb in Release mode but there is no mged executable in brlcadBuild\Release\bin. I made sure I started from scratch from configuring cmake for vdb branch. @Caio José Dos Santos Brito

view this post on Zulip Caio José Dos Santos Brito (Sep 25 2023 at 19:06):

Himanshu Sekhar Nayak said:

I build vdb in Release mode but there is no mged executable in brlcadBuild\Release\bin. I made sure I started from scratch from configuring cmake for vdb branch. Caio José Dos Santos Brito

Hi, I have no clue. Did you compile the code? It should be there.

view this post on Zulip Caio José Dos Santos Brito (Sep 25 2023 at 19:07):

Himanshu Sekhar Nayak said:

I am getting librt.dll not found?
image.png

How did you get that? You should do the same but with the vdb branch.

view this post on Zulip Himanshu (Oct 07 2023 at 05:34):

@Sean @Daniel Rossberg @Erik @Caio José Dos Santos Brito Our first bunny vdb. This one is build in Release mode.
Screenshot-139.png

view this post on Zulip Caio José Dos Santos Brito (Oct 07 2023 at 05:41):

Glad you were able to run. =) I will be finishing the final report tomorrow.

view this post on Zulip Caio José Dos Santos Brito (Oct 07 2023 at 05:42):

if anyone want to check what I implemented and a few more results: https://brlcad.org/wiki/User:Caio/GSoC2023/FinalReport

view this post on Zulip Sean (Oct 07 2023 at 14:09):

That is looking great! Outstanding work @Caio José Dos Santos Brito ... taking a look over your final report

view this post on Zulip Sean (Oct 07 2023 at 14:13):

Did you happen to implement UV support (that would be the rt_vdb_uv() callback)? What gaps remain in the implementation? I assume there's no adjust support (rt_vdb_adjust())? What about plot and tess?

view this post on Zulip Sean (Oct 07 2023 at 14:13):

That's not all in scope of what you were going for, more curious what all you were able to accomplish, if you got some of them

view this post on Zulip Caio José Dos Santos Brito (Oct 07 2023 at 17:33):

Thank you, @Sean . I was a fun project and a great experience. Regarding your questions, there is no support to UV, adjust, tess. I have seen some people adding a uv grid on top of the but it is not a direct use of the OpenVDB library. I implemented the plot function as showing the bounding box of the vdb object.

view this post on Zulip Caio José Dos Santos Brito (Oct 07 2023 at 17:35):

In terms of gaps in the implementation, the main thing would be to give support to different types of vdb objects. I focused on levelset objects but vdb also supports fully volumetric objects and points clouds.

view this post on Zulip Caio José Dos Santos Brito (Oct 07 2023 at 20:38):

Btw, I just did the upload of the final evaluation! =)


Last updated: Oct 09 2024 at 00:44 UTC