bsavery / BlenderPythonRenderer

A Python GPU renderer for Blender using the Taichi package
MIT License
105 stars 7 forks source link

Taichi not installing automatically with addon install in Blender v3.0 #24

Open codesavory opened 2 years ago

codesavory commented 2 years ago

Traceback (most recent call last): File "C:\Program Files\Blender Foundation\Blender 3.0\3.0\scripts\modules\addon_utils.py", line 351, in enable mod = __import__(module_name) File "C:\Users\surya\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\BlenderPythonRenderer-main\__init__.py", line 1, in <module> from . import engine File "C:\Users\surya\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\BlenderPythonRenderer-main\engine.py", line 3, in <module> from .render.render import Render File "C:\Users\surya\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\BlenderPythonRenderer-main\render\render.py", line 1, in <module> from .scene import Scene File "C:\Users\surya\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\BlenderPythonRenderer-main\render\scene.py", line 1, in <module> from .mesh import MeshCache File "C:\Users\surya\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\BlenderPythonRenderer-main\render\mesh.py", line 1, in <module> import taichi as ti ModuleNotFoundError: No module named 'taichi'

I am trying to install the addon as a standalone zip into Blender v3.0. But I am getting the error, taichi not found. I suppose this can be solved by externally installing taichi, but you mentioned that it would be installed automatically.

Secondly, I would like to support the project and want to setup a symlink to the git repo as an addon. Do you think you could add the instructions for the same or point to relevant resources. Thank you, and amazing project!

bsavery commented 2 years ago

So this code: https://github.com/bsavery/BlenderPythonRenderer/blob/7a95a1a7bfe631ce04b00149b386564a89516089/__init__.py#L18

Should be installing taichi automatically. Looking at it now though. It might be calling that AFTER the engine is imported (which then calls import taichi). Should be pretty easy to fix.

Secondly, yeah you can do this two ways with developing and running the add-on.

  1. Git clone the repo here to your blender add-on directory. Probably not the best idea but it would work.
  2. Doing a symlink like you said. I know they can be more complicated than they need to be on windows but generally I think you'd do: mklink /D "C:\Users\<MYNAME>\Documents\GitHub\BlenderPythonRenderer" "C:\Users\<MYNAME>\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\BlenderPythonRenderer" Substituting MYNAME for you user name and wherever you actually cloned the git repo. On linux of Mac you doln -s`.
    1. I also know its possible to set the "scripts" directory in your blender preferences to point to the GitHub directory.
    2. There's actually some way you can run blender from the command line and load a script / add-on, perhaps I should add a command line script to do that?
bsavery commented 2 years ago

Also let me know where you're interested to contribute. I have a few things I'm hoping to wrap up today to really increase the speed of renders, but working on lights, materials would be helpful.

codesavory commented 2 years ago

Sure, I would love to contribute to lighting and materials, that's where my interest and specialization lies. Let me know if there is anything specific you would like me to look into - bugs or enhancements. Looking to set aside 20% of my time on this. Note - Yet to set the code base workflow and walk through the code, but I think I can pick it up on the go. Looking forward!

codesavory commented 2 years ago

Alright, got everything setup, it was a lot more challenging than expected. I wanted to share them here for windows -

  1. To setup a symlink -

    • mklink [options] <Link> <Target>. Target is the file/folder that exists, and Link is the created one that links to the target.
    • In our example, the locations needs to be reversed - mklink /D "C:\Users\<MYNAME>\AppData\Roaming\Blender Foundation\Blender\3.0\scripts\addons\BlenderPythonRenderer" "C:\Users\<MYNAME>\Documents\GitHub\BlenderPythonRenderer". Substituting MYNAME for you user name and wherever you actually cloned the git repo.
  2. To install Taichi in Blender -

    • Open command prompt as Admin
    • Change to python location of Blender - C:\Program Files\Blender Foundation\Blender 3.0\3.0\python\bin>
    • Ensure that pip is installed in Site-Packages of this Blender - 'python.exe -m ensurepip' should point to c:\program files\blender foundation\blender 3.0\3.0\python\lib\site-packages
    • Double-check with this command - python.exe -m pip --version
    • Install Taichi - python.exe -m pip install taichi
    • Check if installed correctly - python.exe -m pip list
codesavory commented 2 years ago

Quick question, the scene when changed to BPR renderer out of the box doesn't render the box, but that's alright. Can you update me on how to make the cube into a diffuse material and add an emissive light? I don't see many properties in the materials tab or having added a light. This is more so about how does one uses blender UI features to make the scene supported to be rendered by the engine? Any comments or resources help, thanks!

Uploading the scene here - base_scene.zip

shankarsivarajan commented 2 years ago

For using pip in Blender, I recommend blender_pip.

bsavery commented 2 years ago

Thanks. I've used something a bit similar. I guess if I make this more usable for users we could do something like that. Unless you want to create a pull request!