Custom shader

  • #1, by stroncisTuesday, 25. April 2017, 14:42 8 years ago
    Hi,

    i'm trying to add custom shader, but to no avail. I tried concatenate with basic_fsh from shader toolkit, then tried to add full fragment shader (with declarations, not just main() method), all attempts fruitless.

    This must work, as i understand, because adding directly to shader_effects object, but it doesn't:
    shader_effects.solid = {shader = basic_fsh..[[
      void main() { 
        gl_FragColor = vec4(0.0, 0.7, 0.0, 1.0);
      }
    ]]}

    But this works:
    shader_effects.test = {shader = "sht_ascii.bin"}
    Though it's shader from shader toolkit and it would surprise me, if it didn't work. As i have no access to these *.bin files (which are compiled with the game and i haven't figured how this works exactly), can't compare their content with my code and figure it by myself.

    (RC0, free, latest shader toolkit from http://rollaprint.de/vs/shaderscript9.lua)

    Where's the catch?
    Thank You


    P.S.: If you copy/paste block of code, visionaire adds trailing spaces at end of each line, which accumulates with each new copy/paste.

    P.P.S.: If you will delete or comment out line with gl_FragColor in shader editor - Visionaire will crash. It can be avoided by first adding one more gl_FragColor and then commenting or deleting another.

    Newbie

    42 Posts


  • #2, by afrlmeTuesday, 25. April 2017, 15:08 8 years ago
    Are you using the new RC[0]? There's a new section for creating custom shaders available via the buttons on the main menu. Don't ask me how it works though as I have no clue - I'm afraid you will have to wait for Simon to provide you with an answer/example.

    Imperator

    7285 Posts

  • #3, by stroncisTuesday, 25. April 2017, 15:32 8 years ago
    I have no clue, how these new shaders can be incorporated, so tried the way i understand it must work, after reading into shader toolkit source. It's no hurry, i'll wait for SimonS comments, as i can see, he's getting now a lot of questions and bugs to hunt.

    Accessing it this way doesn't work:
    shader_effects.test = { shader = Shaders.rc_zero_shader }

    Newbie

    42 Posts

  • #4, by afrlmeTuesday, 25. April 2017, 16:15 8 years ago
    I have no clue, how these new shaders can be incorporated, so tryed the way i understand it must work, after reading into shader toolkit source. It's no hurry, i'll wait for SimonS comments, as i can see, he's getting now a lot of questions and bugs to hunt.

    Accessing it this way doesn't work:
    shader_effects["test"]= {shader=Shaders.rc_zero_shader}
    Aye, I'm surprised he's not drowning underneath the amount of questions & bug reports we all keep posting. razz

    Imperator

    7285 Posts

  • #5, by stroncisTuesday, 25. April 2017, 16:37 8 years ago
    Aye, I'm surprised he's not drowning underneath the amount of questions & bug reports we all keep posting. razz

    I think it's something to do with Immanuel Kant and "Ordnung muss sein".

    Newbie

    42 Posts

  • #6, by afrlmeTuesday, 25. April 2017, 16:48 8 years ago
    Aye, I'm surprised he's not drowning underneath the amount of questions & bug reports we all keep posting. razz

    I think it's something to do with Immanuel Kant and "Ordnung muss sein".

    I had to look up both the name & translate the German quote you wrote on account of not being German. I vaguely recognized the last name, but no idea from where. Maybe I've heard it on a TV/movie or mentioned in some book I've read or something...

    Imperator

    7285 Posts

  • #7, by stroncisTuesday, 25. April 2017, 17:18 8 years ago
    Aye, I'm surprised he's not drowning underneath the amount of questions & bug reports we all keep posting. razz

    I think it's something to do with Immanuel Kant and "Ordnung muss sein".

    I had to look up both the name & translate the German quote you wrote on account of not being German. I vaguely recognized the last name, but no idea from where. Maybe I've heard it on a TV/movie or mentioned in some book I've read or something...

    Ah, ok. Immanuel Kant is known not just as philosopher, but also for his punctuality (stories like "his neighboors set their clocks by Kant"). Germans are known for these traits - punctuality and order. So, my point being, that SimonS copes with such amount of bugs and questions thanks to that.

    Newbie

    42 Posts

  • #8, by afrlmeTuesday, 25. April 2017, 17:35 8 years ago
    haha... I think it's probably just a ton of coffee & not much sleep! grin

    Imperator

    7285 Posts

  • #9, by SimonSWednesday, 26. April 2017, 22:38 8 years ago
    Well I don't drink so much coffee. It's basically just order, I have tons of lists and I prioritize them.

    You can find some starting info for shaders here: http://www.visionaire-studio.com/luadocs/#shaders

    Thread Captain

    1582 Posts

  • #10, by afrlmeThursday, 27. April 2017, 02:32 8 years ago
    Well I don't drink so much coffee. It's basically just order, I have tons of lists and I prioritize them.

    You can find some starting info for shaders here: http://www.visionaire-studio.com/luadocs/#shaders
    Thanks for taking the elusive mystery out of it mate! You shall henceforth no longer be known as Simon the Sorcerer! :shakeshark:

    Imperator

    7285 Posts

  • #11, by stroncisThursday, 27. April 2017, 11:11 8 years ago
    You can find some starting info for shaders here: http://www.visionaire-studio.com/luadocs/#shaders

    Thank You! And this is very good resource, i must say.

    P.S.: and maybe someone will find useful reference for GLSL to HLSL https://docs.microsoft.com/en-us/windows/uwp/gaming/glsl-to-...

    Newbie

    42 Posts