Activate pixel effect with code?

  • #1, by Simon_ASAFriday, 23. September 2016, 11:20 8 years ago
    Hello everyone,

    In the Game menu, there is the option to check: Activate pixel effect.

    I would like to leave the choice to the player. It would require to create an option in the game, and so the possibility to switch this option on or off with LUA. I can't find this possibility in the wiki.

    Do you know if it is possible? Thanks!

    Great Poster

    321 Posts


  • #2, by sebastianFriday, 23. September 2016, 11:33 8 years ago
    I only found GameMinificationFilter and GameMagnificationFilter (for characters) but they are bot scriptable...

    Thread Captain

    2346 Posts

  • #3, by afrlmeFriday, 23. September 2016, 12:16 8 years ago
    I don't see anything for it in the data structure either. Does the pixel effect actually do anything? As far as I'm aware it only really affects games with low default game resolutions - I've never used it before though, so I couldn't say.

    * edit: just tested it. Looks super shitty activated with 1920x1080 resolution scaled down to 1366x768 on my laptop screen. Not got the time at the minute to try it on my hd screen.

    Imperator

    7278 Posts

  • #4, by Simon_ASAMonday, 26. September 2016, 11:07 8 years ago
    Thanks guys. I'll try with the filters Sebastian gave.

    Great Poster

    321 Posts

  • #5, by afrlmeMonday, 26. September 2016, 11:45 8 years ago
    They are only for characters. They won't render the entire scene in a pixel effect. Hmm, you might be able to use the openGL shader to add a light mosaic or pixelate effect to the scene though... Simon!? (not you! I'm on about the wizard)

    Imperator

    7278 Posts

  • #6, by Simon_ASAMonday, 26. September 2016, 12:35 8 years ago
    smile Don't worry, I mainly want the effect on the characters.

    However I seem to have troubles to find the correct syntax to enable/disable GameMinificationFilter and GameMagnificationFilter
    .......
    Could someone help me? I just want to set it to 0 or 1, and I thought it was easy, but whatever I try it makes no difference on the screen.

    Great Poster

    321 Posts

  • #7, by afrlmeMonday, 26. September 2016, 12:44 8 years ago
    game.MinificationFilter = 0 -- or 1 for nearest neighbor
    game.MagnificationFilter = 0 -- or 1 for nearest neighbor
    

    Imperator

    7278 Posts

  • #8, by Simon_ASAMonday, 26. September 2016, 14:33 8 years ago
    Mmmh thanks, but it doesn't seem to bring any changes to the characters.

    My game is 1280x720 and the screen resolution is 1920x1080 (Windows desktop resolution).

    I am using your code from above to switch between mini/magni filters activated or not. My script is on the Space key (on release).

    Example:

    If condition Filter is true
      Execute script (1 -- see below)
    else
      Execute script (2 -- see below)
    end if
    Toggle condition Filter
    


    Script (1)
      game.MinificationFilter = 0
      game.MagnificationFilter = 0
    


    Script (2)
      game.MinificationFilter = 1
      game.MagnificationFilter = 1
    


    So everytime I press Space in the game, I should see a difference on my characters, shouldn't I? More or less pixels I mean. Or what am I doing wrong?

    Great Poster

    321 Posts

  • #9, by afrlmeMonday, 26. September 2016, 15:03 8 years ago
    Maybe they require reloading the scene?

    * edit: doesn't seem to make any difference, then again it's only how the scaling is handled - it's not a pixel effect thing. Maybe Simon could make a data structure entry for pixel effect for the next build, if one doesn't already exist?

    Alternatively, you could use export 2 vis files, 1 with pixel effect active & the other without. Maybe create something in the config.ini file to say whether pixel effect is true & then if it is replaceGame("new ved name") -- not sure if it works like that off the top of my head, but you get the idea.

    Imperator

    7278 Posts

  • #10, by sebastianMonday, 26. September 2016, 16:41 8 years ago
    its how the character get smoothed (or not) when scaled.

    Thread Captain

    2346 Posts

  • #11, by Simon_ASATuesday, 27. September 2016, 11:39 8 years ago
    Sebastian, thanks. Yes I know, but for me it doesn't work when I try to switch on or off the smooth effect on "live". Have you already used the game.MinificationFilter (or magnification) code in a project? Do you know if it can be smoothed on/off on the screen without reloading the scene?

    In case it doesn't work then yes Lee, it would be great if Simon (the other one) could create a pixel effect in the next build.

    Great Poster

    321 Posts