Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DIfferences of create_asset and create_placeholder? #319

Open
GCChen97 opened this issue Sep 9, 2024 · 2 comments
Open

DIfferences of create_asset and create_placeholder? #319

GCChen97 opened this issue Sep 9, 2024 · 2 comments
Assignees
Labels
question Further information is requested

Comments

@GCChen97
Copy link
Contributor

GCChen97 commented Sep 9, 2024

Hi, I am trying to make my own object factory. I've managed to add some simple primitives like cube and cylinder and etc.

Currently, I just use butil.spawn_XXX to override create_asset and create_pholder of AssetFactory. Before adding rotation to the object, I want to know more about the methods of AssetFactory like create_placeholder,create_asset, spawn_asset and spawn_placeholder. I have a few questions:

  1. What are the differences of these functions? Are the placeholders used for collision detection?
  2. Can I directly apply rotation on the assets
  3. Are there any suggestions on overriding these functions? (Such use simple meshes for holders)

Thanks!!!

@GCChen97 GCChen97 added the question Further information is requested label Sep 9, 2024
@araistrick
Copy link
Contributor

araistrick commented Sep 21, 2024

What are the differences of these functions? Are the placeholders used for collision detection?

the result of create_placeholder is generally used for layout, simulations and motion planning, e.g. indoors solver collision checking, camera collision checking, fluid simulation, particle sims. Anything expensive like this uses a low poly proxy if available.

We also place scatters (moss, mushrooms, etc) ontop of the placeholder, rather than the asset mesh, because in some settings of the project we used to let the asset mesh be swapped out between different detail levels as the camera moved.

in the current nature code, placeholders are placed globally, wheras create_asset is only called for visible areas of the scene. So there may be many hundred placeholders generated but only a couple of visible trees.

Create asset is intended to convert a placeholder into an asset that is suitable to be rendered and shown to the user.

Can I directly apply rotation on the assets

Could you clarify what you want to achieve? By default the API expects you to specify rotation either by passing in the rot=(eulerx, y,z) argument, or by recieving the obj then assigning obj.rotation_euler.

Are there any suggestions on overriding these functions? (Such use simple meshes for holders)

RE overriding, you can return any bpy.types.Object you think is appropriate. There are some additional requirements we assume of the object returned, which you can check via adding it to the tests/assets/list_nature_meshes.txt unit test list, then running pytest -k MyAsset, or by reading the corresponding test file.

@araistrick araistrick self-assigned this Sep 21, 2024
@GCChen97
Copy link
Contributor Author

Thanks! For the second question, I mean could I add some rotations to the objects before they were returned in the create_placeholder or create_asset? Because I don't know if the collision check of infinigen can address non-axis-aligned objects correctly. Besides, I also want to know if infinigen does collision check with meshes of the objects rather than their convex hulls which might be generated in create_placeholder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants