Jump to content
The Dark Mod Forums

Playing in-game Videos


Recommended Posts

Delete "blend gl_dst_alpha, gl_one"  from the material file:

video/video
{
	qer_editorimage textures/editor/video
		nonsolid
		translucent
		noshadows
	{
	videoMap loop video/video.mp4 // with separate sound file
		remoteRenderMap 512 288 
		red		1
		green	1
		blue	1
		scale 1, 1
		translate 1, 1
		
	}
} 

You can also copy the code, paste it below below and call it video/video1 and link to video/video1.mp4

Spoiler

video/video //transparant
{
    qer_editorimage textures/editor/video
        nonsolid
        translucent
        noshadows
    {
    videoMap loop video/video.mp4 // with separate sound file
        remoteRenderMap 512 288
        red        1
        green    1
        blue    1
        scale 1, 1
        translate 1, 1
        blend gl_dst_alpha, gl_one
    }
}

 

video/video1 //non-transparent
{
    qer_editorimage textures/editor/video
        nonsolid
        translucent
        noshadows
    {
    videoMap loop video/video1.mp4 // with separate sound file
        remoteRenderMap 512 288
        red        1
        green    1
        blue    1
        scale 1, 1
        translate 1, 1
       
    }
}

If you want to use more then one video you also have to make more of these materials. >  !!See @stgatilov's comment above!!

Edited by STRUNK
  • Like 1
Link to post
Share on other sites
  • Replies 60
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Silhouette mage: video

Not sure if TDM supports all Opengl blending options but I don't see why not, here are some links: https://learnopengl.com/Advanced-OpenGL/Blending Search for "Stage Keywords" in the link be

Does TDM still supports ROQ? If so is that performance loss also for ROQ files? I don't remember them being so heavy. 

17 hours ago, STRUNK said:

An other example of what can be done with thes transparent video screens.

Please keep in mind that playing a video takes a lot of resources. You might be OK with one such video on a test scene, but if you start filling FM with them, you will have performance problems quickly. Having 10 videos is like opening 10 VLC at the same time.

EDIT: Moreover, I believe I never tested more than one video playing simultaneously... ever. Given that every such playback runs on several CPU threads with synchronization, nobody knows what could happen.

  • Like 1
Link to post
Share on other sites

@stgatilov

That is also something to keep in mind. Maybe if you want to have 4 different small scenes you can make a "multiview" setup so only 1 video is playing, and you can enlarge/shift the texture to the show the desired scene.

multiviewer-4k--2k-4-hdmi--2-dp--1-vga-a

Edited by STRUNK
  • Like 1
Link to post
Share on other sites
16 minutes ago, STRUNK said:

Delete "blend gl_dst_alpha, gl_one"  from the material file:

 

That works okay for the "lady in window" video because she has nothing behind her.

Any non-transparent video patch that has something behind it will paint the black areas of the image black, which doesn't work for the owl situation.

Can the video frames be painted with an alpha channel background, to get rid of the black, and be truly transparent for both transparent and non-transparent videos?

Link to post
Share on other sites

@grayman

Never heard of that and I certainly don't think it would be something that can be done with an mp4. In a video editor you can, but you can't export it as such.

Have you tried putting more patches behind eachother?

Left is 1 patch, right 6 patches 0.125 behind eachother

STRUNK-2020-03-31-19-57-04.jpg

Edited by STRUNK
  • Like 1
Link to post
Share on other sites

RE alpha channel, I did a quick Googling.

The world agrees with .mp4 being no good for alpha. Some hints that a promising direction would be to capture in Quicktime RGB+Alpha in a .mov container, then transcode (e.g., with ffmpeg) to uncompressed (raw) RBGA in an AVI container. Or maybe lossless RGBA with the Lagarith codec (is this still Windows only) in an AVI container?

No guarantee any of that would work within present TDM, methinks.

Link to post
Share on other sites
3 hours ago, STRUNK said:

@grayman

Have you tried putting more patches behind each other?

 

No, but given the comments about performance drop-off with multiple videos, plus having gotten my owl to the point where he looks acceptable, I'm not going to do this.

After a couple hours working on the owl, I'm going to leave him as is and move on to other things.

Thanks for the help.

Link to post
Share on other sites

@grayman

Let's test preformance with 1 video and multiple screens in a test setup:

252 screens - 23 fps

STRUNK-2020-03-31-23-21-46.jpg

18 screens - 36 fps

STRUNK-2020-03-31-23-23-29.jpg

6 screens - 37 fps

STRUNK-2020-03-31-23-32-31.jpg

0 screens - 40 fps

STRUNK-2020-03-31-23-24-21.jpg

//Since it's the same video, having 1 or some screens doesn't really matter it seems.

 

 

4x6 screens, 4 different videos - 17fps

STRUNK-2020-03-31-23-49-47.jpg

4x1 screen, 4 different videos - 17fps

STRUNK-2020-03-31-23-54-01.jpg

//Using more videos ( in the same location?) really seems to be a bad idea.

 

Edited by STRUNK
  • Like 1
Link to post
Share on other sites
18 hours ago, grayman said:

That works okay for the "lady in window" video because she has nothing behind her.

Any non-transparent video patch that has something behind it will paint the black areas of the image black, which doesn't work for the owl situation.

Can the video frames be painted with an alpha channel background, to get rid of the black, and be truly transparent for both transparent and non-transparent videos?

You could try making a separate alpha mask for each frame and on the material use makeAlpha() like nbohr1more suggested here

  • Thanks 2
Link to post
Share on other sites

@HMart

Well, making alpha masks for each frame and so on sounds complicated and I didn't get the material sugessted there to work BUT ... I did find a way to make the video transparent in a way that no stange things happen when there is a skybox in the background, with "blend add" !! So that makes the material a lot better!

@grayman

Improved material file for the transparent video:

Spoiler

video/video_transparent
//Transparent video screen that plays and loops video_transparent.mp4 from the video folder, used for special fx.
{
    qer_editorimage textures/editor/video

    {
    blend add                        //Make transparent, where black is fully transparent
    
    videoMap loop video/video_transparent.mp4    //loop = loop video, video is without audio
    
    green    1//
    blue    1//Intensity of the colors, from 0 to 1, where zero is fully transparent
    red        1//
    }

}

If you want to replace the code in the mtr you're already using, without changing video name and texture, use the following:

Spoiler

video/video
//Transparent video screen that plays and loops video_transparent.mp4 from the video folder, used for special fx.
{
    qer_editorimage textures/editor/video

    {
    blend add                        //Make transparent, where black is fully transparent
    
    videoMap loop video/video.mp4    //loop = loop video, video is without audio
    
    green    1//
    blue    1//Intensity of the colors, from 0 to 1, where zero is fully transparent
    red        1//
    }

}

 

For everyone who wants the video material for non-transparent and transparent video download it below:

 

 

videoscreen.mtr

Edited by STRUNK
  • Like 1
Link to post
Share on other sites
52 minutes ago, STRUNK said:

@HMart

Well, making alpha masks for each frame and so on sounds complicated and I didn't get the material sugessted there to work BUT ... I did find a way to make the video transparent in a way that no stange things happen when there is a skybox in the background, with "blend add" !! So that makes the material a lot better!

I would imagine this would be very useful for animated silhouette's visible in windows (people, animals). That being said, would using silhouette's and decreasing the video bitrate help with fps?

Regardless, using a videoscreen in key area's would immensely help in selling the mission as a living breathing world. I'm super excited to eventually implement this. 

Edited by refl3ks
Link to post
Share on other sites

@refl3ks

The problem with silhouettes is that they are usualy black .. and that is the color that gets fully transparent, but you could use the non-transparent with a background behind the silhouette. You have to animate the silhouette in the video already, since the background (usually) is stationary.

But, there are a lot of things thinkable within the possabilities.

  • Like 1
Link to post
Share on other sites

Hmm ... I found out that I get hickups looking around, when walking/running  around a room with 1 videoscreen in it. With the  55 second OwlLoop it's far worse then with the one second goat loop, where It's barely noticable, but it's also there.

@grayman

I was just gonna post this. Can you try running and looking around in your map and see if hickups appear?

Edited by STRUNK
Link to post
Share on other sites

That got really wrong : D

STRUNK-2020-04-01-22-45-58.jpg

Also there are these hickups ...

Seems these video screen fx (indeed @stgatilov) draw a lot of recources. I Looked at the fps in my diorama map, and is was 13fps, facing the diorama, when I turned around (hickupy) it got to 60fps.  So be carefull!

Edited by STRUNK
  • Like 1
Link to post
Share on other sites

@HMart, TDM still supports ROQ, if for no other reason to not break the existing FMs that use it. I suspect the main reason ROQ seems lighter weight is that was deployed at a time when monitors were not so high rez. So if you create or downsize your .mp4 to, say, 800x600 or 640x480, you might not see the hickups. That would make sense particularly if not needing full-screen display (nor STRUNK's multiple-window approach). With full-screen, real low rez would look a lot poorer visually.

Related to @STiFU's point, I guess I'll commit to creating a wiki page about transparent videos (and ghosts), once the dust settles a bit more. This would be based mainly on the recent discussion here, particularly the wonderful work by @STRUNK

Link to post
Share on other sites

Expanding on that first point, the MP4 format is flexible with regard to resolution dimensions, but if not doing screen capture - that is, if using real-life owl videos - probably standardized lower rez to consider are:

854 x 480 (16:9 480p)

1280 x 720 (16:9 720p)

Link to post
Share on other sites

@STRUNK, would you consider doing a quick experiment, with and without your blend change, to see what the effect on hickups and framerate are? I'm thinking the blend would take more resources, but could be wrong. If blend did cause more load, then maybe deploying it should be avoided in some cases (i.e., where the skybox is not an issue).

Link to post
Share on other sites

@Geep

Seems like the hickups are the same with a transparent and non-transparent screen, also framerate is the same.

@grayman

I tried converting the Owl to 480p 16:9 and then I notice NO hickups anymore, and the quality doesn't seem to be changed in game, so that's good news!

Edited by STRUNK
  • Like 1
Link to post
Share on other sites

Another thought related to performance with video. The RoQ .mtr example (see https://wiki.thedarkmod.com/index.php?title=Playing_ROQ_Video_Files ) had a keyword "linear" on a separate line following the "videomap..."  When I was messing around with .mtr for full-screen cutscenes, this keyword didn't seem to have any purpose. But perhaps it's helpful for performance, like avoiding hickups?

Edited by Geep
typo
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...