oppenheimer's Recent Forum Activity

  • thanks for your effort in explaining the problem to me, tulamide!

    well, i knew what pixelWidth meant in general. the thing i didn't get was the relation to dFdx/dFdy/fWidth.

    back to problem itself. Stefan Gustavson is calculating black and white circles and therefore speaks of gradient which describes antialiasing the circles' egdges.

    in my shader, i like to tile & rotate textures. so i need to interpolate the transition areas between one texture and the follow next. to illustrate my problem a bit more, i like show the code i use:

    precision mediump float;
    varying mediump vec2 vTex;
    uniform lowp sampler2D samplerFront;
    uniform float pixelWidth;
    uniform float pixelHeight;
    
    uniform float offx;
    uniform float offy; <font color=GREEN>//Offset the texture</font>
    uniform float tilex;
    uniform float tiley; <font color=GREEN>//Tiling parameter for X and Y</font>
    uniform float rot; <font color=GREEN>//Rotation factor</font>
    
    void main(void)
    {
         float ro = radians(rot); <font color=GREEN>//degree to radians</font>
         mat2 r = mat2(cos(ro), -sin(ro), sin(ro), cos(ro)); <font color=GREEN>//simple rotation matrix</font>
         vec2 tile = vec2(tilex,tiley); <font color=GREEN>//tiling vector</font>
         vec2 off = vTex*tile+vec2(offx,offy);<font color=GREEN>//apply tiling & offset</font>
         vec2 pos = fract(off*r); <font color=GREEN>//new position to sample from</font>
    
         vec4 front = texture2D(samplerFront, pos);
         gl_FragColor = front;
         <font color=GREEN>//sampling & output</font>
    }

    this code produces jaggies of course:

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

    if we knew the exact location of the texture transition area, we could sample there and do the interpolation. currently we jump from the end of texture one (gradient = 1.0) to the beginning of texture two (gradient = 0.0). a smoothing factor provided as a variable could describe that interpolation area (threshold) on the basis of pixelWidth/pixelHeight.

    my main problem is that i can't imagine how to implement this gap area with my current code. Gustavson suggest taking into account the variables uScale cos(uYrot), but i don't know exactly which part of my code corresponds to those.

  • edisone

    my pleasure! more will definately come <img src="smileys/smiley2.gif" border="0" align="middle" />

  • So even poor amateur game creators would benefit from this feature.

    poor amateur game creators don't own photoshop, do they?

    I would be happy for construct to flatten all layers to seperate png's and maybe do some cropping on import

    that's definately photoshop's task! try to see this creatively. i don't know which version of ps you have installed, but check out the "scripts" menu under "file". it contains an option to flatten all layers etc.. do an animation with those and batch export to png/jpg.

    and check out C2's option to duplicate layouts.. normally it should be a nobrainer to set up something like a scetchbook.

    but besides that, i don't know if C2 is the perfect tool for such a task, because if you just want to click through some html pages, notepad++ is your best friend.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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...
oppenheimer's avatar

oppenheimer

Member since 17 May, 2011

Twitter
oppenheimer has 1 followers

Trophy Case

  • 13-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

15/44
How to earn trophies