Author Topic: Drop shadow layout, may be turned into something useful?  (Read 19177 times)

calle81

  • Sr. Member
  • ****
  • Posts: 184
    • View Profile
Re: Drop shadow layout, may be turned into something useful?
« Reply #30 on: January 28, 2019, 09:12:46 AM »
I have no clue how this works so excuse the probably stupid question. Performance wise. When adding a drop shadow to a video snap, does that mean i play two videos at the same time just for the dropshadow or is the dropshadow a "static" image?

Bgoulette

  • Sr. Member
  • ****
  • Posts: 116
  • I wrote a book.
    • View Profile
    • BlakeGoulette.com
Re: Drop shadow layout, may be turned into something useful?
« Reply #31 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!

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1167
    • View Profile
Re: Drop shadow layout, may be turned into something useful?
« Reply #32 on: January 28, 2019, 02:59:44 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!

Yes. If you need access to that path outside the scope of that file, store it in another variable. That’s how on my shader module I make the path available from any scope.

zpaolo11x

  • Hero Member
  • *****
  • Posts: 1233
    • View Profile
    • My deviantart page
Re: Drop shadow layout, may be turned into something useful?
« Reply #33 on: January 29, 2019, 01:15:52 AM »
I have no clue how this works so excuse the probably stupid question. Performance wise. When adding a drop shadow to a video snap, does that mean i play two videos at the same time just for the dropshadow or is the dropshadow a "static" image?

The drop shadow is not a static image, but it's a clone of the original image that is then blurred and turned black. So you are not actually "playing" two videos, but cloning the texture where the video is displayed and this should have not a great impact. Performance wise adding the drop shadows has some impact because there is a nested surface stack and the shader has to do texture fetches and computation.

Bgoulette

  • Sr. Member
  • ****
  • Posts: 116
  • I wrote a book.
    • View Profile
    • BlakeGoulette.com
Re: Drop shadow layout, may be turned into something useful?
« Reply #34 on: January 29, 2019, 03:12:24 AM »
One last (?!) iteration of the shader-glow module, based wholly on zpaolo11x's drop shadow and ambient glow shaders and code:

dukpoki

  • Sr. Member
  • ****
  • Posts: 138
    • View Profile
Re: Drop shadow layout, may be turned into something useful?
« Reply #35 on: January 29, 2019, 11:01:51 AM »
One last (?!) iteration of the shader-glow module, based wholly on zpaolo11x's drop shadow and ambient glow shaders and code:

Bgoulette, we need to rename "module.nut" to "drop-shadow.nut" right?  And then place all of those files (1 nut file + 3 glsl files) into "attract/modules/"?  I did that and added these 2 lines into my existing layout and i'm not getting anything.

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

local ds = DropShadow( "snap", 10, 100, 100, 10 );


I've also tried dropping those glsl files into the layout folder but no dice.  I feel like i'm missing something very obvious.  Lol



Bgoulette

  • Sr. Member
  • ****
  • Posts: 116
  • I wrote a book.
    • View Profile
    • BlakeGoulette.com
Re: Drop shadow layout, may be turned into something useful?
« Reply #36 on: January 29, 2019, 11:16:43 AM »
All you should have to do is unzip the archive in your modules folder (attract/modules/shadow-glow). Nothing needs to be renamed. In fact, renaming anything will probably break things!

Once that's done, in your layout, before you want to apply the drop shadow, use this line: fe.load_module("shadow-glow")

Once those things are done, you'll need to create an instance of your snap first, then apply the drop shadow, maybe something like this:

Code: [Select]
// Load module so we can instantiate DropShadow:
fe.load_module("shadow-glow")

// Create a quick and dirty background (drop shadow won't show up against black!):
local bg = fe.add_text("", 0, 0, fe.layout.width, fe.layout.height);
bg.set_rgb(127, 127, 127);

// Create our artwork and apply a drop shadow to it:
local mySnap = fe.add_artwork("snap", 0, 0, 320, 240)
local myDropShadow = DropShadow(mySnap, 50, 10, 10, 153)

// If we want something other than pure black, we can tweak the drop shadow color:
myDropShadow.set_ds_rgb(0, 0, 51);

The values in that example are arbitrary, but should give you an idea of what's going on. Let me know if that doesn't work. I assume you're using the most recent files (from the post you quoted)? The others had some flaws!

(Edited to include comments and stuff.)
« Last Edit: January 29, 2019, 12:30:36 PM by Bgoulette »

dukpoki

  • Sr. Member
  • ****
  • Posts: 138
    • View Profile
Re: Drop shadow layout, may be turned into something useful?
« Reply #37 on: January 29, 2019, 09:18:55 PM »
@Bgoulette

Thanks.  Works perfectly now!

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: Drop shadow layout, may be turned into something useful?
« Reply #38 on: January 29, 2019, 10:19:49 PM »
cant seem to get text shadow with the module...
any help ;)
help a friend....

zpaolo11x

  • Hero Member
  • *****
  • Posts: 1233
    • View Profile
    • My deviantart page
Re: Drop shadow layout, may be turned into something useful?
« Reply #39 on: January 30, 2019, 01:13:46 AM »
cant seem to get text shadow with the module...
any help ;)

I can't check it right now but you can try adding the text to a surface, then applying the shadow to that surface. That way it should work, I had issues using text objects directly but through a surface it should work with little or no overhead

qqplayer

  • Sr. Member
  • ****
  • Posts: 301
    • View Profile
Re: Drop shadow layout, may be turned into something useful?
« Reply #40 on: May 06, 2019, 08:39:22 AM »
Anyone is having msvcrt.dll and ntdll.dll errors randomly using tis drop shadow feature.
I made som changes to the hyperpie layout from carls and when I move inside my gamelist, attract mode crashes and is returning me those two dll errors.
Tested on three diferent computers with w8.1 and attrackt 2.5.1

arthurvalenca

  • Sr. Member
  • ****
  • Posts: 125
    • View Profile
Re: Drop shadow layout, may be turned into something useful?
« Reply #41 on: May 01, 2020, 04:58:36 PM »
A simple variation of the previous layout tuned to obtain an "ambilight" effect... now the black shadow is not present and the luminosity is boosted... The perfect evolution would be that parts of the image with black color would bleed white light, but if you want to obtain a "old CRT halo in night room" effect instead of a "modern TV backlighting ambient light" effect this is perfect :D

hello Paolo, could you help me with this code that you provided? i don't get the snap image just a black screen something has to be modified to work?

zpaolo11x

  • Hero Member
  • *****
  • Posts: 1233
    • View Profile
    • My deviantart page
Re: Drop shadow layout, may be turned into something useful?
« Reply #42 on: May 04, 2020, 01:05:56 AM »
hello Paolo, could you help me with this code that you provided? i don't get the snap image just a black screen something has to be modified to work?

I checked that layout and I get a black screen too... let me do some checks, it's a pretty old code and probably something needs to be changed...

zpaolo11x

  • Hero Member
  • *****
  • Posts: 1233
    • View Profile
    • My deviantart page
Re: Drop shadow layout, may be turned into something useful?
« Reply #43 on: May 04, 2020, 01:26:03 AM »
hello Paolo, could you help me with this code that you provided? i don't get the snap image just a black screen something has to be modified to work?

There's a line in the code:

Code: [Select]
pic0.video_flags = Vid.ImagesOnly
so if you don't have static snaps but only videos you won't see anything. I think if you remove that line it will work for videos too, or you'll have to add snaps to your artworks

arthurvalenca

  • Sr. Member
  • ****
  • Posts: 125
    • View Profile
Re: Drop shadow layout, may be turned into something useful?
« Reply #44 on: May 05, 2020, 11:34:08 AM »
hello Paolo, could you help me with this code that you provided? i don't get the snap image just a black screen something has to be modified to work?

There's a line in the code:

Code: [Select]
pic0.video_flags = Vid.ImagesOnly
so if you don't have static snaps but only videos you won't see anything. I think if you remove that line it will work for videos too, or you'll have to add snaps to your artworks

Thanks Paolo solve my problem.