set blur strength to sprite speed

This forum is currently in read-only mode.
  • i read that through about a hundred times and i feel i sprained something in my head <img src="smileys/smiley36.gif" border="0" align="middle" />

    "rv = max((current - min) / (max - min), 0)"

    so. i need to add a new calculation before the old calc?.

    if we go by the latest of your .caps:

    100 - ((Sprite('dist') / TimeDelta / 80) * 100)

    start value would be for example 20 px/s and max would be 80px/s in this case.

    dist/TimeDelta/80

    you'd think it would be easy to just throw the 20 somewhere there after dist, but i cant get it to work

    using 20 and 80 would result in a negative value, correct?

    im just not sure what and exactly where i should be adding something in that dist/timedelta/80 formula.

    <img src="smileys/smiley9.gif" border="0" align="middle" />

  • Welcome to tula's school of mathematics! ( <img src="smileys/smiley4.gif" border="0" align="middle"> sorry, I couldn't resist)

    Always remember the formula and then think about what parts belong to what name in the formula. For example:

    Sprite('dist') / TimeDelta / 80

    Here we use real values and variables instead of the names in the formula. Also don't forget that we omitted 'min', because it is always 0 in this example. The formula here was just 'current / max'.

    Let's first assign the real values to the names of the formula:

    <font color="red">Sprite('dist') / TimeDelta</font> / <font color="blue">80</font>

    where red = current, and blue = max. Now we have to add 'min' back into the formula:

    (<font color="red">current</font> - min) / (<font color="blue">max</font> - min)

    Replace the colored parts with the real values. You get

    (<font color="red">Sprite('dist') / TimeDelta</font> - min) / (<font color="blue">80</font> - min)

    Next step is to replace min by a value of your choice, for example 20 px/s:

    (<font color="red">Sprite('dist') / TimeDelta</font> - 20) / (<font color="blue">80</font> - 20)

    And last but not least you have to use max(a, b):

    max( (<font color="red">Sprite('dist') / TimeDelta</font> - 20) / (<font color="blue">80</font> - 20), 0 )

    Done <img src="smileys/smiley1.gif" border="0" align="middle">

    Extended the cap again, this time using globals that match the names of the formula (like 'current', 'maximum', 'minimum' and 'relative_value'). The scale effect will not start until the sprite is 20 px/s fast (or whatever value you set the global 'minimum' to): http://db.tt/8OB13G0C

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • well sh*t, it works beautifully!

    finally i get it. at least i think i do <img src="smileys/smiley36.gif" border="0" align="middle" />

    now its just a matter of trial and error to get the blur values just right but thats easily and quickly done. i already started thinking that i could make a top layer, scroll 0, stretch a sprite over the layer, make a transparent hole in the center, set position to player, use that blurmask effect someone made here, then apply this code to be used on the blurmask opacity, for example, sprite speed less than 20 px/s ---> set blurmask opacity to 0, and so on.. that could work really well!

    this also raised another question:

    could this be implemented on making 2 layers with different scroll rates communicate with each other, considering the collisions and overlapping? i remember seeing a thread long ago where this was briefly discussed, but couldnt find it.

    another thing: do you have any idea why the built in motion blur is so frigging heavy? its kind of a shame too, since it looks really good.

    the reason i got caught up on this was because i recently bought the new doom 3 bfg edition, and while it may not be as solid as all the mods for the original(i wouldnt know, i havent gotten the best mods to work), what really struck me was the added motion blur, that looks just absolutely stunning and delicious, combined with the rock solid no less than 60 fps. the fact that the blur affects everything else but the players hands and weapons gives the picture a surprising amount of depth

    and looks really great.

    but anyway, thank you so much for educating me on this matter, instead of just giving me a simple code, now i understand what it does <img src="smileys/smiley20.gif" border="0" align="middle" />

    ill be sure to give you credit whenever i get something finished with construct, once again its nice to see theres helpful people around here!

    <img src="smileys/smiley41.gif" border="0" align="middle" />

  • You're welcome <img src="smileys/smiley1.gif" border="0" align="middle" />

    Motion blurring in display size involves several frames to be morphed. There might be a rendering of 8 or 16 frames in display size for just one output frame. I'm not sure though if this is the way Ashley implemented it.

    I look forward to seeing your results!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)