5 namespace UnityStandardAssets.ImageEffects
7 [CustomEditor (typeof(Tonemapping))]
10 SerializedObject serObj;
12 SerializedProperty type;
15 SerializedProperty remapCurve;
17 SerializedProperty exposureAdjustment;
20 SerializedProperty middleGrey;
21 SerializedProperty white;
22 SerializedProperty adaptionSpeed;
23 SerializedProperty adaptiveTextureSize;
26 serObj =
new SerializedObject (target);
28 type = serObj.FindProperty (
"type");
29 remapCurve = serObj.FindProperty (
"remapCurve");
30 exposureAdjustment = serObj.FindProperty (
"exposureAdjustment");
31 middleGrey = serObj.FindProperty (
"middleGrey");
32 white = serObj.FindProperty (
"white");
33 adaptionSpeed = serObj.FindProperty (
"adaptionSpeed");
34 adaptiveTextureSize = serObj.FindProperty(
"adaptiveTextureSize");
38 public override void OnInspectorGUI () {
41 GUILayout.Label(
"Mapping HDR to LDR ranges since 1982", EditorStyles.miniLabel);
43 Camera cam = (target as
Tonemapping).GetComponent<Camera>();
46 EditorGUILayout.HelpBox(
"The camera is not HDR enabled. This will likely break the Tonemapper.", MessageType.Warning);
48 else if (!(target as
Tonemapping).validRenderTextureFormat) {
49 EditorGUILayout.HelpBox(
"The input to Tonemapper is not in HDR. Make sure that all effects prior to this are executed in HDR.", MessageType.Warning);
53 EditorGUILayout.PropertyField (type,
new GUIContent (
"Technique"));
55 if (type.enumValueIndex == (
int) Tonemapping.TonemapperType.UserCurve) {
56 EditorGUILayout.PropertyField (remapCurve,
new GUIContent (
"Remap curve",
"Specify the mapping of luminances yourself"));
57 }
else if (type.enumValueIndex == (
int) Tonemapping.TonemapperType.SimpleReinhard) {
58 EditorGUILayout.PropertyField (exposureAdjustment,
new GUIContent (
"Exposure",
"Exposure adjustment"));
59 }
else if (type.enumValueIndex == (
int) Tonemapping.TonemapperType.Hable) {
60 EditorGUILayout.PropertyField (exposureAdjustment,
new GUIContent (
"Exposure",
"Exposure adjustment"));
61 }
else if (type.enumValueIndex == (
int) Tonemapping.TonemapperType.Photographic) {
62 EditorGUILayout.PropertyField (exposureAdjustment,
new GUIContent (
"Exposure",
"Exposure adjustment"));
63 }
else if (type.enumValueIndex == (
int) Tonemapping.TonemapperType.OptimizedHejiDawson) {
64 EditorGUILayout.PropertyField (exposureAdjustment,
new GUIContent (
"Exposure",
"Exposure adjustment"));
65 }
else if (type.enumValueIndex == (
int) Tonemapping.TonemapperType.AdaptiveReinhard) {
66 EditorGUILayout.PropertyField (middleGrey,
new GUIContent (
"Middle grey",
"Middle grey defines the average luminance thus brightening or darkening the entire image."));
67 EditorGUILayout.PropertyField (white,
new GUIContent (
"White",
"Smallest luminance value that will be mapped to white"));
68 EditorGUILayout.PropertyField (adaptionSpeed,
new GUIContent (
"Adaption Speed",
"Speed modifier for the automatic adaption"));
69 EditorGUILayout.PropertyField (adaptiveTextureSize,
new GUIContent (
"Texture size",
"Defines the amount of downsamples needed."));
70 }
else if (type.enumValueIndex == (
int) Tonemapping.TonemapperType.AdaptiveReinhardAutoWhite) {
71 EditorGUILayout.PropertyField (middleGrey,
new GUIContent (
"Middle grey",
"Middle grey defines the average luminance thus brightening or darkening the entire image."));
72 EditorGUILayout.PropertyField (adaptionSpeed,
new GUIContent (
"Adaption Speed",
"Speed modifier for the automatic adaption"));
73 EditorGUILayout.PropertyField (adaptiveTextureSize,
new GUIContent (
"Texture size",
"Defines the amount of downsamples needed."));
76 GUILayout.Label(
"All following effects will use LDR color buffers", EditorStyles.miniBoldLabel);
78 serObj.ApplyModifiedProperties();