Having two LUTs and switching using Toggle Keys?

  • F D B
  • Topic Author
More
7 years 2 months ago - 7 years 2 months ago #1 by F D B Having two LUTs and switching using Toggle Keys? was created by F D B
Hello -

I only have ONE question:

1-Is there any way (or could you make it happen) to be able to load 2 luts and be able to switch from one to the other by assigning toggle keys? I don't mean to have both of them working together at the same time. Just to be able to switch from one to the other by using toggle keys. For example have one LUT for DAY-TIME and then press a key to switch to the other LUT when night comes.

If that's not possible right now. Please could you at least consider the option to add something like a "+" button so one can load as many LUT files as we want (or at least 2 or 3) and then assign toggle keys?

Thanks
Last edit: 7 years 2 months ago by F D B.

Please Log in or Create an account to join the conversation.

  • FierySwordswoman
More
7 years 2 months ago #2 by FierySwordswoman Replied by FierySwordswoman on topic Having two LUTs and switching using Toggle Keys?
This is all hypothetical, but...
You might be able to duplicate the LUT.fx file and change the file's "fLUT_TextureName" variable (and all occurrences of it) to something like "fLUT_TextureName2". You'll also have to change the technique at the bottom of the file from "LUT" to something like "LUT2".
Then, in add to the preprocessor definitions
fLUT_TextureName="your_lut_1.png"
fLUT_TextureName2="your_lut_2.png"
Finally, bind the your key to toggle both LUT and LUT2 in the shader menu at the same time, then enable one and disable the other. This creates the 'switch toggle' you're looking for. I have used this 'switch toggle' method before to compare shaders and it does indeed work.

Please Log in or Create an account to join the conversation.

  • F D B
  • Topic Author
More
7 years 2 months ago #3 by F D B Replied by F D B on topic Having two LUTs and switching using Toggle Keys?
Well... I do like your hypothesis! :D

Although I'm kinda confused as to where to do each part.
-Where do I change/duplicate LUT.fx?
-I know where to change "fLUT_TextureName" but you lost me when you said "and all occurences of it". Could you elaborate?
-And where to change the technique at the bottom of the file from "LUT" to "LUT2"? Is it in the Shaders folder, "LUT" file?

And last but not least... I didn't understand the last part about toggle keys. So, basically I did't understand what to do at all, LOL.
I wil try to have a look soon and mess around to see if I can answer my own questions but, if you could help me, I'd be so grateful.

Anyways, thank so much for your answer thus far.

Please Log in or Create an account to join the conversation.

  • FierySwordswoman
More
7 years 2 months ago - 7 years 2 months ago #4 by FierySwordswoman Replied by FierySwordswoman on topic Having two LUTs and switching using Toggle Keys?
I'll make it easy on you.
mega.nz/#!Wtk2BASb!ejBhL7DhhrDdzDTLrbuaULYmImajFg0-saEdHEh8eFE
There's the LUT2.fx file. Put it in your 'shaders' folder.

You're first lut is probably named "lut.png", correct? Name your second one "lut2.png" and put it in the same folder as your first one.

Finally, the switch-toggle. Just make it look like this:
Image URL.
In this photo, "Insert" is my toggle-key to switch between the effects. Notice that LUT.fx is 'on' and LUT2.fx is 'off'. Pressing the 'Insert' key in this case will turn LUT.fx 'off', and LUT2.fx 'on', and vice versa with subsequent presses.


"All occurrences of it" in regards to coding is for a named variable/function/class/etc. Things like that are written once to define them, then written again when their information is needed. So, if you only change the name of one occurrence of said name, you'll break lots of things.
Take this Python code:
var1 = 1
var2 = 0
result = [1]

for X in range(10):
    newNumber = var1+var2
    result.append(newNumber)
    var2 = var1
    var1 = newNumber

print(result)
There are 4 variables: "var1", "var2", "result", and "newNumber".
If you were to change the variable "result" on line 3 to "fibonacci", when the script tries to call "result" again on line 7 an error will occur because "result" no longer exists. This is why when you change the name of a variable, you have to change every occurrence of it in the entire script as well.
Last edit: 7 years 2 months ago by FierySwordswoman.
The following user(s) said Thank You: Ryukou36

Please Log in or Create an account to join the conversation.

  • F D B
  • Topic Author
More
7 years 2 months ago #5 by F D B Replied by F D B on topic Having two LUTs and switching using Toggle Keys?
WOAH!
That's amazing!

So, I just have to download that file, place it in the Shaders folder. Then have my second LUT named lut2.png and finally set the same toggle key for both of them? That's it? Tell me if I'm missing something.

You're great man. Honestly. THANK YOU!

Please Log in or Create an account to join the conversation.

  • FierySwordswoman
More
7 years 2 months ago #6 by FierySwordswoman Replied by FierySwordswoman on topic Having two LUTs and switching using Toggle Keys?
No, that should be it. I tried it myself to make sure it worked.
Since I don't know HLSL it took a bit of time to figure out how to stop the second lut file from reading the first's texture instead of its own, but after that it was pretty straightforward.

Note you won't be able to add a third unless you wish to bind each lut to a separate key since toggling only has two states: 'on' and 'off'.

Please Log in or Create an account to join the conversation.

  • F D B
  • Topic Author
More
7 years 2 months ago #7 by F D B Replied by F D B on topic Having two LUTs and switching using Toggle Keys?
It worked like a Swiss watch man. I can't thank you enough. Much appreciated.

Please Log in or Create an account to join the conversation.

We use cookies
We use cookies on our website. Some of them are essential for the operation of the forum. You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.