-
Notifications
You must be signed in to change notification settings - Fork 447
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
entity sampler repeating first object sample #38
Comments
Thanks for providing the config file. The entity sampler only samples one new rotation and does not create several rotations per key frame. The suggested way of getting several different rotations is for now starting the BlenderProc process several times. Does this answer your question? |
thanks, yes this answers my question! |
There is, if you already have the whole movement, you can set each frame with functions like these: BlenderProc/src/object/ObjectPoseSampler.py Lines 127 to 128 in 48ddfee
Where If you only have the first point and the end point, you can use blenders automatic interpolation, by only setting the first point and end point via the functions above. Does this answer the question? PS: We will add a module to change the position of objects based on files. Thanks for the idea. |
going to try this out!, I will let you know if this solves my problem |
on my desktop (ubuntu 20.04) i ran into a installation issue where skimage was not detected. general_required_packages = ["pyyaml==5.1.2", "Sphinx==1.6.5", "scikit-image"] for the object pose sampling i ran into the same problem that only one pose is sampled and this is expected since only one keyframe is inserted in object pose sampling? so for my purpose of rotating the model i should create a copy of ObjectPoseSampler where i overwrite the insert_key_frames method?
|
Your solution works, but is not the desired one, you should have added it to the packages used in the setup: "setup": {
"blender_install_path": "/home_local/<env:USER>/blender/",
"pip": [
"h5py",
"scikit-image"
]
}, Many examples do this already, check them for reference. For your purpose, you need to create a new modul, which sets the |
Made a simple rotate module that is able to rotate the object, however still the first rotation is repeated even though i insert keyframes. import bpy
from src.main.Module import Module
from src.utility.BlenderUtility import get_all_mesh_objects
class ObjectOriginRotater(Module):
"""
Example 1: rotate model around origin
{
"module": "object.ObjectOriginRotater",
"config":{
"num_frames": 1000,
"objects_to_sample": {
"provider": "getter.Entity",
},
"rot_sampler": {
"provider": "sampler.Uniform3d",
"max": [0,0,0],
"min": [6.28,6.28,6.28]
}
}
}
.. csv-table::
:header: "Parameter", "Description"
"objects_to_sample", "Here call an appropriate Provider (Getter) in order to select objects. Type: Provider. "
"Default: all mesh objects."
"num_frames", "number of keyframes"
"rot_sampler", "Here call an appropriate Provider (Sampler) in order to sample rotation (Euler angles 3d "
"vector) for each object. Type: Provider."
"""
def __init__(self, config):
Module.__init__(self, config)
def run(self):
num_frames = self.config.get_int("num_frames", 1000)
objects = self.config.get_list("objects_to_sample", get_all_mesh_objects())
# for every selected object
for obj in objects:
if obj.type == "MESH":
print("Trying to put ", obj.name)
for i in range(num_frames):
rotation = self.config.get_vector3d("rot_sampler")
obj.location = (0, 0, 0)
obj.rotation_euler = rotation
obj.keyframe_insert(data_path='location', frame=i+1)
obj.keyframe_insert(data_path='rotation_euler', frame=i+1)
|
I am not sure what happens if min is bigger than max. Did you print the rotations? |
oops, yes i printed rotations and they were different
|
So I tested your code and I only found a minor bug: obj.keyframe_insert(data_path='location', frame=i)
obj.keyframe_insert(data_path='rotation_euler', frame=i) For me it is working, I am not sure what your setup is, but copy pasting your code worked for me. |
One addition: |
@Kevin-Delnoije Have you been able to fix it? |
it is working now! |
the entity sampler correctly outputs the image where model has correct rotations, however the rotations sampled during the first frame are repeated and each rendered image is exactly the same (0.hdf5, 1.hdf5 ......)
i have no idea why this is happening the config used for generating the data is here:
The text was updated successfully, but these errors were encountered: