Multiimage - JM clarification please
#16
i just updated to cvs and i 've to say tnx to jm for the loop tag Wink
i'm really having fun testing this new great toy, i'm using rad video tools to convert videos to any kind of image and i can make animations of any size, i just need to pay attention to the frame rate.
for what i see now seem like a 10-15 frames per second set in radtool is enought to have a good movie without loss of fps in xbmc.
btw this control can be used for a lot of more things than just a short movie, the whole skin can be now animated without loss of memory.

edit: here is a sample from pgr3 trailer:pgr3 sequence

or here if the first link doesn't work



XBMC Italian translator, Movieplayer.it scrapers developer and the old "The Orbs" skin creator.
Reply
#17
Using images that are saved at 60% opacity. Using the fade transition. The previous image shows until the end(slightly). But then it the pops out.

Could there be a tweak added to this control, that would fade it completely out as the new image fades in?

If it does this now. Then sorry.

Thanks

Edit: Something else that might be useful. (I didn't see in the manual or source) Is a file type mask.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#18
It should fade smoothly from one to the other. If it isn't on a couple of pics, then please post them and I'll take a look.

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#19
http://xbmc-scripting.googlecode.com/svn...laxies.zip

Here's two folder of pictures. The galaxies are the semi transparent that overlay each other.

The other one pop up at different spots of the image.

Thanks
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#20
two request for multiimage now. I did not see in the manual.

a pause attribute that applies if loop="true". e.g. cycle an image every half second and freeze on the last one for two seconds, then loop.

and

as mentioned above, have the previous image fade out as the new image fades in. (good for non full opacity images.)

If possible Smile
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#21
How it works is that the new image fades in while the old image is still rendered at full opacity. Once the new image is fully faded in, the old image is removed.

This is the "popping" you see, as the previous image can still be seen underneath the new image. I can possibly change it so that the previous image fades out before disappearing, the procedure would be:

1. Show current image.
2. Start fading in next image, over the top of current image.
3. When next image is fully shown, start fading out the previous image.
4. Remove the previous image once it's fully faded out.

One (possible) problem with this is it means that the "show time" for an image must be at least twice the "transistion time".
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#22
That would help.

Without understanding the actual code, I will just ask. Is it not possible to fade both at the same time?

This would work better imo. But if not possible, then yes please fade the previous image before removing.

Thanks
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#23
Yes it is, but it will not give you (quite) what you want.

At half way through, you get 50% opacity of both images (multiplied by whatever opacity each image is), which means that overall the image is darker than it was before (due to the black background underneath).

This gives a "pulsing" look that's not particularly gratifying to the eye.

Thus, we fade in one image completely over the top of another one, then fade out the one underneath. The alternative is some sort of nonlinear cross fade.

I'll have a play with the fade in then fade out and see what it looks like.

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#24
Hi JMarshall,

I don't know if this script works the same as if you were to do it in code, but heres a test script.

The first time or every odd time you press a button other than back or B, both images fade in/out at the same time. the next time or even the second image fades in, then the first fades out.

To me both fading at the same time looks better. There is a one second delay after you press a button and the label changes.

http://xbmc-scripting.googlecode.com/svn...e_test.zip
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#25
A little math:

Assume black background and pure white images.

While image 1 is onscreen, the white level is at 1.0 Half way through a "crossfade" both images will be at 50% opacity.

Thus the content from the first image would be: 1.0 * 0.5 + 0 * 0.5 = 0.5

The second image is alpha blended then: 1.0*0.5 + 0.5 * 0.5 = 0.75

Thus, the total opacity is 75%; the image appears darker than it should.

Only if the first image is at full opacity does the alpha blending with the second image produce full opacity during the entire fade.

I've implemented the fade in then fade out, but have yet to decide how to get it into SVN (either default, or as an option).

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#26
If fade times are affected, maybe an option would be better.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#27
Yeah, will do it as an option at first, consult with skinners, and then decide on whether it should be default or not.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#28
Some more maths Smile

The above applies when the image(s) are opaque. However, when they are transparent, we must remember that the alpha blending is applied per-pixel: Thus, the blend amount we specify will be modulated with whatever the alpha value of the particular pixel in the image. This can be demonstrated as follows:

Let
ai = alpha of image i
ci = colour of image i
bi = blend amount of image i

Then the final colour will be:

b2*a2*c2 + (1 - b2*a2)[(b1*a1*c1 + (1 - b1*a1)*bg]

We need only consider intensity, so we may set c1 = c2 = 1. Furthermore, for simplicity let's assume that the images share the same transparency, so that a1 = a2 = a. The colour then becomes:

b2*a + (1 - b2*a)b1*a + (1 - b2*a)(1 - b1*a)*bg

Now, the colour when just one of the images is rendered (i.e. when b2 = 0, b1 = 1, or b1 = 0, b2 = 1) is

a + (1 - a)*bg

For other values of b2, we wish to choose b1 so that we also achieve this same colour value (i.e. the same intensity).

We thus have

b2*a + (1 - b2*a)b1*a + (1 - b2*a)(1 - b1*a)*bg = a + (1 - a)*bg,

and rearranging for b1 yields:

b1 = [a + (1-a)*bg - b2*a - (1-b2*a)*bg] / a*(1-b2*a)(1-bg)

Now, in most cases bg = 0, and it reduces to

b1 = (1 - b2) / (1 - a*b2)

Reasonably non-trivial even for a shared alpha value.

Note that when a = 1 (fully opaque), b1 == 1 for any b2, which is what we've been using.

Ofcourse, we want the fading to be symmetric, so we want to actually have the function f : [0,1] -> [0,1] such that f(t) = b1 and f(1-t) = b2, where b1 and b2 share the relationship above. A little bit of algebra yields:

f(t) = [1 - (1-a)^t] / a.

Obviously this precludes the case where a = 1 and a = 0, but both those cases are trivial.

To be honest, I'm not sure which way to go at this point. It works perfectly for images that are opaque, and will not work well for any other images. Furthermore, there's no fixed method that will work for either, and the formula required for opaque images requires knowing the alpha value(s) of each image. I suppose in the case of a known <colordiffuse> we can do something, but if the transparency is in the images themselves, there's nothing we know.

Do you infact require the images to be opaque?

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#29
opaque as in solid?

There will be transperency, but I could use <colordiffuse> to change the opacity to less than FF.

Anything that helps a fade transition, where the images are not 100% opaque would be helpful. Even if it's an option.

But if it's too complicated, then it's not vital. I thought a fade in/out at the same time would handle all situations. Apparently that's not the case Smile
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#30
Heh Wink

Was kinda fun working out the math, so it'd be a shame not to use it :p

As it turns out, it IS a crossfade, just not a simple linear one.

I thing what I'll do is simply incorporate it based on the alpha value of the colordiffuse. That should cover both cases.

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply

Logout Mark Read Team Forum Stats Members Help
Multiimage - JM clarification please0