BlitzMovie 1.2 release and map editor news

Blitz3D Forums/Blitz3D Userlibs/BlitzMovie 1.2 release and map editor news

dcs(Posted 2005) [#1]
Hi all,

BlitzMovie 1.2 is out!

Many thanks to Tom Speed (tom@...>) for his invaluable help with getting at the actual IDirectDrawSurface7 object contained in a Blitz3D image or texture. Because of this, BlitzMovie can now decode direct to these surfaces, resulting in the fastest performance yet. Also included are new set volume and mute volume functions as well as a means to check the state of the movie. Whether it's playing, paused or stopped.

I have some big plans for BlitzMovie, mainly implementing a cross platform BlitzMax version centred around xiph.org's new patent free movie codec, Theora. And implementing a brand new version for BlitzPlus users is a high priority too.

Alas, I don't have as much time as I'd like to spend on BlitzMovie (especially a BlitzMax version) and the reason is another project I've been working on since late November 2004... a map editor called DifJam. Please click HERE to see a screenshot of the current build, which as you can see is still in development.

Let me tell you, the csg operations in this so far are rock solid, as seems to be the app itself. I intend to make this application very easy to use and as it's crafted using C++, wxWidgets and OpenGL, there'll be a MACOSX and Linux version too. It will be a great way of creating Blitz levels, for Blitz3D and for BlitzMax when 3D functionality appears. The initial release will feature direct export to Blitz3D and Gile[s] formats. As of yet, there's no plans to include a lightmapper as Gile[s] is just so good at it. :)

I'm very interested to know whether there's enthusiasm for this product and whether people would be willing to buy it??? Unlike BlitzMovie, which will only ever be free, DifJam will never be free. I'm thinking around the $39.95 - $49.95 US mark when it's released, which I anticipate to be in about 2-4 months time.

And lastly, you may be wondering where the name DifJam comes from??? It's because the editor was originally started as a means for Torque Engine owners to have an easy to use, reliable program to export to Torque's DIF format.

Anyway, hope you enjoy the new BlitzMovie and if you find any bugs, please send them to my email address below.


dcs(Posted 2005) [#2]
Forgot to say, the BlitzMovie site is available HERE.


jfk EO-11110(Posted 2005) [#3]
Wow, this is great! I tried this for hours, no, for days! Where I miserably failed, you did it with ease! You are my king :) Thanks a lot.
There are only a few things that would be useful too:

Pause (as far as I see not implemented yet, although you can check if it is paused?!?)
Play single frames
Position at certain frame
Get Movie Lenght in Frames
Get Frame time (eg. 33.3ms for 30HZ NTSC)
set play speed (if possible also negative for reverse playing)

Just for in case if you gonna find some time to add more... None less this is already very very VERY nice!


Apocalypse(Posted 2005) [#4]
Would you be willing to share how you gained access the the DX surface from Blitz3d?

Take a look at my thread...

http://www.blitzbasic.com/Community/posts.php?topic=44333


jfk EO-11110(Posted 2005) [#5]
I get a MAV when I try the 3D Version. I tried it with a 512*512 MP4 V2 Avi. I cannot copy your example movies to the test machine right now.

But I have to mention you made some serious mistakes in the 2D Example Blitz Source:

No need for Renderworld
No need to free a "texture" when initialisation fails (guess it would MAV anyway)

And then you should edit the main loop this way:

while BLITZMOVIE_isPlaying() and (not keyhit(1))
Delay 1
drawimage image,x,y
flip 0
wend

It's running much!!! more smoothly and liquid. In fact it's working perfectly.

From the Command BLITZMOVIE_playing() I see that it probably don't support multiple simultanous Movies? I don't hope so! :/ Well, gotta check this out, later.


I still try to make the 3D Version work


dcs(Posted 2005) [#6]
@jfk - :) I know, my Blitz3D example is ropey. I don't know much about Blitz3D, enough to get the examples working. I'm far more interested in C++ and Java than Blitz3D.

@Apocalypse - As my first post stated, Tom Speed provided me with the code to get at the IDirectDrawSurface7 contained within a texture or image. The thread you stated has a post from Tom, telling you the exact method that he told me.

@jfk - I will implement the Pause function soon but the others are low priority at the moment.

@jfk - Could you send me a copy of the movie that's crashing your machine?

@jfk - Multiple movies are supported in the dll and always have been since BlitzMovie 1.0 but they're not currently enabled. I'll enable this at some point in the future.

Guess I shouldn't have mentioned my map editor. No-one seems interested eh???


jfk EO-11110(Posted 2005) [#7]
The Map editor is looking good. Tho there are many Map Editors but only one BlitzMovie hence the lack of attention, maybe.

BTW there is one thing that I would really, I mean REALLLY like to see: When you add BlitMovie to any project, you sometimes make a little mistake, so Blitz will end the App with a harmless runtime error. Now the MoviePlay Process is still active and really freezes my system, so I got to reboot. If there was some kind of Kill-Process thing, that would be nice. Like when it listens to the taskmanager and accepts to be finished by it (and closes the opened Movie), or maybe it's possible to get some special keystroke combination, like CTRL-C (well I know, it's probably hard to get Keyhits when there is no focus). Anyway, this would make things much easier.

But all in all it's a great progress since Version 1.1. Again, thank you!

oh, and drawblock is faster than drawimage, although you can use MaskImage to get a Bluebox (ar ony other Mask Color).


Regular K(Posted 2005) [#8]
Your difjam looks very similar to Valve Hammer Editor ;)


Mustang(Posted 2005) [#9]
Hey thanks a lot, cool stuff!


Beaker(Posted 2005) [#10]
DifJam looks interesting. Anything that gives CShop some competition is good in my book. And I salute your decision to leave lightmapping to gile[s].

I think $39.95 is a little steep price wise. Maybe $29.95 ?

Good luck with it.


dcs(Posted 2005) [#11]
Thanks for the feedback so far guys.

@MrSAK - Valve's Hammer is such an awesome piece of software that I decided to completely model DifJam on it. By far the best feature of Hammer, apart from the fact that it made the levels for the completely amazing Half Life 2, is that the csg -> works <- and is rock solid.

@Mustang - No problem, the more stuff people share, the easier it is for everyone. :)

@Beaker - Thanks for your thoughts and good wishes. The original price I stated is based on the main competition, Cartography Shop which is $65??? But the price you talked about is to bear in mind too.

Maybe I'm misunderstanding though, but it seems to me that the concensus is, there's loads of map editors available and another one isn't needed??? I don't understand if this is the case. As I mentioned in the first post, DifJam was started as a means for people to be able to make a map easily for the Torque Engine. I mean, c'mon, have you tried QuArK, the recommended tool of Torque??? It's absolutely horrible to use. Also, DifJam has been built from the ground up in C++, wxWidgets and OpenGL so it's easy to port to MACOSX and Linux. People on the Torque Engine forums are always moaning about the need for a map editing tool, especially for MACOSX. We're almost there, sent an email to Garage Games and did we receive a reply??? I just don't understand at all???

Editors such as Hammer, Radiant and UnrealED are truly excellent, granted. Try and use them for your own productions though and see what happens on the legal side. Which brings you around to two alternatives for commercial productions... QuArK and Cartography Shop. This is why I thought there was room for another editor.

Halo has a vision with Cartography Shop, to make it an all in one engine. Whilst an admirable aim, I merely wish to make a csg level editor for whatever engine is required, be this Blitz3D, BlitzMax, DarkBasic or Torque, or some custom engine at a later date. Think I need to learn more about .so??? files on MAC and Linux first though. Or extendible through Lua or Python???

I have recently started a games company with my best friend, specialising in Java games for mobile phones. Already, we have playable prototypes and a lot of interest and it's looking like for DifJam we'll add an ability at some point to export stuff in m3g format. So this is perhaps another avenue for us to explore. Basically, I intend for DifJam to become a recognised solution for level building. And asking the opinions of seasoned Blitz3D users was something I really wanted to do. Thanks a lot.


jfk EO-11110(Posted 2005) [#12]
It seems as soon as I use a texture instead of an image for BLITZMOVIE_OpenDecodeToDX/Surface, I get the MAV. I can play this 512*512 Movie without any problem when I use an image-handle instead. I guess it's not the movie format. Probably the Hardware: Radeon 9200SE.

Here's the code I successfully use to play a small (320*240) Movie and scale it up to screen size in realtime, plus some Fake TV Scanlines to make the rough Resolution less obvious:

; BlitzMovie Decode To Blitz3D Image Demo
; (c) 2005 Harriman Software
; www.harrimansoftware.com/blitzmovie

; Many thanks to tom@... for the information on how to get at
; the IDirectDrawSurface7 contained in a Blitz3D image or texture.


;Added Fullscreen Scaling by jfk

; This example will play any movie at Fullscreen size. It is using a Pseudo TV-Scanline Effect
; that will magicly enhance the look of very small movies that are played in Fullscreen
; Mode.
; However, on TFT Crystal Displays you should set gr_w and gr_h to your physical Screen 
; Resolution to prevent an ugly Moiree Effect from the TV-Scanline effect.

AppTitle "BlitzMovie Decode To Blitz3D Image Demo (C) 2005 Harriman Software"
gr_w=1024
gr_h=768
Graphics3D gr_w, gr_h, 32, 1
gr_w=GraphicsWidth()
gr_h=GraphicsHeight()

SetBuffer BackBuffer()

; init myResizeImage(img,w,h)
Global myResizeCamera=CreateCamera() 
CameraClsMode myResizeCamera,0,1
Global myResizeQuad=CreateQuad()
Global myResizeTex=CreateTexture(1024,1024,256 Or 16 Or 32)
EntityTexture myResizeQuad,myResizeTex
EntityFX myResizeQuad,1
CameraRange myResizeCamera,0.01,100
TranslateEntity myResizeCamera,(1.0/1024.0),-(1.0/1024.0),-1.0
EntityParent myResizeQuad,myResizeCamera,1
; end of init myResizeImage(img,w,h)


movie_to_play$="mymovie.avi"

; just open it with Blitzes OpenMovie Command to get its size, then close it again :)
dummy=OpenMovie(movie_to_play$)
m_width=MovieWidth(dummy)
m_height=MovieHeight(dummy)
CloseMovie dummy
Delay 200


; create an image that we'll be decoding the movie to
Global image = CreateImage(m_width,m_height)

; Open the movie in decode to Blitz3D dx7 surface mode
result = BLITZMOVIE_OpenDecodeToDX7Surface( movie_to_play$, image)
If Not result
	BLITZMOVIE_Close()
	RuntimeError "Error loading movie! Quitting..."
EndIf

; play the movie
result = BLITZMOVIE_Play()
If Not result
	BLITZMOVIE_Close()
	RuntimeError "Error playing movie! Quitting..."
EndIf

Global width = BLITZMOVIE_GetWidth()
Global height = BLITZMOVIE_GetHeight()


While BLITZMOVIE_IsPlaying() And (Not KeyHit(1))			
    Delay 1
    dummy=myProjectImage(image,gr_w, gr_h)
	scanlines(gr_h) ; a TV Effect
	Flip 0
Wend

BLITZMOVIE_Stop()
BLITZMOVIE_Close()
FreeImage(image)

End

Function scanlines(h)
 Color 0,0,0
 w=GraphicsWidth()-1
 For i=0 To h Step 4
  Rect 0,i,w,3,0
 Next
End Function



Function myProjectImage(img,w#,h#)
; copies an image To a texture of a quad that is placed in front of a cam and then scaled to w,h
 img_w#=ImageWidth(img)
 img_h#=ImageHeight(img)
 If img_w>1024 Then img_w=1024
 If img_h>1024 Then img_h=1024
 If img_w<1 Then img_w=1
 If img_h<1 Then img_h=1

 If w>1024 Then w=1024
 If h>1024 Then h=1024
 If w<1 Then w=1
 If h<1 Then h=1

 w_rel#=w#/img_w#
 h_rel#=h#/img_h#
 g_rel#=1024.0/GraphicsWidth()

 CopyRect 0,0,img_w,img_h,512-(img_w/2.0),512-(img_h/2.0),ImageBuffer(img),TextureBuffer(myResizeTex)
 ScaleEntity myResizeQuad,w_rel*g_rel,h_rel*g_rel,0.0001
 RenderWorld()
End Function



Function CreateQuad()
  ; creates a quad, facing to the right side
  mesh=CreateMesh()
  surf=CreateSurface(mesh)
  v0=AddVertex(surf, -1.0,   1.0,0, 0,0 )
  v1=AddVertex(surf,  1.0,   1.0,0, 1,0 )
  v2=AddVertex(surf,  1.0,  -1.0,0, 1,1 )
  v3=AddVertex(surf, -1.0,  -1.0,0, 0,1 )
  AddTriangle(surf,v0,v1,v2)
  AddTriangle(surf,v0,v2,v3)
  UpdateNormals mesh
  Return mesh
End Function



dcs(Posted 2005) [#13]
@jfk - Like I said last night, send me the video that's causing the problems and then I'll debug it on this machine. Even if there's nothing wrong with the video, it might (probably will) generate the problems on my side. Send to the email address below otherwise there's not much I can do about it.


dcs(Posted 2005) [#14]
@jfk - Just thought, how do you create the texture??? What flags do you use???


dcs(Posted 2005) [#15]
@jfk - Or send me the source code to the texture stuff that's crashing your machine. I've got a fair idea of what it is if I can crash it.


Beaker(Posted 2005) [#16]
I disagree that there are too many level editors. There are currently:

CShop - not everyones cup of tea for various reasons.

Maplet - not really sophisticated enough for anything but the most basic levels. No longer in development.

Quill3D - not really supported anymore and quite clunky. No longer in development.

DeleD - not tried this one. Looks very promising but isn't Blitz specific.

You can of course use some of the Quake/Halflife editors and translate. But I think there is a real need for a flexible Blitz specific editor, especially if it is b3dPipeline, gile[s] and BlitzMax aware.


Barliesque(Posted 2005) [#17]
The 3D Example EXE file included in the download crashes. I've recompiled it and it runs without crashing, but there does seem to be a problem with playback of the video: The cube (or its texture) flickers badly, and the frame rate drops to about 1 fps.

I'm running an NVidia FX5800 (with dual display) with 128MB VRAM, WinXP SP2, P4 3GHz with 1GB RAM.

CShop has always been *almost* terrific, but a big disappointment in various different details with every revision. I would *love* to find a solid competitor that does just what you've described. I also agree--leave lightmapping to gile[s]

One major feature that I'd like to request for DifJam is the ability to optimise the result for use as a polygonal model, since this is sometimes preferable. That would mean automatically removing hidden surfaces automatically generated to maintain convexity for brushes.

As for price, I think around $30 is a good start. As you develop it further, you can always increase the price a bit to match the growing feature-set.

I would be happy to beta-test for you, whenever you're ready. My dual-display setup is good to test on, since this sometimes causes problems that developers miss.


dcs(Posted 2005) [#18]
@Beaker - Thanks for your thoughts. I had a look at DeleD the other day. Looks really cool but I couldn't find a carve function??? Maybe it's me. Which Quake / Halflife editors have you used??? Do you mean Hammer and Radiant???

@Barliesque - I applied the 1.89 patch to Blitz3D the other day. Wonder if that has anything to do with it crashing on your machine before you recompiled it??? I have a dual display here too and the demo works fine. Strange. Thanks for the offer to beta test DifJam. It should be at that stage in a couple of months. How does the 2D demo do on your machine??? Is it running at 1fps too???


jfk EO-11110(Posted 2005) [#19]
I will send you a zip in a few hours with a little powers-of-two movie that's crashing on my machine, plus the code I was using.

EDIT: ok, sent.


Barliesque(Posted 2005) [#20]
The 2D demo works great. Perfectly.

I'm still on patch 1.88, so yes, maybe your 1.89 compile had something to do with the flickering.

JFK's full-screen demo also works perfectly, with "640x480.wmv" as the movie. That's a 3D demo, so I tried making some minimal changes so that it would play back on a cube, and lo-and-behold, it works! What exactly is the key difference between these two programs that's making the difference, I'm not sure...


jfk EO-11110(Posted 2005) [#21]
The diffrence of the 2D and 3D examples of the release is: the 2D example tells DirectShow to render the movie into a Blitz image buffer, while the 3D Example forces it to render it directly into a texture buffer. When rendering to a texture, the Movie size must be a power-of-2 size, like 512*512, or 512*256, just like textures have to be as well.

I don't know why rendering to textures didn't work on my machine. It would be nice because in my fullscreen example I had to move the movie from the image to the texture using a copyrect command. Although with texture flag 256, it is still pretty slow. At the other hand we have to see, that the limitation to the usage power-of-2 movies in texture mode also makes it pretty useless for a lot of things (eg. a simple Movie player that should be able to handle any movie size).

However, what I really (still) need, is the ability to play a movie frame by frame. Oh yes, and to play multiple movies simultanously.
I made this working using api commands mciSendString, but the Movie canvas was only a window that was parented and hooked to the blitz window, so although I had the movie in blitz, I was not able to access it on the backbuffer or frontbuffer. At least not by a bitblt command. Using Desktop Pixel-reading worked, but was very slow.


jfk EO-11110(Posted 2005) [#22]
diamondback_uk, I have a further question. There is one thing that would help me/us a lot. This would be a DLL that takes an external window handle and a BLitz Image handle plus x,y,w,h and then makes a Bitblit operation from the window directly to the Blitz image buffer. The BITBLT operation is trivial API stuff. But I still have no clue about how to redirect BitBLT to a Blitz Image.


Barliesque(Posted 2005) [#23]
The diffrence of the 2D and 3D examples of the release is...

No no, I mean what's the difference between your 3D demo and the 3D demo with BlitzMovie? Yours works, but the other doesn't, on my system.

...in my fullscreen example I had to move the movie from the image to the texture...

Ahhh... So yours works because it's using the same rendering technique as the 2D demo, and then copying it to a 3D texture. So the problem that I'm seeing is specifically with rendering video directly to a texture.

...the limitation to the usage power-of-2 movies in texture mode...

BlitzMovie could play back any sized video to a power-of-two canvas--so a 640x480 video would be pasted onto a 1024x1024 texture, with unused areas remaining black. Then you could simply adjust your UVs accordingly.

However, what I really (still) need, is the ability to play a movie frame by frame. Oh yes, and to play multiple movies simultanously.

And don't forget, the ability to control the volume of individual movies. :) ...actually, what would be even better would be the ability to play a movie's sound to a 3D audio entity, so you can position it in 3D space... but maybe I'm getting carried away now.


jfk EO-11110(Posted 2005) [#24]
BlitzMovie could play back any sized video to a power-of-two canvas--so a 640x480 video would be pasted onto a 1024x1024 texture, with unused areas remaining black. Then you could simply adjust your UVs accordingly.

From what diamondback_uk said, you HAVE to use powers of two movies in texture mode. Check the manual.

Some time ago i had the idea to create a complete video cutting solution, by mixing audio in realtime, and record the audio to a wav file in the same time. And of course also Cut/Fade the trimmed Video Scenes etc. Kind of a Tracker with Videotracks. But I gave up since it can't be done in Realtime, and Saving WAV files from within Blitz is also not an exact science, as far as I see.

A nice idea, but a lot of work. Now that I have bought MAGIX Video Deluxe, a 16 Tracks Video Cutting Solution, I have lost my motivation for such a big project. But there are still some things that I am missing. The Bluebox Functions are kind of poor, EG. they don't offer smoothing contours after mixing the frames. This is where blitz comes in - well I thought so. But as long as it takes an hour to load each frame of a movie that is only 5 Minutes long (due to GetPixel), this is only a hypotesis.

I gave up the Audio thing, I have a commandline tool that extracts the audio from a movie in a second. The user may add the Audio line manually, wich is a tiny task.


dcs(Posted 2005) [#25]
@barliesque - from what other people have been saying in their emails, it seems the black flickering is being encountered when using textures with mipmaps. The manual does say though that mipmapped textures are not recommended. Glad it's working on your machine though.

@jfk - yeah, using powers of two textures for decode to texture movies is required at the moment. I actually have some code in the dll that can scale from any size to a power of 2 texture size, it's in assembler too. However, it's just best to make sure your movie is a power of 2 like you said.

@barliesque - you could adjust the uvs, yes. I never thought of that. As I'd mentioned above though, the existing solution was to scale to the power of two image. I wanted to make it as simple to use as possible for Blitz users. I didn't even know you could adjust uvs in Blitz :) .

I'll be releasing BlitzMovie 1.3 this weekend but it'll only be some bug fixes and a slight change to the api.

Thanks to everyone for all your comments and feedback, it's really appreciated.


dcs(Posted 2005) [#26]
@jfk - Just remembered about the question you asked about the dll that can take an external hwnd and blit from a b3d image??? It would take 10 minutes if you want me to code it for you. If you're interested, I'll make it over the weekend. I'm confused though, where would the HWND come from??? From Blitz3D???


jfk EO-11110(Posted 2005) [#27]
In my Version the HWND was the MCI Aviplayers own window handle (that is returned by mcisendstring status...).
The idea was to use mci Command Strings to play avis, with the entire range of commands (eg. open multiple movies). Mci opens a "window" to play Avis. You can then set the parent window for this movie window-canvas. Although this canvas is now a child of the Blitz window, it wasn't possible to capture the movie frames on the Blitz Window. So I used Bitblit. But even Bitblit didn't allow to grab the frames on the Blitz window, for some strange reason. I then used Toms Blitz Imagebuffer Adress Hack to copy the frame content after a Bliblit to a Blitz Image buffer.(well, it was a complicated multi-step solution from mci via Bitblit to a Bitmap that was created using CreateCompatibleBitmap, then the bitmap was copied to the blitz imagebuffer, using the bended/hacked vector) It worked, although it was pretty slow. I made some benchmark tests and it turned out that bitblit was the slow part.
So if there is a way to move an avi frame from the player directly into a blitz image buffer, this would be fast. Everything else seems to be too slow.

BTW the Imagebuffer hack is based on the fact that Imagebuffer(img)+72 returns the Image Data adress. (Of course, pretty dirty code) A Bank handle has its data adress at offset 4 (bank+4) and the size of the bank at offset 8. So it's possible to steal/bend a bank handles vector and redirect it to an Image Buffer, by writing the adress of the imagebuffers data adress to bank+4 and the size of the image to bank+8 (using RTLMoveMemory). You can then use Userlib commands to receive data directly in a blitz image buffer. Of course, prior program termination the bank should be restored to it's original state (so the content of bank+4 and bank+8 after creation must be backed up.


Apocalypse(Posted 2005) [#28]
So if there is a way to move an avi frame from the player directly into a blitz image buffer, this would be fast. Everything else seems to be too slow.


That is exactly what my AVI functions do...

http://www.blitzbasic.com/logs/userlog.php?user=7138&log=440


jfk EO-11110(Posted 2005) [#29]
I am really glad that a high number of people started trying to help to solve my movie problem. Apocalypse, I saved your DLL and will test it asap. Currently I should do some non-blitz work. I just came here to aswer a few things. I think and hope I'll find more time this weekend.


dcs(Posted 2005) [#30]
@jfk - If all you want to do is play a movie frame by frame, let me know and you won't need any of this "mci" and external blit dll stuff. Using this as a way to play movies frame by frame, through dlls to try and get at the frame data is not only futile but just making BlitzMovie's development a waste of time. BlitzMovie is extremely fast inside, none of this external "mci" stuff through a dll will be able to hold a candle to it. And if playing a movie frame by frame is all you're interested in, I'll implement it using DirectShow in BlitzMovie. Shouldn't take long. Let me know if this is what you're after and I'll add it to BlitzMovie over the weekend.

@Apocalypse - The trouble with "mciSendString" is that it's pretty much useless. DirectShow isn't hard to program without a reason.


Apocalypse(Posted 2005) [#31]
The trouble with "mciSendString" is that it's pretty much useless. DirectShow isn't hard to program without a reason.

I agree. MCI is almost worthless if you want full control over the AVI. I use the Windows AVI library personally.


dcs(Posted 2005) [#32]
AVIFileOpen and the like??? A lot better than mciSendString. But still not as good as DirectShow.


dcs(Posted 2005) [#33]
@Apocalypse - Just looking at the Windows AVI library and it looks to be pretty good. Using AVIStreamGetFrame to get a frame and blast it to a Blitz3D texture or image is what I was doing with DirectShow until I learned how to get at said texture or image and unpack the frame straight to it negating the need for the intermediate blit step. Unfortunately, I can't see how you can do that with the Windows AVI lib :(. Looks good otherwise. Would be good for a compressor. Might use that for the BlitzMax version of BlitzMovie, to convert formats to theroa format. I have code to almost do this using DirectShow, using the ISampleGrabber interface but I like the look of this Windows AVI API. Thanks. :)


Apocalypse(Posted 2005) [#34]
The AVIStreamGetFrame function automatically decompreses the frame to an output format of your choosing. I use a 24bit RGB format. Once I get the frame, I find the DX Surface pointer to the Blitz Image, Lock the surface and get a DC, then use StretchDIBits to Blt the pixel data. This function does format conversion from the original 24bit format to whatever the destination format is, plus it will scale the image.


Apocalypse(Posted 2005) [#35]
BTW Diamond, I know how to get at a Blitz Image surface. Is a texture done the same way?


dcs(Posted 2005) [#36]
@Apocalypse - That sounds really cool. The surface you get from Blitz3D always seems to be 32-bit. I haven't come across any other type yet. Have you in your experiments??? A 24-bit to 32-bit blit should be quick then. In theory it should be as fast as BlitzMovie. Have you benchmarked it??? Would be interesting to know. Just like BlitzMovie, I'd imagine it's faster for you if your users make the films powers of two so there's no scaling. Sounds good. Never thought to look at that when I started BlitzMovie.


dcs(Posted 2005) [#37]
@Apocalypse - Getting a texture is a bit different to an image...

For image I've got:

buffer = (unsigned int) *((int*)(buffer + 4));
buffer = (unsigned int) *((int*)(buffer + ( 4 * srcFrame )));

dd7surf = (IDirectDrawSurface7*)*((int*)(buffer+12));

and for texture I've got:

buffer = (unsigned int) *((int*)(buffer));
buffer = (unsigned int) *((int*)(buffer + 12));
buffer = (unsigned int) *((int*)(buffer + (4 * srcFrame )));

dd7surf = (IDirectDrawSurface7*)*((int*)(buffer+12));

There's also detection code so you could pass in an image or a texture to the same function and decide which one you need...

if( *((int*)(buffer+8)) == 0) // texture!
{
}
else // image
{
}

However, this seems to be extremely unreliable (I've had LOTS of crashes reported just because of this) and I've scrapped it for the up and coming BlitzMovie 1.3 so the user has to specify explicitly whether they want to decode to a texture or a surface.


Barliesque(Posted 2005) [#38]
I've had an idea sitting on the back burner for a while, that I'll get to eventually. I've always had in mind that BlitzMovie would be a possible solution. Essentially, what I want to be able to do is create a 2D cartoon character animated in an AVI file (with alpha channel) and play back appropriate sections of that AVI, at a controllable speed, to place that character into a 3D cartoon world.

So this could be done with the feature JFK is asking for: the ability to play specific frames. My program would take control of speed of playback. My question about this is, what kind of lag might occur when jumping between frames that might be at frames that are far from eachother?


dcs(Posted 2005) [#39]
@Barliesque - I'm going to implement playing ranges of frames over the weekend if I get time. Not sure about the lag without looking at it but off the top of my head, I'd say it'd be minimal. Not sure about changing the speed of playback. Is that what you meant??? Would have to look at how long this would take to implement.


Apocalypse(Posted 2005) [#40]
I clocked the StretchDIBits Blit at 4.7ms.


dcs(Posted 2005) [#41]
I give up.


Barliesque(Posted 2005) [#42]
What I meant was that if there were a call to simply go to a particular frame (and remain paused on that frame until further instruction) then speed of playback could be controlled with my own code in Blitz3D.


jfk EO-11110(Posted 2005) [#43]
Diamondback_uk - you give up? What do you mean? Please don't give up the blitzmovie project!
Barliesque : as far as I know the speed of the position command (setting the player to a certain frame) depends heavily on the compression codec. While in uncompressed Avis the player simply jumps to the frame you want, in compression codecs with keyframes it first has to jump to the last keyframe prior the wanted frame, then calculate all frames up to the wanted frame. On slwo computers this may take a lot of time, eg. on MP4 codecs it may take several seconds.
Playing the movie frame by frame is a lot faster, although still not 60 frames per second or so, when you have a big resolution, like eg. 720*576 Pixels (that's what I use it for, PAL DV-Camcoder format).

Currently I am working on a Bluebox App (well in fact it may use any masking color, prefered green these days), that is capable of putting a masked frame on a background frame, then recognize the contours of the masked object and blur them with the background, in respect to the interlaced Frames (BFF,TFF or progressive). Right now it needs folders with series of frames, but I'll be lucky when I once can deal with Avi movies as source too.


dcs(Posted 2005) [#44]
@Barliesque - "I give up" wasn't directed at you. I'm just really sick of adverts for other movie dlls in this thread when it was supposed to be about BlitzMovie. You can't see the post that made me angry now, it's been edited but I've put so much time into this library and people trying to take advantage of people's interest, interest generated by BlitzMovie just did my head in, hence no more BlitzMovie.


jfk EO-11110(Posted 2005) [#45]
So you really want to stop with BlitzMovie, only because the alternatives have been mentioned? For me your DLL is now one of the most promising approaches, I hope you don't mind if I tested other things too. As for adverting other movie solutions in this thread, it may be kind of unsensitive, but it really isn't that fatal, is it? BlitzMovie has made great progress and I'd be disappointed if you stop it only because of this.


Apocalypse(Posted 2005) [#46]
Sorry if I stepped on your toes diamondback_uk. I was discussing JFK's AVI issue in two other threads and did not realize I was posting in your BlitzMovie thread. That is why I erased the offending post.

I offer a most sincere and public apology.

JFK: I will talk about your issues in your Blt thread and my Helper DLL threads from now on.


Beaker(Posted 2005) [#47]
I'd really like to see a way to step thru frames, seekframe etc (as jfk is asking about). I don't think it matters too much if there is a delay as it draws keyframes etc, as long as it was intelligent enough to recognise when you don't need to do this (ie. when the last frame drawn was the preceding frame).

Nice work.


Barliesque(Posted 2005) [#48]
@Diamondback: I hadn't taken that reply as directed at me. I was replying to your earlier question, "Is that what you mean???" :)

Unless you're absolutely convinced BlitzMovie can't do better than whatever other library was mentioned, I certainly hope you're not serious about throwing in the towel. Don't let a little forum-babble get you down. You've done a fine job so far.


dcs(Posted 2005) [#49]
@Apocalypse - I'm sorry for being too hot headed (a very bad trait of mine) and I'd just like to say, your dll is looking really good. Keep up the good work.

@everyone else - BlitzMovie is back on and I'll try and have 1.3 released and the site back up by Sunday night. Frame seeking will probably be a couple of weeks yet. In the mean time, you might want to check out Apocalypse's library which can handle the frame range thing. I'm full time on my editor now, especially as I've recently received a reply to my emails from Garage Games.

Sorry for being hot headed :( and I hope everyone has a good weekend. I feel really silly now but I'm quite new to forums. I don't normally spend much time on them.


jfk EO-11110(Posted 2005) [#50]
Good news, phew! Enjoy the weekend!


Barliesque(Posted 2005) [#51]
Hi again, diamondback-- I've downloaded the new 1.3 version but unfortunately still find that playback to the 3D cube has the same problems.


dcs(Posted 2005) [#52]
@Barliesque - Just wondering, did you try recompiling the source code to make sure MipMapping is off??? What happens if you put a Flip 0 there instead of plain flip???


Barliesque(Posted 2005) [#53]
I've recompiled, and tried with Flip 0 --which just makes the 3D render FPS jump up, without affecting the video frame rate (updates about once every two seconds) or the flickering of the cube.

Any other tests you'd like me to run, just let me know.


dcs(Posted 2005) [#54]
@Barliesque - When you say the movie is playing at 2fps, does the movie actually look right still??? I mean, are the colours wrong or anything??? Or is just that it's running really bad. Just for a test, I remember you said you have dual display, what happens if you switch to single display and then run it??? I have a dual display too and the other day I happened to notice that you can turn on / off acceleration for both displays. I guess it might be worth checking that acceleration is enabled for both your outputs.


Barliesque(Posted 2005) [#55]
I get the same results with a single display. Just to clarify, I would say that the movie plays at the correct speed *internally* but I only see the texture updated roughly every two seconds--but the rate is pretty erratic. The image flickers at a quick rate--sort of like a movie projector effect. Other than that the image quality is perfect.

I haven't seen anywhere that I can turn on acceleration for both displays. What version driver are you using? Blitz certainly is not accelerated on both displays; however some other programs will (possibly just OpenGL applications) run with acceleration on both.


dcs(Posted 2005) [#56]
@Barliesque - I've a hunch my new thread code is what's causing the stuttering. I'm using the latest nVidia drivers off of their site, 71.84???

I'll have a look over the weekend and see if I can spot errors. If it's ok with you, I can send you a dll with error reporting and stuff included.

Btw, I just tested BlitzMovie on my setup and it is accelerated on both displays, even if I move one half on display 1 and the other half on display 2. Strange.

Lastly, are you using the latest nVidia drivers too???


Barliesque(Posted 2005) [#57]
Well, it turns out to have been quite a while since I last updated my drivers. I've just done that and retested (to version 71.84) and... no change! I thought that was bound to solve it, but there you go. So maybe it's the multithreading code as you suspected.

I'll be happy to test any new dll's you'd like to send. (Click my username to get my e-mail address)

Hey, this new driver gives me *much* better performance on the secondary monitor--still not as good as on the primary monitor, but not bad. Still can't find an option to turn on/off 3D acceleration per display.


dcs(Posted 2005) [#58]
@Barliesque - Sorry about the delay in replying. Can I just ask you one more thing??? Does the 2d version of the movie stutter too??? I'm going to have a good look at it soon.


Barliesque(Posted 2005) [#59]
No, the 2D one has no problem.


robert8192(Posted 2005) [#60]
are any of you programmers using a management element? I may have access to a management team who are very good. They have boosted my official CODE OUTPUT by 400% . If interested - please reply to mailto : r_twiddy@...