Skip to content

Commit

Permalink
Handle linear colour space + Unity EULA compatilble third party licen…
Browse files Browse the repository at this point in the history
…se notice (#155)

* Unity EULA-compatible third party notices
* Handle linear colour space
* Perform gamma correction in TF palette shader, since Graphics.DrawTexture doesn't.
  • Loading branch information
mlavik1 authored Jan 26, 2023
1 parent 02dadc6 commit 23bf255
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 43 deletions.
40 changes: 0 additions & 40 deletions ACKNOWLEDGEMENTS.txt

This file was deleted.

2 changes: 1 addition & 1 deletion Assets/Scripts/TransferFunction/TransferFunction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void GenerateTexture()

for (int iY = 0; iY < TEXTURE_HEIGHT; iY++)
{
tfCols[iX + iY * TEXTURE_WIDTH] = pixCol;
tfCols[iX + iY * TEXTURE_WIDTH] = QualitySettings.activeColorSpace == ColorSpace.Linear ? pixCol.linear : pixCol;
}
}

Expand Down
4 changes: 4 additions & 0 deletions Assets/Shaders/TransferFunctionPaletteShader.shader
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
{
float4 col = tex2D(_TFTex, float2(i.uv.x, 0.0f));
col.a = 1.0f;
#if !UNITY_COLORSPACE_GAMMA
#define INVERSA_GAMMA 0.4545454
col.rgb = pow(col.rgb, float3(INVERSA_GAMMA, INVERSA_GAMMA, INVERSA_GAMMA));
#endif

return col;
}
Expand Down
31 changes: 31 additions & 0 deletions Third-Party Notices.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
A. openDICOM.net
LGPL Version 2.1.
Copyright (C) 2006-2007 Albert Gnandt
See full LGPL license in subfolder: Assets/3rdparty/openDicom/LGPL

B: VisMale.raw (Visible Human Project)
UNNAMED LICENSE.
Courtesy of the U.S. National Library of Medicine
Disclaimer: This version of the Visible Human Dataset does not reflect the most current/accurate data available from NLM.
See full license in subfolder DataFiles/VisMale-license.txt

C. SimpleITK
Apache License 2.0
Copyright 2010-2019 Insight Software Consortium
Copyright 2020 NumFOCUS
This library is automatically downloaded when requested by user.
See full license in subfolder: Assets/3rdparty/SimpleITK-[VERSION]/LICENSE

D. nifti.NET
MIT License.
Copyright (c) 2019 Patrick Prendergast
See full license in subfolder: Assets/3rdparty/Nifti.NET/LICENSE
(Note: a modified version of nifti.NET is included in this repository)

E. CUDA Cubic B-Spline Interpolation shader.
Released under a revised BSD style license.
Copyright (c) 2008-2009, Danny Ruijters. All rights reserved.
http://www.dannyruijters.nl/cubicinterpolation/
This file is part of CUDA Cubic B-Spline Interpolation (CI).

See full license i Assets/Shaders/TricubicSampling.cginc
10 changes: 8 additions & 2 deletions scripts/ExportUnityPackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,15 @@ def copy_filedir(src, dst):
os.system("pandoc README.md -o MANUAL.pdf")

if assetstore_package:
assets = ["Assets", "DataFiles", "ACKNOWLEDGEMENTS.txt", "MANUAL.pdf"]
with open('Third-Party Notices.txt', 'r') as original:
third_party_contents = original.read()
with open('Third-Party Notices.txt', 'w') as modified:
modified.write("This asset is governed by the Asset Store EULA; however, the following components are governed by the licenses indicated below:\n" + third_party_contents)

if assetstore_package:
assets = ["Assets", "DataFiles", "Third-Party Notices.txt", "MANUAL.pdf"]
else:
assets = ["Assets", "DataFiles", "ACKNOWLEDGEMENTS.txt", "CREDITS.md", "LICENSE", "README.md"]
assets = ["Assets", "DataFiles", "Third-Party Notices.txt", "CREDITS.md", "LICENSE", "README.md"]

for asset in assets:
dest_asset = os.path.join(export_project_path, "Assets", plugin_folder_name, asset)
Expand Down

0 comments on commit 23bf255

Please sign in to comment.