Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Bgoulette

Pages: 1 [2] 3 4 ... 8
16
Scripting / Re: Drop shadow layout, may be turned into something useful?
« on: January 28, 2019, 02:49:14 PM »
Just noticed something. Probably not specific to the classes I've added to this thread (but maybe?), but it seems the undocumented (?) fe.module_dir variable returns the path of the last loaded module! Attempting to set it internally doesn't seem to make a difference, though I could be doing it wrong.

Wanted to put this out there in case anyone else a) runs into the issue I did, or b) knows a better workaround than just moving your next fe.load_module() call further down in your code!

17
Scripting / Re: Drop shadow layout, may be turned into something useful?
« on: January 28, 2019, 09:02:20 AM »
Ops, sorry I forgot to rename the shader to stress the difference :D It's the way alpha channel is recalculated which is more fit for glow effects.

Ha! Not your fault. I shouldn't have assumed! In the zip I posted above, I renamed the glsl files: gauss_kernsigma_ds.glsl for the drop shadow, and gauss_kernsigma_ag.glsl for the ambient glow (or flat color glow) effect.

I'm looking forward to testing them out tonight when I get home! Thanks for making your stuff available to the masses! It's my hope that my module-ized files will be of benefit to others as well.

18
Scripting / Re: Drop shadow layout, may be turned into something useful?
« on: January 28, 2019, 06:26:58 AM »
I looked a little more closely at the actual shaders zpaolo11x used for his effects and discovered differences in how the alpha was applied with his background glow versus his drop shadow. I've made what I believe to be the requisite changes in the shader-glow module, and I think DropShadow should work like it used to. I'd check first, but I can't, because I'm at work on a machine without AM installed. I'll check when I get home, though!

Usage should be the same as above: the change(s) are minor and should be transparent to the user. Just update modules/shader-glow with the attached code (delete the old code first).

Edit: zip moved to this post.

19
Scripting / Re: White Image Border + Image Reflection
« on: January 26, 2019, 04:14:01 PM »
I wrote a simple shader that may or may not help with the fade to alpha versus black (attached). You may have to place an image on a surface and make it the size of the entire screen, then resize the surface to the image's original dimensions...or you might not. It's highly experimental, but it's yours to play with if you're so inclined!

20
Scripting / Re: Drop shadow layout, may be turned into something useful?
« on: January 26, 2019, 04:11:24 PM »
Awesome stuff zpaolo11x! Can you add the latest updates into the class that Bgoulette wrote? :P

I'm attaching a new module that incorporates the ambilight plus flatcolor stuff. Warning: somehow, I ruined how the drop shadow works, because now it doesn't! Uggh! Gonna have to go back to zpaolo11x's original and see what I did wrong. Unless someone else can spot it more quickly than I. Been looking at it for too long! :(

Just include fe.load_module("shadow-glow") in your layouts (after placing the contents of the attached zip in your modules folder!), then call 'em like this:

Code: [Select]
// Drop shadow:
local ds = DropShadow( pic, radius, offset_x, offset_y, alpha ) // Broken for now. Grr! Also, alpha is insane...

// Flat color:
local fc = FlatColor( pic, radius, offset_x, offset_y, alpha )
fc.set_fc_rgb( r, g, b );

// Ambi-glow:
local ag = AmbiGlow( pic, radius, offset_x, offset_y, alpha ) // I renamed it AmbiGlow. Sorry!

The included layout-shadow-glow.zip had examples. There's no config, so to change what displays, open the layout.nut and change the "show" value to 1, 2, or 3.

You have no idea how much it's bugging me that DropShadow doesn't work anymore! Why?! It's the same code! Arglebarglesnarflarfglubbernugz...

21
Scripting / Re: Vertex shader to address only part of the screen?
« on: January 25, 2019, 06:59:52 AM »
Hi zpaolo11x,

I'm including a screen shot of what the screen looks like in addition to the code that doesn't work:

Code: [Select]
local snap = snapSurface.add_artwork( "snap", 0, 0 ); // This gets resized depending on the dimensions of the actual snap. Function below.
snap.set_pos( snapSurface.width / 2, snapSurface.height / 2 );

local snapShader = fe.add_shader( Shader.Fragment, "pseudo_scanlines.glsl" );
snapShader.set_texture_param( "source", snap );
snapShader.set_param( "rez", snap.width, snap.height );
snapShader.set_param( "lineWeight", snap.width, snap.height );

snap.shader = snapShader;

What happens is I get a mostly black image where the snap used to be. Maybe it's all black. I can't tell sometimes. If I modify the "rez" param like so:

snapShader.set_param( "rez", fe.layout.width, fe.layout.height );

I get a scaled up, upside-down snap! I don't know if a vertex shader would solve my problems or just introduce new ones. The snap size/position changes based on its actual dimensions:

Code: [Select]
function updateSnapSize (ttype, var, ttime) {
// Get proper aspect ratio:
    local _rez = null;
local _r = null;

    if ( snap.texture_width == 0 || snap.texture_height == 0 ) {
        _rez = { "w": snap.width, "h": snap.height }
    }
    else {
        _rez = {"w": snap.texture_width, "h": snap.texture_height }
    }

    _r = _rez.w >= _rez.h ? _rez.h.tofloat() / _rez.w.tofloat() : _rez.w.tofloat() / _rez.h.tofloat();

switch ( ttype ) {
case Transition.StartLayout:
case Transition.ToNewList:
case Transition.ToNewSelection:
case Transition.EndNavigation:
// Resize snap:
if ( _rez.w >= _rez.h ) {
// Landscape (or square):
snap.width = snapVars.max;
snap.height = snapVars.max * _r;
}
else {
// Portrait:
snap.width = snapVars.max * _r;
snap.height = snapVars.max;
}

// Resize snapFrame:
snapFrame.width = snap.width + snapVars.frameWeight;
snapFrame.height = snap.height + snapVars.frameWeight;

            // Update origins:
            snapFrame.origin_x = snapFrame.width / 2;
            snapFrame.origin_y = snapFrame.height / 2;

            snap.origin_x = snap.width / 2;
            snap.origin_y = snap.height / 2;

            // Update drop shadow:
            // NOTE: This works! It's probably voodoo, so don't look too closely!
            snapDS.surface.origin_x = snapFrame.width / 2;
            snapDS.surface.origin_y = snapFrame.height / 2;
            snapDS.surface.set_pos(
                snapVars.dropShadowOffset.x + (snapOrigin.x - snapVars.dropShadowSize),
                snapVars.dropShadowOffset.y + (snapOrigin.y - snapVars.dropShadowSize),
                snapFrame.width + (snapVars.dropShadowSize * 2),
                snapFrame.height + (snapVars.dropShadowSize * 2)
            );

            // Reposition gameCount:
            gameCount.set_pos( snapOrigin.x - (gameCount.width / 2), snapOrigin.y + (snapFrame.height / 2.0).tofloat() + 16);

            // Adjust zorder:
            snap.zorder = snapFrame.zorder + 1;
            snapSurface.zorder = snapDS.surface.zorder + 1;
            gameCount.zorder = snapSurface.zorder + 1;
break;
}
}

That size/position changing stuff may or may not mess with the shader. Not sure.

If you or anyone else is able to deduce a solution, I'm all ears! Thanks, as always, for taking a look!

Edit: Holy smokes, that's a large screen shot. Apologies!  (Edit 2: Resized attachment)

22
Scripting / Re: fe.module_dir doesn't seem to work?
« on: January 25, 2019, 06:43:24 AM »
Hi Keil,

Thanks to your suggestions, I discovered what I'd been doing wrong: I had both an older blurred-art.nut stand alone file in my modules folder as well as a blurred-art/ folder containing the relevant files. AM was looking at the first file instead of entering the folder. I must have dragged and dropped in the wrong place. Ugh. Such a simple mistake! Tracing the print output -- and realizing I wasn't getting anything no matter how many changes I made in module.nut -- got me looking in the right place. It's behaving like it should now! I greatly appreciate your advice!  8)

23
Scripting / Re: fe.module_dir doesn't seem to work?
« on: January 24, 2019, 05:49:51 PM »
fwiw, I do print to the console...when I know what I'm looking for! :)

The module is what's creating and applying the shader, so just the shader name (fe.add_shader( Shader.Fragment, "gauss_kernsigma_o.glsl" );) should be all that's required? Yet that doesn't work. The console just tells me it can't find the shader in the layout "root." Which is confusing to me, because it's not supposed to be looking for it there.

The module is a wip. It does what I want (mostly) with the exception of finding the shader. I'm attaching it just for giggles.

24
Scripting / Re: fe.module_dir doesn't seem to work?
« on: January 24, 2019, 04:35:40 PM »
Thanks for taking a look. I have a module under attract/modules/blurred-art In the module.nut file, I try to instantiate a shader that's in the same folder. I've tried variations of the following without success:

Code: [Select]
class BlurredArt {
    // Stuff
    constructor (...) {
        shaderA = fe.add_shader( Shader.Fragment, "gauss_kernsigma_o.glsl" ); // Doesn't work
        shaderB = fe.add_shader( Shader.Fragment, fe.module_dir + "gauss_kernsigma_o.glsl" ); // Doesn't work
        shaderC = fe.add_shader( Shader.Fragment, fe.module_dir + "blurred-art/" + "gauss_kernsigma_o.glsl" ); // Doesn't work
    }
}

The shader file is in the same folder (blurred-art) as the module.nut. Any ideas?

25
Scripting / fe.module_dir doesn't seem to work?
« on: January 24, 2019, 03:28:36 PM »
Hi all. Is there some trick to getting fe.module_dir to work? Is it even a real thing? I don't see any reference to it in the front-end binding section on github, but I've seen it in other people's code. Is it something I have to assign? If so, what kinds of voodoo are involved? I have a shader in a module folder, but whenever I run my layout, I'm told it can't find the relevant file. If I move the shader file to the layout folder, it works, but in my module script, it's effectively ignored. What am I missing? Thanks for any help!

26
Scripting / Vertex shader to address only part of the screen?
« on: January 23, 2019, 03:59:46 PM »
Hey there. I have a few shaders I've "written" (and by "written," I mean largely stolen from shadertoy and tweaked), but they affect the entire screen, and that's not what I'm going for. I want to be able to affect only a specific portion of the screen (or, more specifically, a surface that's smaller than the screen). I think a vertex shader might help, but I have no idea how to write one, and all my googling returns results for Unity or some other 3D-centric environment, and I'm not math-savvy enough to figure out what I need to do.

Has anyone run into anything similar? And come up with a working solution? Would such a person be willing to help a guy out? I appreciate it! Thanks!

(I'm attaching my kinda-sorta-working shaders just for laughs.)

27
General / Re: A question of language. Only for native english.
« on: January 22, 2019, 04:08:44 AM »
What about "Choose this option to set the number of times played and the amount of time played to zero."?

Edit: VVV keil's suggestion is the best, I think. To the point and clear.

28
Scripting / Re: Drop shadow layout, may be turned into something useful?
« on: January 21, 2019, 07:05:16 AM »
Thanks for the elucidation. Squirrel's display stack is different from what I'm used to (from a prior life). When I have an opportunity, I'll see if I can convince it to work on an arbitrary surface.

29
Scripting / Re: Drop shadow layout, may be turned into something useful?
« on: January 20, 2019, 08:10:20 PM »
All right, @zpaolo11x, I took your code and wrapped it in a class (attached). It works for me...the typical way it should, I think, but in the grander scheme of things, it doesn't work for my purposes! I think it has to do with how the first image (a video in my case) doesn't come up on layout start: you have to navigate through the list to trigger things. I think if I can solve this issue (which I still have no idea how to do!), I'd be good to go.

For those with less ridiculous layouts than me, here's how to instantiate the wrapped drop-shadow (there's better "documentation" in the .nut):

Code: [Select]
fe.do_nut( "drop-shadow.nut" );

local myPic = fe.add_artwork( "snap", 100, 100 ); // Arbitrary placement

local myPicDS = DropShadow( myPic, 25, 0, 10, 153 ); // Shadowed object, blur size, x-offset, y-offset, alpha (0~255)

You'll need zpaolo11x's gauss_kernsigma_o.glsl file for any of this to work!

If anyone has any idea why my layout isn't showing a snap when it first loads, I'm all ears! Thanks!

30
Scripting / Re: Drop shadow layout, may be turned into something useful?
« on: January 20, 2019, 03:03:03 PM »
Would be cool if you could also show how to do a white glow behind wheel art :)

This together with the conveyor module would be gold!  :)

I think if you change his set_rgb() call to set_rgb(255, 255, 255) and change the offsets for x and y to 0, you can get something like that. Maybe even set the blend_mode to BlendMode.Screen.

Pages: 1 [2] 3 4 ... 8