Blender to Panda3D pipeline

panda3d v1.10.3
python v3.5.2
blender v2.79b
yabbee v13.0.0 (according to the license on github?)

Hi all, I’m quite new to the community and so forgive me if some of my questions are a bit too basic. My immediate goal is to simply figure out how to export a .egg file with texture from blender and load it into panda. Long term I would like to have a workflow which would allow me to import a .blend file online and export it to panda3d. I have read several of the discussions here but I’m still quite confused.

Currently, I have been able to use use the addon yabbee by downloading it as a .zip file from github and following a previous tutorial for its installation. Exporting to a .egg file works for loading the model with material color, but does not work for loading texture attached as an image.

The only time it has worked is if somehow the texture is on the material? On the left is what I tried, and on the right is an example I followed online which worked.

So according to this post, it looks like I can’t apply texture via images onto vertex points. Applying the texture onto the material I now get

which is good, but now I have no idea how to get the texture aligned correctly onto the cube.

However despite making the two examples identical, the left doesn’t show up in pview whereas the right does.

Take a look at your first screenshot–note the right-hand portion of the left-hand screen (that is, the bit that shows the Blender logo). In that, note the squares overlaying the Blender logo–those are, I believe, the “UV map” of the model: they determine what points on the image each vertex maps to, and thus how the image covers the model.

Do you see any errors, either in the YABEE panel before exporting, or in output afterwards? (It might help to run Blender from the command-line/terminal/cmd, so that errors are printed into that. Note that these errors aren’t sent to Blender’s Python Console, if I’m not much mistaken.)

If not, on the off-chance, have you tried centring the model in PView (by pressing “c” once PView has loaded)?

Nope I am not getting any errors. Exact steps I took in blender,

  1. file new
  2. within properties window go to texture tab
  3. unlink current texture. click new
  4. open blender logo
  5. F12 to see rendered view to double check
  6. export to .egg using yabbee

Here is what I see in panda viewer, and I tried pressing “c”. Thanks for the quick reply.

Very odd.

Hmm… Have you tried removing the material, and replacing it with a new one, with all values left at their defaults? (Ignore the texture for the moment; leave it untextured.) Perhaps there’s something odd about the material.

Things are getting interesting.

So if I were to just remove the texture and export to .egg everything is fine albeit I have no texture. Exporting the .egg also works if I simply start anew and immediately export to .egg.

At this point I’m honestly looking for any pipeline which would allow me to go from blender object with texture to panda.

I am not sure exactly which workflow your using for texturing, but I would recommend sticking to the following:

  • Do not use the UV/Image Editor to texture faces (used to be called Tex faces or some sort). This is not well supported by exporters and slated to go away in future Blender versions if it hasn’t already.
  • Use Materials
  • Use Image Textures
  • Use UVs for texture coordinates (not global, orco, etc)

Could you please post a screenshot of your material settings and your texture settings?

If you want a more automated Blender to Panda3D pipeline you might want to look into the following projects (disclaimer: I am the author of these):

  • BlenderPanda - Blender addon that adds BAM export and rendered viewport capabilities (via a Panda3D render engine)
  • blend2bam - Commandline tool to convert blend files to BAM using either YABEE or glTF behind the scenes
  • pman - A command line tool and Python module to help bootstrap and manage Panda3D projects. Not specific to Blender, but has support for using blend2bam to automatically convert blend files to BAM when running your project.

By material and texture settings you mean this?

Tried using blenderpanda with blend2bam, but got a file not found error when trying to export to .bam file. Here is the full stack trace.

Traceback (most recent call last):
File “/home/mhu/.config/blender/2.79/scripts/addons/BlenderPanda/blend2bam_wrapper.py”, line 9, in
sys.exit(main())
File “/home/mhu/.config/blender/2.79/scripts/addons/BlenderPanda/panda3d-blend2bam/blend2bam/cli.py”, line 135, in main
convert(settings, srcdir, src, dst)
File “/home/mhu/.config/blender/2.79/scripts/addons/BlenderPanda/panda3d-blend2bam/blend2bam/cli.py”, line 68, in convert
blend2gltf.convert_single(srcfile, tmpfile.name)
File “/home/mhu/.config/blender/2.79/scripts/addons/BlenderPanda/panda3d-blend2bam/blend2bam/blend2gltf/init.py”, line 18, in convert_single
self.convert_batch(srcroot, dstdir, files)
File “/home/mhu/.config/blender/2.79/scripts/addons/BlenderPanda/panda3d-blend2bam/blend2bam/blend2gltf/init.py”, line 33, in convert_batch
blenderutils.run_blender_script(self.script_file, args, blenderdir=blenderdir)
File “/home/mhu/.config/blender/2.79/scripts/addons/BlenderPanda/panda3d-blend2bam/blend2bam/blenderutils.py”, line 16, in run_blender_script
blenderdir=blenderdir
File “/home/mhu/.config/blender/2.79/scripts/addons/BlenderPanda/panda3d-blend2bam/blend2bam/blenderutils.py”, line 7, in run_blender
subprocess.check_call([‘blender’, ‘–background’] + args, stdout=subprocess.DEVNULL)
File “/usr/lib/python3.5/subprocess.py”, line 576, in check_call
retcode = call(*popenargs, **kwargs)
File “/usr/lib/python3.5/subprocess.py”, line 557, in call
with Popen(*popenargs, **kwargs) as p:
File “/usr/lib/python3.5/subprocess.py”, line 947, in init
restore_signals, start_new_session)
File “/usr/lib/python3.5/subprocess.py”, line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: ‘blender’

Yup, those are the settings I was looking for, and they look good to me. I do not use YABEE, so I cannot say for sure if those custom properties on the material are correct.

As for the BlenderPanda/blend2bam error, it looks like blender was not on your PATH, and that BlenderPanda’s ability to detect the currently running blender instance as a fallback is not working as intended. Actually, this may be an issue with not having a pman project setup. BlenderPanda should be able to export without having setup pman, so I am treating this as a bug.

Hmm… When viewing the invisible box in PView, does anything happen if you press “L” (to toggle lighting), or “P” (to toggle per-pixel shading)?

My best guess right now is that something is causing your model to render as entirely transparent. Maybe it’s an odd setting in the material properties. (Something under the “transparency” section, perhaps?) Maybe it’s an odd setting in the texture properties. (Perhaps it’s set to influence the material’s transparency, or in fact has all its pixel alpha-values set to zero?)

After the test that I gave in the first paragraph, try these things, please:

  1. In the texture properties, click on “Show Alpha” (just below the tiling image of the texture). Does the image disappear, replaced by the chequered backdrop?
  2. Try replacing the texture with another: unlink Texture.004 and create a new, fresh one. Change nothing in it, other than loading an image other than the one that you’re using.
  3. Try replacing the material, as I described previously, and applying the texture to it.

Fixed! So when I was exporting to .egg I had to click the check box for shadow. It now shows the texture in pview. Wow that was a journey.

Thanks Everyone for the support! Now onto more questions like how I’m supposed to map the image to the object without the uv/image editor since yabbee doesn’t support it… but thats a question for blender i suppose.

That’s very much not usually required–I’m pretty confident that I don’t usually check that box, and I’ve used YABEE quite a bit.

As I said above, I’d guess that there’s something funny about the texture being used, its settings, or perhaps the material, that it’s behaving this way.

That’s not quite accurate, I believe: YABEE doesn’t support images just applied via the image-editor, but it does support UVs mapped via the UV-editor, with textures then applied via a material and using those UVs. (An image loaded into the UV-editor can thus be used as a guide for UV-mapping, but won’t itself be applied.)

Hmm so it seems you’re correct since checking or not checking it does not seem to affect the results for the goblet. On the other hand, it is critical for the simple cube example which I can still consistently recreate. Using a different image or replacing the texture or material did not fix the issue whereas simply checking that box did. I’m assuming it likely affects some setting that I have no idea about.

I think I’m starting to understand how the texture works with the UV-editor as well. This has been very helpful.

I’m glad that it’s been helpful. :slight_smile:

As to your cube problem, indeed, it may well be that there’s a setting somewhere that’s messing things up for you.

Perhaps it’s worth starting over, dumping that cube and working with a fresh file and default settings? Unless, of course, whatever setting is causing the problem has been saved to your startup file…

Actually, I have an idea: would you please re-export your cube such that it’s invisible, then post the contents of the resultant egg file (which should just be text)? If it’s just a cube with eight vertices, the file should, I think, be fairly short.

That way we might be able to detect what the problematic setting is, see what prompts YABEE to produce it, and thus perhaps track down whatever’s causing the problem in Blender.

here is my solution:

Can we have something like a chart or table how to use Blender and Panda together?
Example:

+---------+---------------+----------+--------+-----------------+----------------------+
| Blender | Material type | Exporter | Format | Conversion tool | Unsupported features |
+---------+---------------+----------+--------+-----------------+----------------------+
| v. 2.79 | Regular       | YABEE    | egg    | Not required    | ???                  |
| v. 2.79 | Nodes         | ???      | ???    | ???             | ???                  |
| v. 2.8  | ???           | ???      | ???    | ???             | ???                  |
+---------+---------------+----------+--------+-----------------+----------------------+

I am aware only of the most simple pipeline: Blender 2.79, legacy material system, export to .egg. Supports collision shapes, animations, etc.