Created
April 18, 2020 05:01
-
-
Save rkandas/e288637375bf5c867780043ab67777d4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Reflection; | |
using UnityEditor.ShaderGraph; | |
[Title("Custom", "Gamma Correction Node")] | |
public class GammaCorrectionNode : CodeFunctionNode | |
{ | |
public GammaCorrectionNode() | |
{ | |
name = "Gamma Correction"; | |
} | |
protected override MethodInfo GetFunctionToConvert() | |
{ | |
return GetType().GetMethod("GammaCorrectionFunction", | |
BindingFlags.Static | BindingFlags.NonPublic); | |
} | |
static string GammaCorrectionFunction([Slot(0, Binding.None)] DynamicDimensionVector A, | |
[Slot(1, Binding.None)] Vector1 gamma, | |
[Slot(2, Binding.None)] out DynamicDimensionVector Out) | |
{ | |
return @" { | |
Out = pow(A,(1.0 / gamma)); | |
}"; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment