09th / YABEE

Export models from the Blender to Panda3D game engine
MIT License
107 stars 39 forks source link

Support shadeless and vertex color paint options, correct ambient and emit values #7

Closed rdb closed 9 years ago

rdb commented 9 years ago

I had to export a Shadeless material and noticed YABEE doesn't respect that setting. So this patch fixes that - .egg doesn't technically support it but it emulates it using an emit color. (Ideally I'd extend the .egg format for this, but we can change YABEE if and when I do so).

While I was at it, I also added support for the Vertex Color Paint option. (Sadly Shadeless and Vertex Color Paint don't work when both are enabled due to a limitation in Panda3D - Panda can't take an emission color from the vertex colors even though OpenGL does seem to support that.)

I've been testing various combinations to make sure the color is exactly the same in Panda, and seems to be right. I noticed that ambient and emit were not exported correctly, though, so this fixes that as well. Note that to get the same ambient in Blender and Panda you need to create an ambient light in Panda with the color set to the "Ambient Color" setting under World in Blender.

I'm fairly confident that these changes are correct, but feel free to ask if you have any questions.

rdb commented 9 years ago

Sorry, something had messed up in the indentation when I committed it... I updated the pull request with the fixed indentation.

09th commented 9 years ago

Thanks! Also about colors: while playing with my Blender4Pand toy I've found that Blender converts the linear RGB to the sRGB in the shader, so color which I was got from the Blender can give different result in the Panda render.

rdb commented 9 years ago

I know :-) the colours are the same if I put "framebuffer-srgb #t" in my Config.prc.

1.9 comes with some sRGB handling support in Panda, and I'm working on an .egg syntax for specifying texture colour space. I'll tell you when I'm done with that so it can be added to YABEE (but not yet).