Exporting issue with blender 2.8

This is my .blend file tile01.blend (694.8 KB)
I have tried exporting this .blend file using blend2bam and gltf export, they produced slightly different results but both were not correct.
This is the .bam file viewed in pview and the render pipeline

pview uses default panda material/shader model.
Render Pipeline have it’s own material/shader model.

If you are targeting Render Pipeline then you have a few choices:

  1. Use Panda3D Bam exporter. It’s a Blender plugin, which could be outdated and incompatible with Blender 2.80.
  2. Use any other exporter which could export at least geometry/meshes, then load textures and setup materials by yourself in Panda3D.

I managed to get an .egg file with the correct mesh (i think so atleast) using blend2bam and then bam2egg. Out of all the available options, this one worked the best for me.

I took your suggestion of setting up materials in panda3d but that made the model completely black, which makes me think the issue is with my .egg file. Maybe lack of texture coords?.

Here is my .egg file: tile01.egg (4.7 KB)

The model is fine. You just need to set the materials and textures in Panda3D.

For example:

m = Material()
m.set_base_color((1, 1, 1, 1))

For the textures it depends on your texture pipeline.
RP uses up to 5 textures per material/nodepath:
0 - diffuse
1 - normal map
2 - metallic
3 - roughness
5 - parallax
So you need to setup a TextureStage for each texture and then apply them all to NodePath. The ordering is important and you can’t skip the textures in the middle.
You can disable some textures with render_pipeline.set_effect(). Check out RP examples for it.

If RenderPipeline is too much for your project, you can also try panda3d-simplepbr, which is designed to work well with blend2bam and panda3d-gltf:

Hmm, applying the material works fine but the textures still don’t. This is how I’m applying textures:

        color = loader.loadTexture('color.jpg')
        normal = loader.loadTexture('normal.jpg')
        rough = loader.loadTexture('rough.jpg')

        tscolor = TextureStage('color')
        tsnormal = TextureStage('normal')
        tsrough = TextureStage('rough')


I’ll definitely have a look, thank you

You need to .setSort() and .setPriority() for each texture stage and apply them using the correct order.
So your color texture is priority 0, normal map - 1, roughness - 3. But you can’t skip the texture #2, which is used for metallic. You have to set it too or remove roughness texture.

I’ve added this and removed the roughness texture for now:


Still the same result :frowning:

Edit: I just saw this ‘Geom GeomNode Plane.001 (1 geoms)
has no material! Please fix this.’ on the render pipeline console, maybe that’ll help diagnose the issue

I have tried to apply the textures. It doesn’t work for this model. Looks like the exported model have some problems.

Hmmm, any idea what’s wrong with the model?

This is a generic plane exported from Blender with my custom ingame exporter.
test.egg (1.5 KB)

This is a working RP example:

import sys

from direct.showbase.ShowBase import ShowBase
from panda3d.core import Material, TextureStage

sys.path.insert(0, '.')

from rpcore import RenderPipeline

class Demo(ShowBase):
    def __init__(self):
        self.render_pipeline = RenderPipeline()

        m = Material()
        m.set_base_color((1, 1, 1, 1))
        m.set_emission((0, 1, 0, 0))

        ts0 = TextureStage('0 - diffuse')

        ts1 = TextureStage('1 - normal')

        self.model = self.loader.load_model('test.egg')
        self.model.set_texture(ts0, self.loader.load_texture('FloorBG2.png'))
        self.model.set_texture(ts1, self.loader.load_texture('FloorBG2NRM.png'))

demo = Demo()

The textures that I have used are from RP samples.

For your model, this could be a bug in gltf exporter or bam2egg exporter.

Your model doesn’t have tangent-space vectors, which is why it looks black when you apply a normal map to it.

Ahh, I had to set it a material for the color map to show but the normal and rough still dont work.
Atleast it’s progress :slight_smile:
Also, does the normal map work on your .egg file? I tried it myself and it did not work, same thing with my file

I exported with yabee and the egg file now has tangents and binormals but still the normal and rough arent showing up. Here is my egg file now
tile01.egg (4.8 KB)

I have updated my RP sample, added: m.set_emission((0, 1, 0, 0))
I forgot about it.

The emission’s RGBA color values are used as special material params in RP.
R - shading model (0 is basic shading model, which is default)
G - normal strength
B and A - are shading model dependent params.
So I just set normal strength to 1 (emission’s green channel).

RP doesn’t uses tangents and binormals from the model, it just generates them at runtime in the shaders.

Ah, I wasn’t aware of this (I don’t really use the RenderPipeline); sorry for the confusion!

A much better result! Thank you very much :smiley: