Welcome, Guest.
Username: Password: Remember me

TOPIC: Having two LUTs and switching using Toggle Keys?

Having two LUTs and switching using Toggle Keys? 1 year 10 months ago #1

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: 1 year 10 months ago by F D B.
The administrator has disabled public write access.

Having two LUTs and switching using Toggle Keys? 1 year 10 months ago #2

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.
The administrator has disabled public write access.

Having two LUTs and switching using Toggle Keys? 1 year 10 months ago #3

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.
The administrator has disabled public write access.

Having two LUTs and switching using Toggle Keys? 1 year 10 months ago #4

I'll make it easy on you.
https://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: 1 year 10 months ago by FierySwordswoman.
The administrator has disabled public write access.
The following user(s) said Thank You: Ryukou36

Having two LUTs and switching using Toggle Keys? 1 year 10 months ago #5

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!
The administrator has disabled public write access.

Having two LUTs and switching using Toggle Keys? 1 year 10 months ago #6

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'.
The administrator has disabled public write access.

Having two LUTs and switching using Toggle Keys? 1 year 10 months ago #7

It worked like a Swiss watch man. I can't thank you enough. Much appreciated.
The administrator has disabled public write access.