Author Topic: new BlendMode...  (Read 11386 times)

zpaolo11x

  • Hero Member
  • *****
  • Posts: 1233
    • View Profile
    • My deviantart page
Re: new BlendMode...
« Reply #15 on: July 27, 2018, 12:55:55 PM »
I mean you need jpg/png screenshots of the videosnap along with the video file itself.  At least i think that's how it works?  So in essence, you would need for all your roms.. 1) a full set of "video" snaps 2) a full set of screenshotted "picture" snaps and 3) a full set of "blurred picture" snaps of the screenshot.

it’s true that you need a full set of thumbnail snaps, but this is something that is easy to find for MAME, and if the videos set is not complete the theme will work with thumbs instead. And yes you need to generate blurred thumbs but if you have the normal thumbs you can generate them with my xnview scripts (included in the theme).

you’d like AF to work with videos only?
« Last Edit: July 27, 2018, 02:46:00 PM by zpaolo11x »

Oomek

  • Administrator
  • Sr. Member
  • *****
  • Posts: 311
  • Radek Dutkiewicz
    • View Profile
    • github.com/oomek
Re: new BlendMode...
« Reply #16 on: July 27, 2018, 03:10:50 PM »
I thought having snaps and videos is a standard, a lot of layouts/themes rely on it. If you have only videos you will see a lot of black rectangles. Sorry for stating the obvoius.

dukpoki

  • Sr. Member
  • ****
  • Posts: 138
    • View Profile
Re: new BlendMode...
« Reply #17 on: July 27, 2018, 08:34:05 PM »
I had complete picture snap sets for Mame and Snes in the past.  Then I decided to delete them because there is no point in keeping those snaps (being unused) if i'm going to use videosnaps instead.  I've since collected purely videosnaps.  I have zero need for picture snaps because I have a videosnap for every rom.  (any missing vsnaps I simply create myself with fraps+avidemux)  I have a massive and completely thorough collection of videosnaps, flyers/boxart, wheels, etc spanning 17 systems.  Keeping a set of image snap sets is not really a problem except  I just figured it wasn't necessary to waste space on unused assets and thus deleted them. I was really hoping there was a way to read a single key frame from a videosnap and display that.  Kind of how Windows Explorer creates thumbs.  But if that's not possible then I understand.  And judging from Oomek's post, i'm going to assume his Ambience theme will also require screenshot snaps.  In that case, then there's really nothing to it except I need to keep dual sets or miss out on certain themes.

I thought having snaps and videos is a standard, a lot of layouts/themes rely on it.

I honestly have not run into a theme thus far that required a dual set.  The only one so far is zpaolo11x's and I assume your WIP.
« Last Edit: July 27, 2018, 08:38:48 PM by dukpoki »

Oomek

  • Administrator
  • Sr. Member
  • *****
  • Posts: 311
  • Radek Dutkiewicz
    • View Profile
    • github.com/oomek
Re: new BlendMode...
« Reply #18 on: July 27, 2018, 10:24:28 PM »
There are 2 types of themes: snap and list based. The former divide into ones that play a video of the selected game and ones that play all the videos at the same time. Personally I’m not a fan of that last category, hence the requirement of snaps and videos.

Clarification:
The ”list based” type includes a listbox of titles and a conveyor of game marquees/wheels

Preferences aside, I do not see any reason of not including an option to allow all the videos playing simultaneously.
« Last Edit: July 27, 2018, 11:12:43 PM by Oomek »

zpaolo11x

  • Hero Member
  • *****
  • Posts: 1233
    • View Profile
    • My deviantart page
Re: new BlendMode...
« Reply #19 on: July 28, 2018, 12:13:05 AM »
most of my videosnaps start with a fade from black, therefore I can’t just use the first frame to show as a fixed thumb. Although it would be great to be able to tell AM from what timw to start the video, there is still the issue that a theme like Arcadeflow preloads around 25 thumbs. preloading video snaps and updatimg them is not as fast as fixed images, that’s why my theme has a precise timing for video loading that hides the moment so that it doesnt make the scrolling stutter (this doesn’t happen on my workstation ssd which costs around 600 euros, but on most drives it does, on my macbook it does stutter when the video is loaded).

Besides, my whole mame thumbs archive takes up less than 1Gb, I rescaled all to 320x240 as it’s faster and looks equally good on screen.

If there was a way to chose the fixed thumb to show when a videomis not playing I would put it as an option but afaik it doesn’t

Oomek

  • Administrator
  • Sr. Member
  • *****
  • Posts: 311
  • Radek Dutkiewicz
    • View Profile
    • github.com/oomek
Re: new BlendMode...
« Reply #20 on: July 28, 2018, 05:57:32 AM »
If you don’t mind I’ll continue hijacking the thread and ask for your suggestions you snapless people.

dukpoki

  • Sr. Member
  • ****
  • Posts: 138
    • View Profile
Re: new BlendMode...
« Reply #21 on: July 28, 2018, 10:06:37 AM »
most of my videosnaps start with a fade from black, therefore I can’t just use the first frame to show as a fixed thumb. Although it would be great to be able to tell AM from what timw to start the video, there is still the issue that a theme like Arcadeflow preloads around 25 thumbs. preloading video snaps and updatimg them is not as fast as fixed images, that’s why my theme has a precise timing for video loading that hides the moment so that it doesnt make the scrolling stutter (this doesn’t happen on my workstation ssd which costs around 600 euros, but on most drives it does, on my macbook it does stutter when the video is loaded).

Yeah the preloading/updating speed makes sense especially for Arcadeflow even with a beefy rig.  All my videos have fade in from black as well.

Besides, my whole mame thumbs archive takes up less than 1Gb, I rescaled all to 320x240 as it’s faster and looks equally good on screen.

True.  It's not really a big deal, but to be fair, it does scale with more systems you have.  Plus it's time consuming to make which again scales.  Again though, not really a big deal.  It's mostly because i'm ocd about keeping files that are important/useful and deleting files that are erroneous and redundant.  xD

If there was a way to chose the fixed thumb to show when a videomis not playing I would put it as an option but afaik it doesn’t

No worries.   I'm not saying you guys should do this or that.  I'm simply stating that currently, there is a high pre-requisite for running the theme, which is true when compared to other themes, that's all.  Not saying necessarily that's a bad thing (though some users may be daunted by it).  For the gains in speed, it's well worth it.

zpaolo11x

  • Hero Member
  • *****
  • Posts: 1233
    • View Profile
    • My deviantart page
Re: new BlendMode...
« Reply #22 on: August 11, 2018, 12:01:44 AM »
Since this thread has detoured to blurred backgrounds and other tricks, I'll post here this code snippet: It's a trick to have a blurred background from the game snaps without having to use shaders, it works by rescaling the picture three times and leveraging bilinear filtering from the graphics card. Of course it works only if you want a very "wild" blur...

Code: [Select]
local flw = fe.layout.width
local flh = fe.layout.height

local xsize1 = 32
local xsize2 = 4
local xsize3 = 16
local xsize9 = flw

local xsurf1 = fe.add_surface (xsize1,xsize1)
local xsurf2 = fe.add_surface (xsize2,xsize2)
local xsurf3 = fe.add_surface (xsize3,xsize3)

local snapbg1 = xsurf1.add_artwork ("snap",0,0,xsize1,xsize1)
snapbg1.alpha = 255
snapbg1.video_flags = Vid.ImagesOnly

xsurf2.visible = false
xsurf2 = xsurf3.add_clone(xsurf2)
xsurf2.visible=true
xsurf2.set_pos (0,0,xsize3,xsize3)

xsurf1.visible = false
xsurf1 = xsurf2.add_clone(xsurf1)
xsurf1.visible=true
xsurf1.set_pos (0,0,xsize2,xsize2)

xsurf3.set_pos (0,0,flw*0.5,flw*0.5)

fe.add_text(xsize1 + " " + xsize2 + " " + xsize3 ,0,50,flw*0.5,50)
local snap0 = fe.add_artwork("snap",flw*0.5,0,flw*0.5,flw*0.5)
snap0.video_flags = Vid.ImagesOnly

fe.add_text("[Title]",0,flw*0.5,flw,50)

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: new BlendMode...
« Reply #23 on: August 11, 2018, 07:32:37 AM »
tanks for posting the code,   i think this is a great look.....good work

wow...it works for video two!   yay ;D
« Last Edit: August 11, 2018, 07:36:31 AM by jedione »
help a friend....

zpaolo11x

  • Hero Member
  • *****
  • Posts: 1233
    • View Profile
    • My deviantart page
Re: new BlendMode...
« Reply #24 on: August 11, 2018, 11:32:51 AM »
tanks for posting the code,   i think this is a great look.....good work

It's not bad but still a bit slower... I also managed to use the blur-layout shader for game title shadows, in the attached picture on the left the shader generated one, on the right the xnview version...

The idea is to implement both in version 2.0 of my layout :D


jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: new BlendMode...
« Reply #25 on: August 12, 2018, 11:20:48 AM »
can you share this "shader"  for the artwork.. ::)
help a friend....

zpaolo11x

  • Hero Member
  • *****
  • Posts: 1233
    • View Profile
    • My deviantart page
Re: new BlendMode...
« Reply #26 on: August 12, 2018, 01:01:37 PM »
can you share this "shader"  for the artwork.. ::)

It's the same code from blur-layout that you linked, but I'll pack a layout as soon as possible... There are more shaders in that layout but I don't know how to call them :(

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: new BlendMode...
« Reply #27 on: August 12, 2018, 01:20:09 PM »
cool thanks bro...
help a friend....

zpaolo11x

  • Hero Member
  • *****
  • Posts: 1233
    • View Profile
    • My deviantart page
Re: new BlendMode...
« Reply #28 on: August 14, 2018, 01:20:47 AM »
This is the code I used for the "drop shadow" effect:

Code: [Select]

local sizew = 280
local sizeh = 160

local bgpic = fe.add_text("",0,0,sizew,sizeh)
bgpic.set_bg_rgb (200,50,0)

local surf2 = fe.add_surface(sizew,sizeh)
local logox = surf2.add_artwork("wheel",20,20,240,120)
logox.preserve_aspect_ratio = true
logox.set_rgb(0,0,0)
logox.alpha=150

local surf1 = fe.add_surface(sizew,sizeh)

surf2.visible = false
surf2 = surf1.add_clone(surf2)
surf2.visible = true

local shaderH = fe.add_shader( Shader.Fragment, "frag.txt" )
shaderH.set_texture_param( "source")
shaderH.set_param("offsetFactor", 0.008, 0.0)
surf1.shader = shaderH

local shaderV = fe.add_shader( Shader.Fragment, "frag.txt" )
shaderV.set_texture_param( "source")
shaderV.set_param("offsetFactor", 0.0000, 0.008)
surf2.shader = shaderV

local logo00 = fe.add_artwork ("wheel",20,20-10,240,120)
logo00.preserve_aspect_ratio = true

and it uses the shader from that lauout in the file "frag.txt":

Code: [Select]
uniform sampler2D source;
uniform vec2 offsetFactor;

void main() {
    vec2 sourceCoordinates = gl_TexCoord[0].xy;
    vec4 color = vec4(0.0);
    color += texture2D(source, sourceCoordinates - 10.0 * offsetFactor) * 0.0012;
    color += texture2D(source, sourceCoordinates - 9.0 * offsetFactor) * 0.0015;
    color += texture2D(source, sourceCoordinates - 8.0 * offsetFactor) * 0.0038;
    color += texture2D(source, sourceCoordinates - 7.0 * offsetFactor) * 0.0087;
    color += texture2D(source, sourceCoordinates - 6.0 * offsetFactor) * 0.0180;
    color += texture2D(source, sourceCoordinates - 5.0 * offsetFactor) * 0.0332;
    color += texture2D(source, sourceCoordinates - 4.0 * offsetFactor) * 0.0547;
    color += texture2D(source, sourceCoordinates - 3.0 * offsetFactor) * 0.0807;
    color += texture2D(source, sourceCoordinates - 2.0 * offsetFactor) * 0.1065;
    color += texture2D(source, sourceCoordinates - offsetFactor) * 0.1258;
    color += texture2D(source, sourceCoordinates) * 0.1330;
    color += texture2D(source, sourceCoordinates + offsetFactor) * 0.1258;
    color += texture2D(source, sourceCoordinates + 2.0 * offsetFactor) * 0.1065;
    color += texture2D(source, sourceCoordinates + 3.0 * offsetFactor) * 0.0807;
    color += texture2D(source, sourceCoordinates + 4.0 * offsetFactor) * 0.0547;
    color += texture2D(source, sourceCoordinates + 5.0 * offsetFactor) * 0.0332;
    color += texture2D(source, sourceCoordinates + 6.0 * offsetFactor) * 0.0180;
    color += texture2D(source, sourceCoordinates - 7.0 * offsetFactor) * 0.0087;
    color += texture2D(source, sourceCoordinates - 8.0 * offsetFactor) * 0.0038;
    color += texture2D(source, sourceCoordinates - 9.0 * offsetFactor) * 0.0015;
    color += texture2D(source, sourceCoordinates - 10.0 * offsetFactor) * 0.0012;
    gl_FragColor = color;
}

The script works like this: you need to create two nested surfaces, place the image you want to blur on the topmost surface and add an horizontal blur to the first, vertical blur to the second.

It's not sufficient to use one surface and add horizontal to the surface, vertical to the image, because the blur will get clipped, you need all this safeguard area around the logo image.

This is a neat shader, it would be great for creating automatically drop shadows for thumbnails too, accurate in aspect ratio etc, but it's a bit heavy since it already needs two nested surfaces to work. Anyway that's the code :D

iOtero

  • Sr. Member
  • ****
  • Posts: 414
    • View Profile
Re: new BlendMode...
« Reply #29 on: August 14, 2018, 02:17:29 AM »
And all this what processor do you need?
Could a raspi 3 with it?
Nacer a los 15 años Una novela de iOtero