Finally, the mesh has been exported to Panda3D

These two days I am really busy working on the new video editing project and I also had suffered a flu yesterday, therefore, I have missed out a few posts on this website. I promise you that starting from now on this site will continue to progress and I will write as many posts per week as possible. We will create two projects at the same time, the pygame’s project and the Panda 3D project. Talking about Panda 3D, I would like to thank Mr. Pinguin for providing such a piece of valuable information which helps me to solve the mesh exporting issue which I had mentioned about in the previous post. After I have run the project again with the below code and with a new mesh here is what I get.

from math import pi, sin, cos
 
from direct.showbase.ShowBase import ShowBase
from direct.task import Task
 
class MyApp(ShowBase):
 
    def __init__(self):
        ShowBase.__init__(self)
 
        # Load the environment model.
        self.scene = self.loader.loadModel("models/environment")
        # Reparent the model to render.
        self.scene.reparentTo(self.render)
        # Apply scale and position transforms on the model.
        self.scene.setScale(1.0, 1.0, 1.0)
        self.scene.setPos(-8, 40, 0)
 
app = MyApp()
app.run()
The mesh created with Blender

Here is the link to the solution I am talking about.

Below are the steps we need to take to export the mesh in the egg format in Blender.

  1. Start Blender with default cude.
  2. At the top switch from Default to UV Editing
  3. With mouse in right window. Press Tab to go into edit mode.
  4. With mouse in right window. Press U for Unwrap an than choose a mode for unwapping. (Smar Unwarp for example)
  5. In the left window press +New next to the image symbol. Choose a color or UV Grid in Generator Type.
  6. Image* -> Pack Image (Not Pack as PNG!)
  7. On the top go back to Default
  8. In the right bar go into the Texture Tab (Small red white Icon)
  9. Select Image or Movie in the Type drop down.
  10. In Image Sub Tab click the Icon left to the +New button. And select the Image.
  11. In Mapping change Generated to UV and select Map UVMap
  12. Save Blender File
  13. Export with YABEE

One more thing you need to keep in mind is that the above solution will not work in the Blender Cycle mode. If anyone has any idea on how to export the mesh in Blender Cycle do let me know and I would be happy to give you a link back to your solution page.

I am just playing around with the above-mentioned solution today and will seriously look into it tomorrow, stay tuned!

Render game scene with Panda 3D

Today we will continue to explore Panda 3D, after a day of searching online for the method to export the whole mesh created with Blender which can then be used in Panda 3D’s game I have found two of them. 1) Exporting the mesh in the Direct (x) format 2) Using YABEE to export the mesh in the egg file format. I have tried both and the result is still the same, the mesh has been rendered on the game scene but without any texture on it. What could have possibly gone wrong? Maybe if I light up the game scene then the texture will appear? I have not decided yet whether do I want to use Panda 3D or another game engine to create the next python 3D game.

Anyway, Panda 3D has it’s own game graphic so if we use it’s game graphic instead then there is no problem rendering the graphic on the scene.

This is the program on their website which will render the game graphic on the game scene.

from direct.showbase.ShowBase import ShowBase
 
class MyApp(ShowBase):
 
    def __init__(self):
        ShowBase.__init__(self)
 
        # Load the environment model.
        self.scene = self.loader.loadModel("models/environment")
        # Reparent the model to render.
        self.scene.reparentTo(self.render)
        # Apply scale and position transforms on the model.
        self.scene.setScale(1.5, 1.5, 1.5)
        self.scene.setPos(3, 42, 0)
 
app = MyApp()
app.run()

You will see below scene if you run the above program.

http://islandstropicalman.tumblr.com/post/182133162206/game-development

I am working on the other pygame project besides trying out Panda 3D and in the next chapter we will continue to develop that other pygame project since there is no further breakthrough in this Panda 3D game graphic stuff, if you know the method to export the mesh together with texture in Blender do let me know about it. Thank in advance.