Mailing List Archive

Seasonal theme experiments
Afternoon all,

I've been tinkering recently with the MythTV theme code with a view to
seeing what functionality we could perhaps add for 0.32 - and
hopefully generate some enthusiasm for new themes...

Inspired by https://www.shadertoy.com/ I've added some procedural
texture support (think computer generated art) to the UI code.
Essentially this allows you to run custom OpenGL shaders embedded in
the theme.

The master version is available at:-

https://github.com/mark-kendall/mythtv

and I've backported to 0.31 as well:-

https://github.com/mark-kendall/mythtv/tree/fixes/31

Those versions have an updated MythCenter-wide theme where the
background is replaced by a version of:-

https://www.shadertoy.com/view/wdVBRm

It's a little overwhelming as a theme background but demonstrates the
possibilities well enough.

I've also put together an update for the MythCenterXMAS-wide theme
that adds a version of:-

https://www.shadertoy.com/view/MdXcW8

as an overlay on top of the background. So gently falling snow on top
of your Christmas postcard:)

You'll need to replace the base.xml for that theme with the version at:-

https://gist.github.com/mark-kendall/3b4ebd919fd3f2abcaab65e6ce908d99

For anyone familiar with GLSL shaders, the code is evaluated at
runtime so you can freely tinker and play with the shaders to try
different effects etc. The code has not been widely tested but the
only potential issue is performance - I'm not really sure how the
shaders will perform on older hardware (tested locally on AMD
integrated graphics - vega 11).

Enjoy!

regards
Mark

(p.s. with all due credit to the original authors of those shaders on
shadertoy.com)
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Seasonal theme experiments [ In reply to ]
On 10/12/2020 15:29, Mark Kendall wrote:

> Afternoon all,
>
> I've been tinkering recently with the MythTV theme code with a view to
> seeing what functionality we could perhaps add for 0.32 - and
> hopefully generate some enthusiasm for new themes...
>
> Inspired by https://www.shadertoy.com/ I've added some procedural
> texture support (think computer generated art) to the UI code.
> Essentially this allows you to run custom OpenGL shaders embedded in
> the theme.
>
> The master version is available at:-
>
> https://github.com/mark-kendall/mythtv
>
> and I've backported to 0.31 as well:-
>
> https://github.com/mark-kendall/mythtv/tree/fixes/31
>
> Those versions have an updated MythCenter-wide theme where the
> background is replaced by a version of:-
>
> https://www.shadertoy.com/view/wdVBRm
>
> It's a little overwhelming as a theme background but demonstrates the
> possibilities well enough.
>
> I've also put together an update for the MythCenterXMAS-wide theme
> that adds a version of:-
>
> https://www.shadertoy.com/view/MdXcW8
>
> as an overlay on top of the background. So gently falling snow on top
> of your Christmas postcard:)
>
> You'll need to replace the base.xml for that theme with the version at:-
>
> https://gist.github.com/mark-kendall/3b4ebd919fd3f2abcaab65e6ce908d99
>
> For anyone familiar with GLSL shaders, the code is evaluated at
> runtime so you can freely tinker and play with the shaders to try
> different effects etc. The code has not been widely tested but the
> only potential issue is performance - I'm not really sure how the
> shaders will perform on older hardware (tested locally on AMD
> integrated graphics - vega 11).
>
> Enjoy!
>
> regards
> Mark
>
> (p.s. with all due credit to the original authors of those shaders on
> shadertoy.com)


Hi Mark,


This sounds really cool especially the snow effect.


Is that the correct  Gist? Not sure if I'm doing something stupid but I
just tried it and it produces the same effect as the MythCenter-wide
background. Definitely no snow :(


Paul H.

_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Seasonal theme experiments [ In reply to ]
On Thu, 10 Dec 2020 at 19:07, Paul Harrison <mythtv@mythqml.net> wrote:

> Is that the correct Gist? Not sure if I'm doing something stupid but I
> just tried it and it produces the same effect as the MythCenter-wide
> background. Definitely no snow :(

Less haste more speed...

correct version:-

https://gist.github.com/mark-kendall/91c07d8f3d81eb8777daa3b368e5c060

Thanks
Mark
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Seasonal theme experiments [ In reply to ]
On 10/12/2020 19:17, Mark Kendall wrote:

> On Thu, 10 Dec 2020 at 19:07, Paul Harrison <mythtv@mythqml.net> wrote:
>
>> Is that the correct Gist? Not sure if I'm doing something stupid but I
>> just tried it and it produces the same effect as the MythCenter-wide
>> background. Definitely no snow :(
> Less haste more speed...
>
> correct version:-
>
> https://gist.github.com/mark-kendall/91c07d8f3d81eb8777daa3b368e5c060
>
> Thanks
> Mark


NP that works great. A lot smoother than the animated gif snow.


I bumped the speed up a little to -0.3 and increase the layers to 6.0.


I also needed to  add #include <memory> to mythpainter.h for
shared_pointer to get it to compile on Ubuntu 20.04 and there was
warning about a shadowed decalaration.

opengl/mythrenderopengl.cpp:810:80: warning: declaration of ‘Time’
shadows a global declaration [-Wshadow]
  810 |                                       QOpenGLShaderProgram
*Program, float Time)
| ^
In file included from /usr/include/X11/Xlib.h:44,
                 from platforms/mythxdisplay.h:14,
                 from opengl/mythrenderopengl.cpp:21:
/usr/include/X11/X.h:77:23: note: shadowed declaration is here
   77 | typedef unsigned long Time;
      |                       ^~~~


Paul H.

_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Seasonal theme experiments [ In reply to ]
On 10/12/2020 15:29, Mark Kendall wrote:
> Afternoon all,
>
> I've been tinkering recently with the MythTV theme code with a view to
> seeing what functionality we could perhaps add for 0.32 - and
> hopefully generate some enthusiasm for new themes...
>
> Inspired by https://www.shadertoy.com/ I've added some procedural
> texture support (think computer generated art) to the UI code.
> Essentially this allows you to run custom OpenGL shaders embedded in
> the theme.
>
> The master version is available at:-
>
> https://github.com/mark-kendall/mythtv
>
> and I've backported to 0.31 as well:-
>
> https://github.com/mark-kendall/mythtv/tree/fixes/31
>
> Those versions have an updated MythCenter-wide theme where the
> background is replaced by a version of:-
>
> https://www.shadertoy.com/view/wdVBRm
>
> It's a little overwhelming as a theme background but demonstrates the
> possibilities well enough.
>
> I've also put together an update for the MythCenterXMAS-wide theme
> that adds a version of:-
>
> https://www.shadertoy.com/view/MdXcW8
>
> as an overlay on top of the background. So gently falling snow on top
> of your Christmas postcard:)
>
> You'll need to replace the base.xml for that theme with the version at:-
>
> https://gist.github.com/mark-kendall/3b4ebd919fd3f2abcaab65e6ce908d99
>
> For anyone familiar with GLSL shaders, the code is evaluated at
> runtime so you can freely tinker and play with the shaders to try
> different effects etc. The code has not been widely tested but the
> only potential issue is performance - I'm not really sure how the
> shaders will perform on older hardware (tested locally on AMD
> integrated graphics - vega 11).
>
> Enjoy!
>
> regards
> Mark
>

Is it worth handling a file reference in the theme.xml file, so that
rather than having to embed GSL into the theme.xml, the GSL can be
contained in it's own file (shipped along with the theme) and it's
loaded out of that file instead?

It does seem a cleaner way to do it. (my 2c's)


Regards
Stuart


_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Seasonal theme experiments [ In reply to ]
On Fri, 11 Dec 2020 at 10:01, Stuart Auchterlonie
<stuarta@squashedfrog.net> wrote:

> Is it worth handling a file reference in the theme.xml file, so that
> rather than having to embed GSL into the theme.xml, the GSL can be
> contained in it's own file (shipped along with the theme) and it's
> loaded out of that file instead?
>
> It does seem a cleaner way to do it. (my 2c's)

That would be my long term goal - the initial code is very much just a
proof of concept.

Moving the shaders into their own files also allows the themer to
reuse them - I would expect that in most cases the vertex shader will
be the same. We should probably be caching the shaders as well.

The bigger issue is portability; with half an eye on how this would be
implemented on Vulkan, but also GLSL versions. Strictly speaking an
OpenGL implementation does not have to offer compatibility with older
versions and all of our current OpenGL shaders target GLSL 1.2 (GLSL
ES 1.0) (although they appear to work with GLSL 1.1 as well). So in
theory they may not work on newer OpenGL instances but I have seen no
references to issues in the 'wild'; I suspect all of the major vendors
just allow backwards compatibility.

Qt works around this by writing all of their shaders with 'vulkan
style' GLSL and converting to other formats. We would probably need to
do something similar; we already have glslang support in master -
though conversion should really be done offline.

Regards
Mark
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Seasonal theme experiments [ In reply to ]
On 11/12/2020 10:30, Mark Kendall wrote:

> On Fri, 11 Dec 2020 at 10:01, Stuart Auchterlonie
> <stuarta@squashedfrog.net> wrote:
>
>> Is it worth handling a file reference in the theme.xml file, so that
>> rather than having to embed GSL into the theme.xml, the GSL can be
>> contained in it's own file (shipped along with the theme) and it's
>> loaded out of that file instead?
>>
>> It does seem a cleaner way to do it. (my 2c's)
> That would be my long term goal - the initial code is very much just a
> proof of concept.
>
> Moving the shaders into their own files also allows the themer to
> reuse them - I would expect that in most cases the vertex shader will
> be the same. We should probably be caching the shaders as well.
>
> The bigger issue is portability; with half an eye on how this would be
> implemented on Vulkan, but also GLSL versions. Strictly speaking an
> OpenGL implementation does not have to offer compatibility with older
> versions and all of our current OpenGL shaders target GLSL 1.2 (GLSL
> ES 1.0) (although they appear to work with GLSL 1.1 as well). So in
> theory they may not work on newer OpenGL instances but I have seen no
> references to issues in the 'wild'; I suspect all of the major vendors
> just allow backwards compatibility.
>
> Qt works around this by writing all of their shaders with 'vulkan
> style' GLSL and converting to other formats. We would probably need to
> do something similar; we already have glslang support in master -
> though conversion should really be done offline.
>
> Regards
> Mark


Agree putting the GSL into it's own file would be cleaner. Not sure how
many themers would be able to write there own shaders so having a
default library of a few more useful ones would be ideal.


How difficult would it be to add something similar to MythUIImage to
transition between images? I'm thinking of the slide show images or the
coverart images on the 'Watch Recordings' screen for example it would be
nice to have a smooth transition when they change rather than the abrupt
change we have now. In MythQML I have a nice component that can both
fade between images and also do what I think is called the Ken Burns
effect which works really well for the Xmas theme slide show images.
Having something similar in MythUI would be nice.


Paul H.

_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Seasonal theme experiments [ In reply to ]
On 11/12/2020 10:30, Mark Kendall wrote:

> On Fri, 11 Dec 2020 at 10:01, Stuart Auchterlonie
> <stuarta@squashedfrog.net> wrote:
>
>> Is it worth handling a file reference in the theme.xml file, so that
>> rather than having to embed GSL into the theme.xml, the GSL can be
>> contained in it's own file (shipped along with the theme) and it's
>> loaded out of that file instead?
>>
>> It does seem a cleaner way to do it. (my 2c's)
> That would be my long term goal - the initial code is very much just a
> proof of concept.
>
> Moving the shaders into their own files also allows the themer to
> reuse them - I would expect that in most cases the vertex shader will
> be the same. We should probably be caching the shaders as well.
>
> The bigger issue is portability; with half an eye on how this would be
> implemented on Vulkan, but also GLSL versions. Strictly speaking an
> OpenGL implementation does not have to offer compatibility with older
> versions and all of our current OpenGL shaders target GLSL 1.2 (GLSL
> ES 1.0) (although they appear to work with GLSL 1.1 as well). So in
> theory they may not work on newer OpenGL instances but I have seen no
> references to issues in the 'wild'; I suspect all of the major vendors
> just allow backwards compatibility.
>
> Qt works around this by writing all of their shaders with 'vulkan
> style' GLSL and converting to other formats. We would probably need to
> do something similar; we already have glslang support in master -
> though conversion should really be done offline.
>
> Regards
> Mark


Having spent a couple of days using this there is one annoying thing
with the current implementation it doesn't take much to stall the
animation which becomes quite annoying after a while.

For example any keypresses that cause a new screen or popup to appears
or scrolling of some lists like in MythNews cause the snow affect to
momentarily pause,  presumably something is blocking the UI thread or
something like that?


Paul H.

_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Seasonal theme experiments [ In reply to ]
On Sun, 13 Dec 2020 at 11:45, Paul Harrison <mythtv@mythqml.net> wrote:
>
> Having spent a couple of days using this there is one annoying thing
> with the current implementation it doesn't take much to stall the
> animation which becomes quite annoying after a while.
>
> For example any keypresses that cause a new screen or popup to appears
> or scrolling of some lists like in MythNews cause the snow affect to
> momentarily pause, presumably something is blocking the UI thread or
> something like that?

Paul

Yes - anything that blocks the main thread is going to stall the
animation. I imagine there are quite a few places where that is going
to happen - although I haven't seen it for new screens or popups.

> How difficult would it be to add something similar to MythUIImage to
> transition between images? I'm thinking of the slide show images or the
> coverart images on the 'Watch Recordings' screen for example it would be
> nice to have a smooth transition when they change rather than the abrupt
> change we have now. In MythQML I have a nice component that can both
> fade between images and also do what I think is called the Ken Burns
> effect which works really well for the Xmas theme slide show images.

I don't think either of these cases really need this particular
functionality. It just needs to be handled in the existing code.

For the Ken Burns effect, the code just needs to handle a slow zoom
effect into a particular spot in the photo.

For coverart etc, it needs some thing akin to the existing
fade/transition between 2 screens. Not sure how hard that is to
implement.

Regards
Mark
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org