Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Author Topic: black texture when using the plugin and material script  (Read 4018 times)

JeDi

  • Guest
black texture when using the plugin and material script
« on: October 14, 2005, 05:29:43 AM »

Hi,

I was quickly trying to get a video showing in a demo scene (that has to be done today). I just compiled your theora video plugin (in release, as so is the rest of my demo), added it to the plugins.cfg file, and changed the material script of my scene:

material scenario_screen0
{
    technique
    {
        pass
        {
            texture_unit
            {
          texture_source ogg_video
          {
             filename test.ogg
                   play_mode play
                 }
            }
        }
    }
}

The video I used was the one from the download section of this site (renamed to test.ogg off course).

This is part of the log:
Code: [Select]

Loading library .\Plugin_TheoraVideoSystem
Registering Texture Controller: Type = ogg_video Name = TheoraVideoPlugIn
Parsing script VIC.material
Vorbis Headers: 0 Theora Headers : 3
Texture: test.ogg: Loading 1 faces(PF_B8G8R8,352x240x1) with  hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,352x240x1.
Finished parsing scripts for resource group VIC


The texture just turns black, no video is played...
I didn't add any code (that wouldn't be necesarry this way, should it?) to start playing the video.

Any thoughts (quickly please, I have 1 hour till my deadline :-))
Thanks!

Greetz,
JeDi
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com
black texture when using the plugin and material script
« Reply #1 on: October 15, 2005, 06:36:27 AM »

Sorry, I havn't responded earlier.. I've been a bit under the weather lately.

Hmm, seems like the material is setup corectly in the script. Is there no other message in your log file.. I cannot recal off hand right now what my plugin logs. I will look into material script file playing.. as I rarely use that myself anymore.
Logged

JeDi

  • Guest
black texture when using the plugin and material script
« Reply #2 on: October 17, 2005, 05:38:03 AM »

I've uploaded my ogre log to http://lumumba.uhasselt.be/~jedi/Ogre.log if it can help you. In the mean time, I'm going to try and make myself a simple ExternalTextureSource plugin myself.

Good luck!
Greetz,
JeDi
Logged

manowar

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 14
    • View Profile
black texture when using the plugin and material script
« Reply #3 on: October 17, 2005, 05:50:57 AM »

Hi,

I had the same problem in my app. Make sure that you call  TheoraMovieClip::blitFrameCheck() every frame in your frame listener. It should solve your problems. Let me know if it works.
Logged

JeDi

  • Guest
black texture when using the plugin and material script
« Reply #4 on: October 17, 2005, 06:14:02 AM »

the call to TheoraMovieClip::blitFrameCheck() did the trick, but isn't that a bug in the theora video plugin? I mean, shouldn't a plugin be able to act entirely data-driven, so the user doesn't have to link with the library itself, search for all the clips and call that function? But it's working, so great!

Oh, btw, the video is playing in black/white, but that could be just the movie off course, I'll try another one right now.

Thanks!
Greetz,
JeDi
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com
black texture when using the plugin and material script
« Reply #5 on: October 17, 2005, 08:28:44 AM »

The cheer.ogg is black and white  :D

As far as being data driven.. Well, it used to work with framelisteners so you did not have to worry about updating the texture yourself... However, due to changes in Ogre, specifically how Ogre removes framelisteners, errors happen when removing the clip from the list (destroying). So, the easiest solution is to just remove the use of framelisteners.

Now, the plugin could call your app when a clip is ready to be blitted, however, that happens in a different thread context, and that would mean you would have to use mutex locks in your app to lock the rendering thread (Ogre - probably part of your main and only thread).. And well, I do not want to force the user app to use mutexes. SO, the only alternative is that you poll the plugin each frame for ready frame updates.
Logged

JeDi

  • Guest
black texture when using the plugin and material script
« Reply #6 on: October 18, 2005, 03:32:58 AM »

Shouldn't all ExternalTextureSources be updated each rendering frame? For me, it sounds more logical if the ExternalTextureSourceManager would call an update function for each ExternalTextureSource available, in which the current video frame would get blitted onto the texture surface automatically.

Just my thoughts though...

Greetz,
JeDi
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com
black texture when using the plugin and material script
« Reply #7 on: October 18, 2005, 09:06:56 AM »

Well, Ogre's External Texture Source Manager is just a simple class, and does not do much of it's own. Now, if you mean the derived Theora Manager, then, technically it could.

And, in my ffmpegplugin, I did it that way. THe manager would update each movie clip. However, I moved away from that by adding framelisteners to each clip in the theora plugin. Though, recently removed that. I could perhaps make the manager update all clips that have been created through it, by having it have its own framelistener. I will look into it, though, I am planning on completely redisigning the plugin to a simpler (non-Ogre dependent) lib. And, I am also currently working on an Input lib, so I probably will not get around to this any time soon.

If you want to look at removing the blit check from the client app into a framelistener of TheoraVideoController, than that would be awesom :). Just send me a patch and I will get it applied - if you also made the material script demo work, than I would also love a patch for it too :)
Logged

JeDi

  • Guest
black texture when using the plugin and material script
« Reply #8 on: October 19, 2005, 03:30:33 AM »

I'll see what I can do today. So the best solution will be one framelistener for the whole plugin, that updates all clips, in stead of a framelistener for each clip, right?
I'll fix it today if I get the chance (kinda busy with other things at work too) and create a patch for you.

Maybe I'll even get the chance to make the ffmpeg plugin working again  :twisted:

Greetz,
JeDi
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com
black texture when using the plugin and material script
« Reply #9 on: October 19, 2005, 08:22:16 AM »

Yeah, One framelistener inside of the TheoraVideoController that is resgistered to Ogre::Root inside of the init method, and removed in the shutdown method (IIRC).

It will loop through the Clip List and call the blitFrameCheck... This will work for all movies created (owned) through the manager, and non-manager created ones will be required to be updated by the owner.

As far as ffmpeg plugin... Not sure if that is worth resurrecting, I think a fresh rewrite would be in order.. As ffmpeg has changed alot itself since then. Though, using the current one as a sample of how to (mostly) use ffmpeg might work. But, I abandoned it for patent reasons.
Logged

JeDi

  • Guest
black texture when using the plugin and material script
« Reply #10 on: October 19, 2005, 09:40:53 AM »

Hi,

I've uploaded a patch created with LinCVS on the videoplugin directory to http://lumumba.uhasselt.be/~jedi/videoplugin-diff-2005-10-19-19-12-42.patch. I'm not sure it's in the correct format (not much experience with patches).
I just derived the TheoraVideoController from FrameListener too, used an iterator in the frameStarted function to call the blitFrameCheck method for all clips, and registered the framelistener when the plugin starts (I don't explicitly remove the framelistener, but the destructor of FrameListener takes care of that, right?).

I haven't come to updating the sample, but I tried it with my application and it works.

Another thing: while testing this, I discovered that I can't use the same movie on different materials (crashes). It also takes a long time and a lot of memory when using larger videos, is that normal? Is the whole movie loaded into memory or something?

Greetz,
JeDi
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com
black texture when using the plugin and material script
« Reply #11 on: October 19, 2005, 09:48:34 AM »

Quote

Another thing: while testing this, I discovered that I can't use the same movie on different materials (crashes). It also takes a long time and a lot of memory when using larger videos, is that normal? Is the whole movie loaded into memory or something?


Larger videos are more intensive for two reason.. 1) The power of two requirement for textures (256, 512, 1024, etc).. meaning, that even if your video is 516 in any dimension, it will be scaled to 1024  - this is a hardware limitation. And that will mean increased memory transfer (slow). 2) Theora can be a little slow on large videos.

Now, if by larger you mean in terms of length, then the plugin is probably just decoding to far ahead.. and can be throttled down some I'm sure.

Using the same video on multiple materials? How do you mean? You mean creating another material with the same movie file.. This is a seperate instance, and Tov (from Ogre3d IRC) has reported that simultaneous file reads using Ogre Data Stream is slow for some reason.. He solved that by using FILE* inside the plugin's to open the movie instead. If you mean applying the material to multiple objects, then there should be no noticeable slowdown.

Edit - By the way, thanks for the patch. I will look to getting it applied soon.  :D
Logged

Anonymous

  • Guest
No way
« Reply #12 on: November 13, 2005, 11:25:05 AM »

Quote
Shouldn't all ExternalTextureSources be updated each rendering frame? For me, it sounds more logical if the ExternalTextureSourceManager would call an update function for each ExternalTextureSource available, in which the current video frame would get blitted onto the texture surface automatically.

 How can you say that? No way!
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2652
    • View Profile
    • http://www.wreckedgames.com
Re: No way
« Reply #13 on: November 13, 2005, 07:24:33 PM »

Quote from: "Anonymous"
Quote
Shouldn't all ExternalTextureSources be updated each rendering frame? For me, it sounds more logical if the ExternalTextureSourceManager would call an update function for each ExternalTextureSource available, in which the current video frame would get blitted onto the texture surface automatically.


 How can you say that? No way!


This actually fits better with the design. You can still pause the textures via the change playmode way.. Ignoring frme updates is actually not a good way to pause the clip, because it does not account for the Ogre Timer continuing.. So, this will actually be better. If I ever get the chance to do this anytime soon.. seems the patch link is dead :/
Logged