Video on wall

I’ve seen the Media Player Sample provided with Panda3D samples.
I want to play a media file on a particuar part of my environment(say on wall of a room).
The environment file I am using is .egg fomat.
Is it possible?

yes

It’s just like applying an ordinary texture, Smriti. You should find() that wall part, and setTexture().
The media in the sample is applied to an ordinary card/quad/2triangles which is parented to render2d. Try to parent it to render to see the difference.

Thanks for the suggestion. :smiley:
I’ll just try it.

I did following code:

MEDIAFILE="PandaSneezes.avi"

# Some code
# Some more code

# loaded my environment self.environ

self.tex = loader.loadTexture(MEDIAFILE)
# Box03 is the Wall of the room
self.environ.find("**/Box03").setTexture(self.tex) 

The run is fine except the video is not showng up on the wall.
What could be the reason?
Please help

Is the wall has texture coordinate ?
If so, is it correct ?
Post Box03’s entry in the .egg.

By the way, is it still necessary to set a priority for setTexture?

you know setTexture(aTexture,1) to say to apply the change immediately?

Just wondering…

following is Box03 part in the Egg code:

and Tex33 is

Even setting the priority hasn’t helped.

After the code that sets the texture

MyTexture = loader.loadTexture("PandaSneezes.avi")
self.environ.find("**/Box03").setTexture(MyTexture) 

I wrote following code

print self.environ.find("**/Box01").getTexture()

This prints the following

Please suggest if this is normal.
The texture is still not being reflected in the run.

If it’s already textured, setting a higher priority SHOULD do it.
Is this your box :
???

I knew the problem. Since you’re using tag, the generated collision node is named Box03, while the original geom node is now unnamed.

  1. If you put the tag by editing the egg directly, you could insert a after Box03, so that Box03 holds both the collision and geom node.
<Group> Box03 {
   <Group> Box03coll {
   <Collide> { Polyset keep descend }
      <VertexPool> Box03.verts {
      <Vertex>
      <Vertex>
      <Vertex>
      }
      <Polygon>
      <Polygon>
      <Polygon>
   }
}
  1. Or, if you prefer doing it in the script :
self.environ.find("**/Box03").getParent().find("+GeomNode").setTexture(MyTexture)

To see the hierarchy, use NodePath.ls(). The correct structure should be like this :

ModelRoot ****.egg
  PandaNode Box03
    CollisionNode Box03coll (12 solids) (hidden)
    GeomNode  (1 geoms: TextureAttrib)

Either of the solutions is not working.
Please get egg file below

http://123.237.1.201/Error/RoomSceneWithVideoS.egg

Please help

I couldn’t download the egg.
I forgot the priority :

self.environ.find("**/Box03").getParent().find("+GeomNode").setTexture(MyTexture,1)

Have you ls() it ? What is named Box03 ?

ynjh_jo, Thanks a lot!!! It is working now.

Can you please spare time to explain what the whole problem was?
I just could not understand the whole concept of node hiererchy.I wonder the hiererchy structuring does matter that much.
OR
Could you please direct me to nice guide on this topic.

Thanks

P.S Couldn’t run NodePath.ls(). It gave errors

ls() is a function of NodePath. I meant to tell you to do this :

self.environ.ls()

The result is (I used the posted Box03, not the entire environment) :

ModelRoot ****.egg
  PandaNode
    CollisionNode Box03 (12 solids) (hidden)
    GeomNode  (1 geoms: TextureAttrib)

You must expect Box03 is your GeomNode, but it’s now the name of the CollisionNode, and your GeomNode now doesn’t have any name. Surprised ? I was surprised too.

self.environ.find("**/Box03") gives you the CollisionNode. There isn’t any function to get the sibling node, so I grabbed the parent first, and then searched for GeomNode.
self.environ.find("**/Box03").getParent().find("+GeomNode") gives you the GeomNode.

So, the problem wasn’t node’s hierarchy. It was the weird GeomNode renaming behavior upon tag. I don’t know why the developers decided to go this way.
Were they, I would go this way instead :

  PandaNode Box03
    CollisionNode (12 solids) (hidden)
    GeomNode  (1 geoms: TextureAttrib)

It’s OK to leave the GeomNode unnamed, but the name should not be given to the CollisionNode. Instead, it could be given to the parent of the GeomNode and CollisionNode. It’d be better to give them name, e.g. -coll for the CollisionNode and -geom for the GeomNode.
So, if I need to apply some transform, e.g. move it around, both the GeomNode and CollisionNode are moved around altogether, which gives the result everyone might expect.
Ah, what a rant.

Oh… Thanks a million. :slight_smile:
That piece of explanantion was really good and it has helped/clarified a lot.

Thanks again

The name of the collision node is often extremely important, because the collision handler is often configured to generate an event in the case of a collision, based on the name of the collision node. Thus, the egg loader is always careful to preserve the name of the collision node whenever it appears in the egg file.

There is no such guarantee about geom nodes. The egg loader is free to rename these or even combine them with siblings, as it feels it needs to, in order to optimize the scene. We do this because, for 99% of the named geometry nodes within an egg file, you don’t care about the name or even keeping it separate from other nodes, and you’d rather have it render as fast as it can even if it means losing some of that hierarchy.

There are exceptions, of course; and when you do care about preserving the name of a geom node, you should tag it with the flag, which exists for this very reason.

I’m not 100% sure what the egg loader will do if you use the “keep” collide tag in conjunction with the flag. That’s kind of an awkward combination. The right thing would be to name both of them, I suppose, but then you’d still have to be careful with your find statement, since it is now ambiguous. Really, if you want to be able to get a handle to your geometry node, you should probably separate it completely from the collision geometry.

In many cases, keeping the collision geometry separate is best anyway. Often you want to have many thousands of polygons in a visible model, but only a few dozen in the collision model.

David