princeton-vl / infinigen

Infinite Photorealistic Worlds using Procedural Generation
https://infinigen.org
BSD 3-Clause "New" or "Revised" License
5.32k stars 455 forks source link

scatter: BlenderRockFactory has no vertices. #108

Closed Inshsang closed 1 year ago

Inshsang commented 1 year ago

Describe the feature you would like to see implemented Scatter: BlenderRockFactory has no vertices. It cannot be exported, but it will be rendered in the image. Is there a way to export Scatter: BlenderRockFactory as a PLY file?

Inshsang commented 1 year ago

polycounts.txt in 'fine' include animhelper: 0 assets: 80,752 assets:BlenderRockFactory(27855): 62 assets:BushFactory(36234574).twigs: 39,046 assets:BushFactory(543568399).twigs: 34,070 assets:GenericTreeFactory(60608): 7,574 assets:TreeFlowerFactory(36234574): 0 assets:TreeFlowerFactory(543568399): 0 CameraRigs: 0 Collection: 335,768 colliders: 7,060 particleassets: 0 particles: 0 placeholders: 78 placeholders:BushFactory(36234574): 30 placeholders:BushFactory(543568399): 24 placeholders:CactusFactory(1375975078): 6 placeholders:CactusFactory(36234574): 18 placeholders:CactusFactory(543568399): 0 scatter: 0 scatters: 0 terrain: 2,480,133 unique_assets: 2,630,663 unique_assets:BushFactory(36234574): 0 unique_assets:BushFactory(543568399): 2,060 unique_assets:CactusFactory(1375975078): 629,296 unique_assets:CactusFactory(36234574): 1,999,307 unique_assets:CactusFactory(543568399): 0 Faces:2,547,659Tris:2,973,680Objects:0/50Memory: 698.9 MiB3.3.1

araistrick commented 1 year ago

Hello! This is a great question.

All objects prefixed with "scatter:" (most small objects like rocks, small plants, etc --- and some others, like tree twigs) use Blender's built-in instancing (https://docs.blender.org/manual/en/latest/modeling/geometry_nodes/instances/instance_on_points.html), that is, they have 5-20 unique underlying objects (with real underlying meshes with real vertices stored in the corresponding assets:BlenderRockFactory collection) which are re-used with thousands to millions of different rigid transforms.

This is very common in Blender, and very important for memory cost, as having thousands and thousands of unique highpoly rocks in memory would be very expensive (often impossible), but having a few real ones and many re-uses lets us make complex cluttered scene, and we think is diverse enough as the underlying meshes arent reused across scenes or anything. It is certainly a limitation of the system that is not currently well documented enough, though.

You have a few options RE exporting:

Sorry for this being so tricky. We do intend to find a good solution. Ultimately the problem here is that transferable file formats / file format exporters have not kept sufficient pace with what can be represented in a scene. Many things (procedural graphs, procedural shaders, instanced geometry, blender hair) can be represented by a .blend, but cannot easily be exported to any software-independent file format, and many of the solutions above essentially involve creating your own file format. We made our own numpy file format to transfer data to the OpenGL ground truth code, but this places the burden onto you as a programmer to write an importer from this file format into whatever your downstream application is.

Hope this helps, if you are able to say what your downstream application to import the PLYs into that would be helpful. @David-Yan1 may also be able to help, as he has worked on exporting instanced geometry.

Cheers.

chuong commented 1 year ago

@araistrick Could please point to the savemesh solution by @lahavlipson? I could not find it anywhere.

araistrick commented 1 year ago

@chuong if you run manage_datagen_jobs with the opengl_gt.gin config, a step will run named 'save_mesh' which executes core.py's save_meshes function and dumps many npy files to output_folder/seed/savemeshXXXX