oppenheimer's Forum Posts

  • hi there!

    i'm pretty much into pixel shader lately, and it's going pretty well so far. but one thing that bothers me, is that i don't have any clue about antialiasing/smoothing hard edges, which occur, when i want to tile ranges between 0.0 and 1.0. a common practice when tiling values is using mod or fract.

    currently, i try to develope a shader which can tile/offset/rotate a sprite's texture like on the following image. as you can see, fract introduces nasty jaggies, which i like to get rid off.

    <center><img src="https://dl.dropbox.com/u/6200498/Construct%202/wishlist/jaggies.png" border="0"></center>

    on my research, i found a pretty interesting tutorial that deals with a halftone shader, which can be found here and sheds light on antialiasing as well. in step "3. Anti-aliasing is required" it is mentioned that we normally use dFdx() and dFdy() or fwidth to determine automatic derivatives which can interpolate our rough fract values painlessly. but since this cool webgl extension is not enabled within C2, we have to find other options to smooth out jaggies by finding customized versions of our functions.

    so my question is, perhaps Ashley , how are the pre-defined uniforms pixelWidth/pixelHeight connected to those unavailable functions dFdx/dFdy/fWidth and how can i achieve a smoothing on hard edges between 0.0 and 1.0 maybe with the help of pixelWidth/Height? i really like to offer some generative shaders to the community with some sort of antialiasing... please help me out on this one.

  • thanks guys, it means much to me! <img src="smileys/smiley23.gif" border="0" align="middle" />

  • jojoe

    the erode/dilate filter is ready ;)

  • Here is the 2in1 effect as requested by jojoe.

    It erodes / dilates the source texure by various parameters:

    Mode: [0.0]=Erosion; [1.0]=Dilation;

    Steps X/Y: Kernel steps. Limited to 10 steps in each direction. (you may customize this in the .fx file)

    Pixel X/Y: Pixel multiplier. Default = 1.0; Weakens or strengthens the effect without touching the kernel size.

    Intensity: Value for final mix.

    Download & place the files in C2's effect folder:

    https://www.dropbox.com/s/3f822nzfdnycw ... lation.zip

  • cool one, septeven !

    it'll save time creating addons. i'm looking forward to a fixed c2addon implemetation, because i have the feeling that some things are still wrong with it.

    did you experienced problems with the urls in the dialog, septeven?

    like truncated urls, when they are too long or malfunctioning linking to those urls?

  • Ashley

    After testing this out i encountered 2 little issues in the dialog prompt:

    1) The urls (website/documentation) are cut off after a certain length

    2) The urls do link to the pages.

  • 7Soul

    doesn't sound too complicted, i'll see what i can do.

    jojoe

    erode/dilate are convolution effects and should be doable, i look into that.

    a full set of perlin/simplex noise shaders are on their way, though i still need more time ^^

  • booo. <img src="smileys/smiley17.gif" border="0" align="middle" />

  • Ashley - nice, it works!

    i can imagine some improvements:

    • associate the file extension with c2!
    • make the infos availabe in the corresponding dialogs, not just at install-time. it would greatly serve the purpose of telling what the addons actually do, if the user isn't quite sure.
    • why is it being extracted? keeping it as a c2addon would keep the directories "clean"
    • future option to have password protected c2addons to be able to offer paid addons. just came to my mind.. i should elaborate on that later...
  • Did you have time to update the plugin? Thx for even making it ;)

  • Irbis

    wow, that's been a resurrection ;)

    here is the outline effect

  • Yes, please! I'm just about to release another effect.

    Ashley

    Are we able to provide more than one plugin/behavior/effect with one .c2addon?

  • Link to .capx file (required!):

    https://dl.dropbox.com/u/6200498/Construct%202/capx/bugged/9patch_powerof2-bug.capx

    Steps to reproduce:

    1. Place a 9-Patch object width dimensions != power of 2.

    2. Preview with web gl on AND off.

    Observed result:

    Exception with web gl OFF:

    Javascript error!Uncaught Error: InvalidStateError: DOM Exception 11http://localhost/NinePatch_plugin.js, line 149 (col undefined)

    Exception with web gl ON:

    Javascript error!Uncaught Error: InvalidStateError: DOM Exception 11http://localhost/glwrap.js, line 1292 (col undefined)

    I guess this is the stretching routine for non power of 2 textures.

    Expected result:

    No exception thrown / 9-patch working stretching routine. ;)

    Browsers affected:

    Chrome: yes

    Firefox: yes

    Internet Explorer: very possible

    Operating system & service pack:

    Windows 7 Prof.

    Construct 2 version:

    r120.2 64bit

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ashley

    I thought a bit more on what to add to the skd/shader documentation and the backend. In CC we had the option to get the boxWidth and boxHeight within a shader. That would be a really cool feature for generative shaders (like a shape-shader or simplex noise), because it's independent from the texture size. The other params like boxTop//Bottom/Left/Right and hotspot positions can be discarded i think, because we can access those directly (0,1,0,1) or by events setting regular floats.

    I hope that it won't take much time to implement & you agree on usefulness. <img src="smileys/smiley2.gif" border="0" align="middle" />

  • yeah! was a pleasure to help.

    one thing though.. where did u find the source, Joannesalfa

    maybe we should add it to the .fx to give 'proper' credit.