Nicolas Metivier
Nicolas Metivier

Reputation: 11

Python - Panda3D - Display HTML/CSS elements into Panda3D scene

My hello message is not visible...

I'm writing a 3D video game using Python (3.10) language with Panda3d (1.10) as 3D game engine.

Some graphical parts of the game are not 3D, there are just 2D elements:

I see on the web that pictures are used to styling Panda3D Direct* components. However, in my opinion, I think use statics pictures (.png for exemple) is not efficient when game design must be evolved. That's why I prefer use HTML/CSS to render 2D elements, especially since CSS is very powerful if you know how to use it. I prefere to use SVG into the scene but I don't understand how create SVG file.

So, my question is: Can I use HTML/CSS inside a Panda3d application?

Thank to all! Have a nice day!

Upvotes: 0

Views: 144

Answers (1)

Nicolas Metivier
Nicolas Metivier

Reputation: 11

I think I've found a workaround (temporary).

  • I create HTML/CSS file that styling my 2D component that must be injected inside the Panda3D scene
  • I create a Python script that convert an HTML part as PNG picture using RGBA for transparency
  • I use the generated PNG picture inside my Panda3D scene on the target component.

It's not pure HTML/CSS, but it can works.

Upvotes: 0

Related Questions