Video Texture player

(tml4ever14) #55

:confused: For me it doesn’t do anything, I load it up and it just shows the x’s.:confused:

I’m running with an intel pentium D CPU 3.00GHz, 1 GB of RAM
and I have a ATI Radeon X1300 as my graphics card

(ashsid) #56

tml4ever14,

For me it doesn’t do anything, I load it up and it just shows the x’s.
Have you tried to press Space or Enter?

(ashsid) #57

Finally I have finished testing and released new version of Blender Game Texture Video plugin. It allows to use Blender Materials option and also allows to choose, in which material and texture will be video played.

(Siegel) #58

Very kewl ashsid, but iit just isnt working for me. It gives no errors or error logs. when i press p the movies dont show and when i press space blender crashes :(, any ideas what could be wrong?

My Specs:
Blender Preview40(ver after RC1)
WinXp
Intel Pentium 4 2.5Ghz
512mb DRAM
128Mb ATI Randeon9500 Pro

(blendenzo) #59

ashsid: At first I thought “Why not just use FMV?” because I thought you were talking about cutscenes, but then I saw some of the screenshots. Amazing! Video running in realtime!

Originally Posted by ashsid
Performance tip: most important performance hog seems to be scaling of video image sizes to power of 2 values. I have uploaded new version of demo, where video size is 256 x 128. Performance has been much improved by this change.

Yes, this is true, but to be entirely accurate, scaling shoud be in multiples of 64. This applies for textures as well. When you use an odd scale, BGE actually has to scale the image or movie down to multiples of 64, which is a major resource hog. If people don’t use multiples of 64 in their games, I can’t even play them because my video card doesn’t have enough memory to take the abuse.

TO ALL: Please always use multiples of 64 for your texture (image or movie) dimensions. Examples: 64 x 64, 128 x 256, 1024 x 768, 384 x 512… You will be happy with yourself for doing it because your game will run smoother, and less people will say “It runs sooooo slooooow on my PC!” In case you’re wondering, this scaling issue is standard for all game engines (not just Blender’s) due to the binary nature of computer memory.

edit: Me and my big foot in my mouth. It seems I was wrong. Powers of 2, not multiples of 64. See ashsid’s next post for proof and my next post for where I got the idea.

(ashsid) #60

Siegel,

plugin is compiled for Blender 2.41 - I plan to upgrade it for 2.42 soon after it will be released.

blendenzo,

this is code from Blender sources - file drawmesh.c function set_tpage(), that shows that scaling is done also when size is 384 or 768:

        if (!is_pow2(rectw) || !is_pow2(recth)) {
            rectw= smaller_pow2(rectw);
            recth= smaller_pow2(recth);
            
            scalerect= MEM_mallocN(rectw*recth*sizeof(*scalerect), "scalerect");
            gluScaleImage(GL_RGBA, tpx, tpy, GL_UNSIGNED_BYTE, rect, rectw, recth, GL_UNSIGNED_BYTE, scalerect);
            rect= scalerect;
        }

textures and frame rate
(blendenzo) #61

Taken from The Blender Game Reference, Section 25.3.4 “Available File Formats”

The height and width of textures should be to the power of 64 pixels (e.g. 64x64, 64x128, 128x64 etc.) or Blender has to scale them (in memory not on disk!) to provide OpenGL compatibility

Since 128 x 64 is not a power of 64, I assumed the words “to the power of” were a typo, and the words “a multiple of” were intended. It seems “64 pixels” was the real typo, and “2 pixels” was intended…

This is confirmed in the newer BGE 2.41 Material Docs in “Image Types” were it does say “power of 2” like you said, and that code you posted seems about as clear as can be. I had a texture in my Marble Labyrinth game at 1024 x 768, and it was kinda blurry at some angles. I set it to 512 x 512, and it’s 100% clearer and runs about 33% faster. Thanks for clarifying that for me. (accidental pun)

(ashsid) #62

New update in Video Texture plugin allows to generate textures with transparency from “blue screen”. Demo contains example of this effect.
I have also done complex refactoring of internal classes to make futher development easier.

(tml4ever14) #63

:confused: I pressed enter and space. No matter what I do all I can see is the x’s on the different planes.:confused:

I’m running with an intel pentium D CPU 3.00GHz, 1 GB of RAM
and I have a ATI Radeon X1300 as my graphics card

(ashsid) #64

tml4ever14,

check if your codec supports output in RGB24. If not, texture renderer refuses to render video and video is rendered in separate window.

(amorphia) #65

Just want to say thanks a million for this Ashsid. It is going to be very useful for my research (I study child psychology and I need to show children videos inside of a simple computer game).

I am a little confused about how the plugin works with materials and textures. The demo works very well for me. But my problem is that when I try and create my own .blend using the plugin, it never works and I also get an error log created with

.\TexPlayer.cpp:152:0       : Texture material is not available

.

I did as follows: started a new .blend, created a plane, created a material for it, UV mapped the same .png on to it as you use in the demo, and then duplicated all the python game logic from the demo.

I know that the materials/textures is my only problem, because if I disable their use with

blendVideoTex.setBlendMat(0)

, the video displays fine (actually that surprised me, the documentation lead me to believe that it would crash if I said there were no materials when there are).

I have tried a variety of value for the last two parameters in this command (without success):

 
GameLogic.player = blendVideoTex.TexPlayer(obj,'scanner_darkly01.avi', 0, 0)

I must admit, I don’t really feel like I completely understand how UV and image textures work in blender anyway. I notice that in the demo you have, as well as a UV map, a non-UV image texture under the F6 tab. I don’t really understand the point of that (I have never been able to get those kinds of image textures to do anything useful). I don’t understand the relationship between the UV map and the non-UV image texture on the F6 tab. Anyway, creating that non-UV texture in my test .blend does not solve my problem.

Cheers,

Ben

(ashsid) #66

amorphia,

if you use Blender materials options, game engine doesn’t use UV mapped texture, but texture defined in material.

If you don’t add texture image to material, plugin won’t find it and issue error - like you have already discovered.

In demo there are both kinds of texture used to be able to run with and also without Blender materials enabled.

Maybe you could upload your file so I would be able to check what’s wrong with it.

(amorphia) #67

Oh, I see, thanks for the explanation.

My file has both a UV map and a non-UV image texture also. But only the non-materials method works. I would very much appreciate it if you would take a look at it and tell me what I did wrong.

Cheers,

Ben

(ashsid) #68

I have tried it and it works for me in both modes with or without Blender Materials.
Which version of Blender do you use? Plugin is compiled for 2.41 and I didn’t tested it on release candidates for 2.42.

(amorphia) #69

Thanks a lot for testing that for me, Ashsid. I am using the standard 2.41 version so this is rather odd. However, I was already begining to have my suspicions that something is not quite right on my system, with regard to image textures. They don’t seem to work for me quite as I think they should. As a relative newbie it seems more likely that there is something I have misunderstood, than that there is a bug, but this test really seems to suggest there is a problem with my system.

For example, in the file I sent, if I press TexFace Delete on the Editing Panel, to delete the UV data, then the plane become totally black. But, I think an image texture should still be displayed, right?, because I have only deleted the UV map, and there is still a non-UV image texture.

Would you possibly mind confirming that for me? That way you can be certain that there is something wrong with my system, and you don’t need to be concerned about your plug-in. I can then get help elsewhere. I suppose it could be my video card?

Thanks for the help,

Ben

(amorphia) #70

I am trying to delete this accidental post but can’t work out how! Please ignore it!

(amorphia) #71

Hi there,

I hope you don’t mind, Ashsid, I just have one more question, about how you are supposed to restart the video once it has stopped. I find that the only way to replay the movie is to recreate the object by calling the constructor again (in the same way), followed by play() again. Is that the way it should be? I thought it was more appropriate to do it like this:

playstart.py:

import blendVideoTex
if hasattr(GameLogic, 'player') == 0:
  contr = GameLogic.getCurrentController()
  obj = contr.getOwner()
  GameLogic.player = blendVideoTex.TexPlayer(obj,'Video/scanner_darkly01.avi', 0, 0)
  GameLogic.player.repeat(1)
  GameLogic.player.play()
else:
  print "Trying to play again
"
  GameLogic.player.play()

playing.py:

import blendVideoTex
if hasattr(GameLogic, 'player') != 0:
 state = GameLogic.player.getState()
 if state == 3:
  GameLogic.player.close()

But I find that even after I call close, state still stays at 3. I thought it would go to 1. Perhaps what is missing is some kind of rewind() function? Or is it really OK to keep constructing the object every time I want to play the video?

By the way thanks again for a really cool addition to blender, even with these things which I don’t quite understand, I am confident it is going to be really useful for me!

Cheers,

Ben

(ashsid) #72

Hi,

it seem to be a bug - video should be able to replay by calling play() again. I will look at it and post corrected version ASAP.

Ash

(ashsid) #73

Yes, it was bug. Methon play() is supposed to do 2 different things:

  1. if video replay was stopped in the middle, play() will continue from place, where it was stopped.
  2. if video was stopped because it has finished replay, play() will restart replay from starting position.

The second option was broken and is now fixed.

(dazzler) #74

Hi I am really keen on getting this video plugin to work … but it doesn’t.

I downloaded the demo zip file today, and have coppied all the blender main directory.

I tried it with 2 versions of blender:
this is what happens when I press p (for play), and then <Enter> or <Space> to start the videos.

2.41:
in the left of the 2 sided tv box I get the black cross/circle on white background, and to the right I get the black cross/circle with no background… the enter/space keys don’t do anything, and no change in blender’s output window

2.42 RC3:

similar to 2.41, but cross/circles are distorted (look more like lines). when I press <enter>, blender crashes, (displays windows error message)

[SIZE=1]AppName: blender.exe AppVer: 0.0.0.0 ModName: blendvideotex.dll
ModVer: 0.0.0.0 Offset: 000011c6

This is what I am running:
windows XP
Compaq presario with AMD 2500+
NVIDIA GeForce FX5100 (64MB)
directX 9.0c
Just installed XVID codec XviD-1.1.0-30122005 Final Release
Python 2.3 and 2.4 installed

the videos in the demo zip run in media player 5.1 and 9 on my machine

Is there any way to debug what is going on in the plugin? Blender’s text output window displays nothing.

any help is appreciated.

[/SIZE]