Learn to Configure the OldTV MME Effect!
OldTV is an amusing effect that allows your video to look as if it was shown on a *really* old TV set – old-fashioned oval screen, dense static, badly untuned carrier frequency – all the niceties of the archaic age of technology. In its original state it makes the picture practically illegible and usable only for short glimpses – but there’s more to it.
Using OldTV is really simple!
First, of course, you need to DOWNLOAD MME from the LearnMMD Downloads Page, if you haven‘t done it yet. Then you download the OldTV itself from its home page. Unpack it into UserFile/Accessory/Effects folder of your MMD residence, load OldTV.x in MMD‘s Accessory Manipulation panel – and this is it, easy as pie. Turn it off and on when necessary with “Display“ checkbox, and you‘re good to go.
What if you actually *don‘t* want the image in your video to be distorted beyond recognition? What if ye olde TV is not really *that* olde? Well, there‘s an undocumented trick to control the level of distortion to your needs.
Open the file OldTV.fx in the Notepad or other simple text editor you use. Scroll down to the lower part of it. In the next-to-last block of text, you will find following lines:
// … and finally distort
img.x += distortionScale * noisy * dst;
float4 image = tex2D(Image, img);
And now add your own multiplier to it:
img.x += distortionScale * noisy * dst * 0.2;
Save the file and look how the output has changed (you don’t have to reload the effect for that). Now you can actually *see* what happens on the screen! There‘s still distortion, but it doesn’t prevent you from getting the picture. By changing the multiplier to zero, you can disable the distortion completely, leaving only static and oval frame components of the effect.
Let’s see what else we can do with this effect.
Right next to the fragment we just edited, there’s this text:
// Combine frame, distorted image and interference
image.rgb += interference * rand;
image.rgb *= frame;
image.a = 1;
Hmm, does it look like what I think it does? What if I comment out a suspiciously looking line?
// image.rgb *= frame;
Check the effect again… What do you think, the frame is gone! Well, all right, maybe you liked it. But point is, now you have choice.
Now for the static component. It is neat… but for purposes I had in mind when looking for a suitable effect, something else would be more appropriate… Let’s look at those two .dds files that the effect uses. GIMP can open them if you provide it with a necessary plugin. One of them looks like some weird cloud, and another… well, it’s static! By close examination, we can see that the file consists of 64 frames, each with a different random pattern. Apparently, these frames rotate between each other, creating the effect of noise.
Now, let’s replace it with something simpler. Just one layer of the file will be enough.
And the result is…
(blinking of raster lines isn’t part of the effect, it’s what the AVI renderer did to a picture)
What else can we change?
Our raster lines are nearly perfect… but just to add the cherry on top, can we make them float? Remember the name of the texture that we changed? It’s Random3D.dds. Let’s see where in the script it is used and how.
string ResourceName = “Random3D.dds“;
sampler Rand = sampler_state
Texture = (Rand_Tex);
// Interference … just a texture filled with rand()
float rand = tex3D(Rand, float3(1.5 * pos, time_0_X)).r – 0.2;
That’s the part that forms an image of static noise (and now, with our new texture, raster lines) that is later applied to the final picture. By playing with numbers in this formula, we can figure that the 1.5 multiplier changes thickness of our raster lines, so apparently… what if we change it a bit?
float rand = tex3D(Rand, float3(1.5 * pos + 0.1, time_0_X)).r – 0.2;
Now if you save the script while MMD window with the effect still works and keep close attention to the screen, you’ll notice that our raster lines shifted a bit down. Now, if only we could make that addend change its value automatically, then raster lines would scroll down by themselves. But how? Keep exploring the script further.
The second coordinate in the formula above has a rather suggestive name: “time_0_X”. We no longer use multiple-layered .dds file, but originally the script selected one of many pictures packed in it, based on… time? Where do we get it from? Search the program for the name and find
float time_0_X : TIME;
You can bet your hat that this way the script gets current time using a standard function… in other words, a variable that increases itself automatically. Just what we needed! Now let’s modify the script once more:
// Interference … just a texture filled with rand()
float fracttime = time_0_X/20 – int(time_0_X/20);
float rand = tex3D(Rand, float3(1.5 * pos + fracttime, time_0_X)).r – 0.2;
The added line gets a fractional part of the time-based value that we can add to coordinates of a pixel we extract from the texture – the texture that is responsible for appearence of raster lines. Now we see them actually scrolling down! By changing the divider 20 to something else, you can regulate the speed of scrolling, if you want to.
This is it. *That* is the effect I looked for!
Do you think that’s all you can do?
In the next episode… Sliders! Learn to improve OldTV further, making it adjustable straight from MMD!
– SEE BELOW for MORE MMD TUTORIALS…