Video Texture player

New in SVN:

VideoTexture: VideoTexture.materialID() can now take texture image name.

You can specify a image name (starting with ‘IM’) instead of a material
name in VideoTexture.materialID() and return the material ID matching
this texture.
The advantage of this method is that is works with blender material
and UV texture. In case of UV texture, it grabs the internal material
corresponding to the faces that are assigned to this texture. In case
of blender material, it grabs the material that has an image texture
matching the name as first texture channel.
In both cases, the texture id used in VideoTexture.Texture() should be 0.

Ex:

matID = VideoTexture.materialID(obj,‘IMvideo.png’)
GameLogic.video = VideoTexture.Texture(obj, matID, 0)

Passes out

Crazy, theres endless applications in-game for this.

hey everyone!
about alpha:
i got it to work with image-sequences. ffmpeg takes them like this
GameLogic.vidSrc = VideoTexture.VideoFFmpeg(’/tmp/test2.%04d.tga’)
[%04d meaning framecounter is 4 digits padding]

then set up alpha as you would with GLSL normally (material alpha = 0; texture that will be Videotexture mapped to alpha, too; F9 > TextureFace > set to alpha; I think that’s it)

it works (even fast) :slight_smile:

Can this handle a live video stream, say from a good quality webcam? In other words, could I display real-time video from a live source alongside in-game content? Or does this just work with video files?

As far as I know the plan is have it working with webcams as well… It might do so allready… it could in the past versions. Check the mailing list… for the earliest post about it… I think it had some info there about it. I found a link to it… looks like it can do what you ask allready.
http://lists.blender.org/pipermail/bf-blender-cvs/2008-October/016463.html

2d23d: alpha channel is not supported yet. It is under investigation

harkyman: yes it can take webcam stream. Unfortunately I had to disable device support in the current version because the ffmpeg repository in blender is too old. It’s just a question of updating ffmpeg, shouldn’t take long

I made my first wiki: http://wiki.blender.org/index.php/GameEngineDev/VideoTexture

great man…
can somebody compiling a windows version
or give me a tutorial for i can learn
compiling my own version of blender for windows…

is MP4 supported?

So we could capture footage of say the game play… pause the game… and replay the footage in slow-motion or whatever then… go back to the game… where we left off.

ben2610, I know you are working on it, but believe me, it works already if you load an imagesequence into ffmpeg like I posted above! I can send you the file if you like…

tb1alexc: Mpeg4 is supported

kirado: you’re going too far, there is no viewport to file yet, just viewport to texture. This means instant replication of the viewport to a texture that is display on some object of the game.
This is not very usefull feature I agree, I can’t think of any use at the moment.

However, a viewport to file feature is fairly easy to do: ffmpeg supports writing to video file.

Well not many people seemed interested in my normal mapping question earlier on… propbably because they would have no reason to do it… even so, because its there - Here it is.
http://www.vimeo.com/2182746
A video rotating blender monkey lit by red, green adn blue lights is normal mapped on the wall by the Videotexture pluggin using GLSL(the lamp is slowly moved up and down so you can see the effect)… not a great demo … but then not a great idea!

@Ben… well outputting the viewport or a camera to a texture(as in faces on a model showing the animation) is still pretty cool… :wink: I guess you could make some kind of security camera type thing. Either way it’s opens up a lot of creativity when it come to creating interactive artworks, games or even some type of real-time vjaying thing. You could maybe do some sort of mirror like or kaleidoscope effect with it?

@Larryboy I’m definitely interested in animated normal maps :wink: I just looked at your video. Why are arn’t you using a tangent space normal map?

@Kirado - I think that’s because I don’t understand tangent space normal maps… will do some research:o

Ed - the next day - OK i have researched into Tangent space and think I understand it now.

The reason I’m not using it (apart from not knowing about it) is that I want to video live, real-life, scenes lit by red, green and blue flood lights and use them as a source of normal mapping… its for a bit of artistic experimentation rather than a game. I don’t think I can achive tangental lighting in the real world!

Even so - having played around - you need a way of automating the baking process for each frame or it would be very labourious.

This means instant replication of the viewport to a texture that is display on some object of the game.
This is not very usefull feature I agree, I can’t think of any use at the moment.

I think that this can be used as simple reflections/refraction simulation on objetcs, if aplied as realtime reflection and not as uv texture, but can look weird I don’t know…

This is not very usefull feature I agree, I can’t think of any use at the moment.

You can make flat mirrors for architectural walkthroughs.

What more do we need? :slight_smile:

Could this be used as a vjing tool? real time mixing ?
and have a bpm counter in the game engine?

There is a VJ thread somewhere on here. I don’t know what came of it…

for VJing the idea is to connect blender with pure-data with OSC so you can do all your analysis and signal proc in pd and control your visuals with anything you want (inculding knobs, wiimote, etc… )… but actualy, it still need some patching and python scriting … not for the fragile hearts … :slight_smile:
you can find exemples in those VJ thread in this forum, but I think they are quite old… (including libs they refer to, like OSCx for pd … )
Ben has suggested pyliblo as a good OSC implementation for python, up to you to write the scripts you need…

if you can use another camera to render to texture then it’s is really usable. I don’t want to say Portals, because that’s what everybody has been saying since the released of said game… but portals…