maximeraafat / BlenderNeRF

Easy NeRF synthetic dataset creation within Blender
MIT License
719 stars 43 forks source link

Request: Support creation of 3DGS datasets #36

Open murcje opened 3 weeks ago

murcje commented 3 weeks ago

Hi,

Thank you for your work! Title says it all. I believe it is possible to convert the exports from BlenderNerf to 3DGS but it lacks a pointcloud export atm. And I have had no luck with exporting these manually in a way so that they are compatible with a 3dgs dataset.

Thanks!

maximeraafat commented 3 weeks ago

Hi @murcje,

Thanks for your question! I have currently little time and haven't had many chances to play with 3DGS. As soon as I will though, I will consider adding a feature to export an additional point cloud.

In the meanwhile, you can export a point cloud from a mesh manually by sampling points from the surface in the geometry nodes tab (see the screenshot below: the points to vertices node is optional, depending on the export format). If you have multiple meshes, it is probably easier if you join them into a single mesh first. Feel free to play with the distribution density to get the number of points that you want.

Hope this helps!

Screenshot 2024-06-07 at 20 46 44
murcje commented 3 weeks ago

Thank you for you rquick reply! I tried the above, it works, but also does not work fully. It needs rgba values for each point.

But I can figure this one out myself I think. Would not want to waste your time with helping me use Blender.

Cheers!

maximeraafat commented 3 weeks ago

Hi @murcje,

You can set the colours of each point in the shader editor by creating a very simple material with an arbitrary diffuse colour. Then apply the material to the points in the geometry nodes setup with the Set Material node as last node before the geometry group output.

From my experience with previous point-based reconstruction methods, 3DGS shouldn't care too much about the colour each point has been initialised with, since it will optimise these anyways. The geometry prior however provided with the point initialisation is usually of far greater importance.

Let me know if you encounter any issues setting up the colours!

murcje commented 2 weeks ago

Hi @maximeraafat,

I have a working solution, thanks to your help and ChatGPT!

Here's my workflow, maybe it is helpful in creating an add-on, or just for somebody looking for a way to create 3DGS from Blender scenes:

  1. Have your scene setup with multiple cameras, mine is usually a sphere array.
  2. Import your object and light it to taste.
  3. Join all objects into one (ctrl-j).
  4. Copy the new object and create a new geometry node for that.
  5. Add a Mesh to Points node in between the in and output.
  6. Run the following script to export a cameras.txt images.txt and points3D.txt along with a render from each camera.

script.txt

maximeraafat commented 1 week ago

Thanks @murcje for sharing! I will consider adding the feature based on your workflow :)