Sign in to follow this  
Enormator

Enormators Effects

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

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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!

Share this post


Link to post
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!

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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^^

Share this post


Link to post
Share on other sites
EmbossEffect embosseffect = new EmbossEffect();
EmbossEffectConfigToken token = new EmbossEffectConfigToken((double)45);
embosseffect.Render(token, new RenderArgs(dst), new RenderArgs(src), selectionRegion);

Share this post


Link to post
Share on other sites

And if the effect isn't a standart effect? Let's say I want to do a feather. Can I use a dll in the effects folder?

(I don't need to give args, default will work fine)

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

The way you describe it looks a bit strange to me. Could you make (by hand) a picture of what you want to do?

Could you publish as it is the code you've done till now for that?

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this