Anyone checked out the new Shader stuff yet?

  • #1, by afrlmeSaturday, 09. August 2014, 15:55 6 years ago
    Been having a bit of fun messing around with SimonS' Shader Toolkit Script & functions past few days. Added a few new functions to it myself as well. Check out the Script Index section of the wiki for the Shader Toolkit Script & some example function pages. I've not finished documenting them all yet mind.

    It is also actually possible to write your own custom shader scripts & functions, if you have any knowledge of C & openGL ES 2.0; which sadly I currently do not. But there's still plenty of interesting stuff you can do with the toolkit functions alone, or in combination with lua script or action parts. I managed to create a dynamic hand held camera movement effect by combining a couple action parts, a tiny bit of lua script & a loop.

    I believe SimonS intends to sort out some action parts for setting/changing various shader functions - at some point - so even the none lua savvy users can easily use the shader functions to get visually creative with their games.

    Anyway check it out if you get a chance, as you can do lots of interesting things like: zoom in/out, rotate screen, pan camera, adjust saturation, hue, contrast, colorize etc etc...

    Imperator

    6842 Posts


  • #2, by marvelSaturday, 09. August 2014, 17:34 6 years ago
    I already realized some zoom-effects for zak2. It's a great thing smile

    Key Killer

    598 Posts

  • #3, by afrlmeSaturday, 09. August 2014, 17:48 6 years ago
    I updated the shader toolkit script with some new functions.

    * shaderZoom() -- simple zoom in/out
    * shaderPan() -- move camera on horizontal or vertical axis independently
    * shaderRotate() -- rotate camera using degrees instead of Pi

    I wasn't too keen on the shaderViewport() function because it wasn't as dynamic as setting different delay/easing values for each thing.

    Imperator

    6842 Posts

  • #4, by SDMonoSaturday, 09. August 2014, 17:57 6 years ago
    Really cool stuff!!! Thanks Man!!!!

    Forum Fan

    148 Posts

  • #5, by afrlmeSaturday, 09. August 2014, 18:02 6 years ago
    Really cool stuff!!! Thanks Man!!!!


    Was SimonS who implemented the openGL shader into VS & wrote the toolkit script! wink

    Imperator

    6842 Posts

  • #6, by SDMonoSaturday, 09. August 2014, 18:36 6 years ago
    Oh so the big thanks goes to SimonS!!!

    Hmm can the shaderLightness be used as a brightness Slider options in my games settings?

    Forum Fan

    148 Posts

  • #7, by ke4Saturday, 09. August 2014, 18:42 6 years ago
    Nice! I'm playing with it now.
    Can you show how the hand held camera looks? Sounds cool.

    Key Killer

    810 Posts

  • #8, by afrlmeSaturday, 09. August 2014, 19:25 6 years ago
    @ SDMono: sure you could create slider options for lightness, contrast, saturation etc. However we also have the getWindowBrightness() & setWindowBrightness() functions for getting & setting the global window brightness, which I believe is similar to shaderLightness(). However shaderContrast() is the more interesting one to adjust methinks.

    @ Ke4: maybe I'll sort out a little tech demo or video of it at some point. On the scene I've been testing it on I had to zoom into the scene a little bit because the scene is the same size as the default game resolution which means that at default zoom value you end going past the edge of the available screen at times. Plus you have to use subtle values of 10 pixels or less otherwise it looks a bit mad. I've found that a random value between 5 seems to work quite well.

    Here's a quick rundown of what I've done so far.

    1. inside an at begin of scene action I added an execute a script action part to zoom into the scene a fraction. It's up to you if you want to ease into scene over a period of time or snap to new zoom level instantly...
    shaderZoom(1.01, 0, easeLinearIn) -- instant zoom to .01x
    1
    2

    2. I then created 2 values which I use to set random delay values between 3 & 5 seconds. I called them: dc_delay_x & dc_delay_y.
    3. I created 2 called by other actions in which I added...

    if current character is on x scene
    execute a script...

    local pos = game:getPoint(VGameScrollPosition)
    local delay = math.random(3000, 5000)

    getObject("Game.GameCurrentScene.SceneValues[dc_delay_x]"):setValue(VValueInt, delay)

    if shader_offsetx <= pos.x then
    shaderPan( pos.x + math.random(5), delay, easeBackIn, false)
    else
    shaderPan( pos.x - math.random(5), delay, easeBackOut, false)
    end
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11

    pause for "dc_delay_x"
    jump to action part #1
    end if


    Same again but with some name changes in the script & the pause value being linked to dc_delay_y instead of dc_delay_x.

    What this script is doing is generating a random delay time between 3 & 5s for x & then a different delay value for y which makes the movement more dynamic. It is of course entirely possible to set a random easing option too, which I tested out yesterday by adding multiple easing options into a table & then randomly grabbing one from the table based on index number.

    quick example of grabbing random easing option...
    local t = {easeLinearIn, easeLinearOut, easeCircIn, easeCircOut, easeCircInOut}
    local rand = math.random( 1, table.maxn(t) )

    shaderPan( 300, 3000, t[rand], false ) -- pan to 300 on x-axis over 3s with random easing option
    1
    2
    3
    4
    5

    ...something for you to get started. wink

    Imperator

    6842 Posts

  • #9, by SDMonoSaturday, 09. August 2014, 19:44 6 years ago
    I am not a 100% sure but I believe that the global window brightness just goes up to a 100% and that's the brightness of the original file. Using the shaderLightness lets you go over 100% I think.

    Forum Fan

    148 Posts

  • #10, by afrlmeSaturday, 09. August 2014, 19:48 6 years ago
    Ah yeah you are right. The values in the shader are in float so 1 = default value. 2 = double. 0 = black. I don't recommend allowing the players to go too high though with most of the effect settings as they can generate some weird effects.

    * edit: I was wrong. shaderLightness default is 0.

    Quite a few of the functions have 1 as default.

    * I recommend not going higher than 0.5 but I think even that is too high as it is showing strange color artifacts with that setting too.

    Imperator

    6842 Posts

  • #11, by SDMonoSaturday, 09. August 2014, 20:07 6 years ago
    Yeah I was trying 0.1 and that's already very noticeable. So a gamma slider between -0.1 - 0.1 is enough I guess.

    Does your shaky cam move with the character?

    ps: Also like the 0 saturation... gotta love black&white!!! smile

    Forum Fan

    148 Posts

Write post