maximeraafat / BlenderNeRF

Easy NeRF synthetic dataset creation within Blender
MIT License
769 stars 47 forks source link

BlenderNeRF Camera not found #29

Closed RussRobin closed 9 months ago

RussRobin commented 10 months ago

Hi, thank you for this meaningful tool.

I tried to render .blender models with BlenderNerf and it works well. However, when I made some modifications on the model (e.g. rotation of a part of it), I encounter errors: sphere_camera = scene.objects[CAMERA_NAME] KeyError: 'bpy_prop_collection[key]: key 'BlenderNeRF Camera' not found'

May you please look into it? Thank you in advance.

maximeraafat commented 10 months ago

Hi @RussRobin, thanks for your interest in BlenderNeRF and for your patience.

Hmm this is strange, the BlenderNeRF Camera should automatically be created if it has not already been with the corresponding preview button. May I ask you to describe the exact steps you followed in order to replicate the encountered error? If you could share a toy .blend file with the issue, that would also be very helpful!

RussRobin commented 10 months ago

Hi @maximeraafat , thank you for your timely reply.

The .blend file is uploaded here: https://drive.google.com/file/d/1ruYWhWqZXZIHbOsQVCQqetm62LBZWvub/view?usp=share_link

The error message goes like: 612B30E16769B0DD1B891C860F31D578

Thank you again for your wonderful project and reply.

maximeraafat commented 10 months ago

Thanks for sharing the file! Interesting, it seems like you somehow managed to invert the behaviour of the BlenderNeRF Camera. In your situation, the camera is only visible when the corresponding preview button is unselected, which breaks the functionality of the COS method.

But no worries, there is a simple fix. First, enable the BlenderNeRF Camera by unselecting the corresponding preview button. Once the camera is visible in your scene, enter the following command in the Blender python console

bpy.data.objects.remove(bpy.data.objects['BlenderNeRF Camera'], do_unlink=True)

That should solve the issue, the preview and PLAY COS buttons should again behave as expected. Let me know whether you encounter any further issues!

RussRobin commented 9 months ago

Thank you for your help, the problem has been solved for me!

maximeraafat commented 9 months ago

Glad I could be of help