Jump to content
How to Install Plugins ×

Enormators Effects


Enormator

Recommended Posts

I dunno... Like I said, it's a very small change. I didn't do much. :wink:

I just kept the instantiation of the Primary Color and the first slider from the default CodeLab source, and set the variable to change what's added in the Random call. As such, I can't make it shorter, other than by selecting a shorter region, but I can make it longer to fill the whole area with gradating alpha goodness. :D

int Amount1=1;	//[1,500]Length
int Amount2=0;  //[0,50]Seed

void Render(Surface dst, Surface src, Rectangle rect)
{
   PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds);
   Rectangle selection = selectionRegion.GetBoundsInt();
   ColorBgra PrimaryColor = (ColorBgra)EnvironmentParameters.PrimaryColor;
   Random rand = new Random(Amount2);

   ColorBgra CurrentPixel;
   for(int x = rect.Left; x < rect.Right; x++)
   {
       int length = rand.Next(selection.Height - 1) + Amount1;
       for (int y = rect.Top; y < rect.Bottom; y++)
       {
           CurrentPixel = PrimaryColor;
           CurrentPixel.A = Utility.ClampToByte(255 * (length - y) / length);
           dst[x,y] = CurrentPixel;
       }
   }
}

I also made a little 16px by 16px icon for it (cascade.png), and built the DLL, calling it "Cascade".

If there's anything grievously wrong with this code, please lemme know. I'm still learning this whole thing, after all. :wink:

Edit: Changed to newest source

I am not a mechanism, I am part of the resistance;

I am an organism, an animal, a creature, I am a beast.

~ Becoming the Archetype

Link to comment
Share on other sites

I dunno... Like I said, it's a very small change. I didn't do much. :wink:

I just kept the instantiation of the Primary Color and the first slider from the default CodeLab source, and set the variable to change what's added in the Random call. As such, I can't make it shorter, other than by selecting a shorter region, but I can make it longer to fill the whole area with gradating alpha goodness. :D

int Amount1=1;	//[1,500]Length
int Amount2=0;  //[0,50]Seed

void Render(Surface dst, Surface src, Rectangle rect)
{
   PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds);
   Rectangle selection = selectionRegion.GetBoundsInt();
   ColorBgra PrimaryColor = (ColorBgra)EnvironmentParameters.PrimaryColor;
   Random rand = new Random(Amount2);

   ColorBgra CurrentPixel;
   for(int x = rect.Left; x < rect.Right; x++)
   {
       int length = rand.Next(selection.Height - 1) + Amount1;
       for (int y = rect.Top; y < rect.Bottom; y++)
       {
           CurrentPixel = PrimaryColor;
           CurrentPixel.A = Utility.ClampToByte(255 * (length - y) / length);
           dst[x,y] = CurrentPixel;
       }
   }
}

I also made a little 16px by 16px icon for it (cascade.png), and built the DLL, calling it "Cascade".

If there's anything grievously wrong with this code, please lemme know. I'm still learning this whole thing, after all. :wink:

Edit: Changed to newest source

I am not a mechanism, I am part of the resistance;

I am an organism, an animal, a creature, I am a beast.

~ Becoming the Archetype

Link to comment
Share on other sites

NO! MINE! He cannot has. :P

Sure, go for it! As long as the something you're making is going to be awesome. :wink:

I am not a mechanism, I am part of the resistance;

I am an organism, an animal, a creature, I am a beast.

~ Becoming the Archetype

Link to comment
Share on other sites

NO! MINE! He cannot has. :P

Sure, go for it! As long as the something you're making is going to be awesome. :wink:

I am not a mechanism, I am part of the resistance;

I am an organism, an animal, a creature, I am a beast.

~ Becoming the Archetype

Link to comment
Share on other sites

I think you will like....

oh, by the way CMD, my new avatar was made using basically your cascade script... just, a bit different. It was still based off of Enormator's code though.

xZYt6wl.png

ambigram signature by Kemaru

[i write plugins and stuff]

If you like a post, upvote it!

Link to comment
Share on other sites

I think you will like....

oh, by the way CMD, my new avatar was made using basically your cascade script... just, a bit different. It was still based off of Enormator's code though.

xZYt6wl.png

ambigram signature by Kemaru

[i write plugins and stuff]

If you like a post, upvote it!

Link to comment
Share on other sites

I dunno... Like I said, it's a very small change. I didn't do much. :wink:

I just kept the instantiation of the Primary Color and the first slider from the default CodeLab source, and set the variable to change what's added in the Random call. As such, I can't make it shorter, other than by selecting a shorter region, but I can make it longer to fill the whole area with gradating alpha goodness. :D

int Amount1=1;	//[1,500]Length

void Render(Surface dst, Surface src, Rectangle rect)
{
   PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds);
   Rectangle selection = selectionRegion.GetBoundsInt();
   ColorBgra PrimaryColor = (ColorBgra)EnvironmentParameters.PrimaryColor;
   Random rand = new Random(0);  // <=== (1)

   ColorBgra CurrentPixel;
   for(int x = rect.Left; x < rect.Right; x++)
   {
       int length = rand.Next(selection.Bottom - selection.Top -1) + Amount1;  // <=== (2)
       for (int y = rect.Top; y < rect.Bottom; y++)
       {
           CurrentPixel = PrimaryColor;
           CurrentPixel.A = Utility.ClampToByte(255 * (length - y) / length);
           dst[x,y] = CurrentPixel;
       }
   }
}

If there's anything grievously wrong with this code, please lemme know. I'm still learning this whole thing, after all. :wink:

2 remarks:

1. Random(0) will always give the same value, all images should be similar. I suggest to use Amount2 [0,9999] Reseed Number.

2. selection.Bottom - selection.Top -1 will always give the same value : take it out the 'for' loop!

Link to comment
Share on other sites

I dunno... Like I said, it's a very small change. I didn't do much. :wink:

I just kept the instantiation of the Primary Color and the first slider from the default CodeLab source, and set the variable to change what's added in the Random call. As such, I can't make it shorter, other than by selecting a shorter region, but I can make it longer to fill the whole area with gradating alpha goodness. :D

int Amount1=1;	//[1,500]Length

void Render(Surface dst, Surface src, Rectangle rect)
{
   PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds);
   Rectangle selection = selectionRegion.GetBoundsInt();
   ColorBgra PrimaryColor = (ColorBgra)EnvironmentParameters.PrimaryColor;
   Random rand = new Random(0);  // <=== (1)

   ColorBgra CurrentPixel;
   for(int x = rect.Left; x < rect.Right; x++)
   {
       int length = rand.Next(selection.Bottom - selection.Top -1) + Amount1;  // <=== (2)
       for (int y = rect.Top; y < rect.Bottom; y++)
       {
           CurrentPixel = PrimaryColor;
           CurrentPixel.A = Utility.ClampToByte(255 * (length - y) / length);
           dst[x,y] = CurrentPixel;
       }
   }
}

If there's anything grievously wrong with this code, please lemme know. I'm still learning this whole thing, after all. :wink:

2 remarks:

1. Random(0) will always give the same value, all images should be similar. I suggest to use Amount2 [0,9999] Reseed Number.

2. selection.Bottom - selection.Top -1 will always give the same value : take it out the 'for' loop!

Link to comment
Share on other sites

Just realized, rather than selection.Bottom - selection.Top, why not just use selection.Height? It's the same value... and makes the code easier to read.

xZYt6wl.png

ambigram signature by Kemaru

[i write plugins and stuff]

If you like a post, upvote it!

Link to comment
Share on other sites

Just realized, rather than selection.Bottom - selection.Top, why not just use selection.Height? It's the same value... and makes the code easier to read.

xZYt6wl.png

ambigram signature by Kemaru

[i write plugins and stuff]

If you like a post, upvote it!

Link to comment
Share on other sites

calm down everybody. This line effect is just the first step. Further ones will follow.

But I don't tell you what I'm going to do because otherwise some one else may be faster than me. :P

EDIT: And I noticed, that the lines were never repeating. I hust used the effect on a white background^^

Link to comment
Share on other sites

EmbossEffect embosseffect = new EmbossEffect();
EmbossEffectConfigToken token = new EmbossEffectConfigToken((double)45);
embosseffect.Render(token, new RenderArgs(dst), new RenderArgs(src), selectionRegion);

xZYt6wl.png

ambigram signature by Kemaru

[i write plugins and stuff]

If you like a post, upvote it!

Link to comment
Share on other sites

It's about time for a lense flare plugin. And I see that I... just can't do this. Sure the gradient things are no problem but these particles flowing from the center... I just can't do it yet.

If some skilled progger reads this; My idea which I wasn't able to do: Make these random lines from top to bottom but fewer lines. Then add a rect to polar conversion. I made it to do fewer particles but when I rect2polared it, it looked like bloody potato.

May someone more experienced do this. I'm sorry this is above my skills atm.

Link to comment
Share on other sites

Anyway my source seems to be lost. My HDD is nearly broken. And I can't even create by hand what I was aiming for.

This image

part_rays.jpg

is what I was aiming for, just in white and alpha instead of red and black. It is taken from http://www.gamedev.net/reference/articles/article874.asp

My idea was to make these lines (a bit thicker and fewer) and then rect2pol them. But when I did that by hand (rect2pol) it looked ugly.

Link to comment
Share on other sites

Anyway my source seems to be lost. My HDD is nearly broken. And I can't even create by hand what I was aiming for.

This image

part_rays.jpg

is what I was aiming for, just in white and alpha instead of red and black. It is taken from http://www.gamedev.net/reference/articles/article874.asp

My idea was to make these lines (a bit thicker and fewer) and then rect2pol them. But when I did that by hand (rect2pol) it looked ugly.

I tried and came up with this:

flarext5.png

Radical gradient --> Dents --> Zoom Blur Deluxe --> Curves.

The key in that is the dents. To make it look better I should have tried different settings but my first try was good enough I thought.

EDIT: Maybe also using a smaller radical gradient could improve the flare.

sigeb7.png
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...