initial commit
commit
69ee506c08
@ -0,0 +1,6 @@
|
|||||||
|
*.psd filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.psb filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gif filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.afdesign filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.blend filter=lfs diff=lfs merge=lfs -text
|
@ -0,0 +1,11 @@
|
|||||||
|
**/AO/*
|
||||||
|
**/UV/*
|
||||||
|
**/Bakes/*
|
||||||
|
|
||||||
|
*.meta
|
||||||
|
*.mat
|
||||||
|
|
||||||
|
*.swp
|
||||||
|
|
||||||
|
Textures/Coupling/blank-n.psd
|
||||||
|
Textures/Coupling/blank.psd
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,134 @@
|
|||||||
|
using System;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
public class KSPTextureTools : AssetPostprocessor
|
||||||
|
{
|
||||||
|
// what file type to allow
|
||||||
|
private const string EXTENSION = ".png";
|
||||||
|
|
||||||
|
|
||||||
|
/* SPECULAR */
|
||||||
|
// enable specular map copying
|
||||||
|
private const bool SPEC_ENABLE = true;
|
||||||
|
|
||||||
|
// what the file name should end with for specular maps
|
||||||
|
private const string SPEC_TAG = "-spec";
|
||||||
|
|
||||||
|
|
||||||
|
/* NORMALS */
|
||||||
|
// enable normal map processing
|
||||||
|
private const bool NORMAL_ENABLE = true;
|
||||||
|
|
||||||
|
// what the file name should end with for normal maps
|
||||||
|
private const string NORMAL_TAG = "-n";
|
||||||
|
|
||||||
|
// enable normal map generation from heightmaps
|
||||||
|
private const bool NORMAL_GENERATE = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private Texture2D _otherTexture = null;
|
||||||
|
private bool _isSpecular = false;
|
||||||
|
private bool _hasSpecular = false;
|
||||||
|
|
||||||
|
void OnPreprocessTexture()
|
||||||
|
{
|
||||||
|
var importer = (TextureImporter) assetImporter;
|
||||||
|
importer.textureCompression = TextureImporterCompression.Uncompressed;
|
||||||
|
importer.isReadable = true;
|
||||||
|
|
||||||
|
var extension = Path.GetExtension(assetPath);
|
||||||
|
if (extension != EXTENSION) return;
|
||||||
|
|
||||||
|
var basename = Path.GetFileNameWithoutExtension(assetPath);
|
||||||
|
var directory = Path.GetDirectoryName(assetPath);
|
||||||
|
|
||||||
|
if (NORMAL_ENABLE)
|
||||||
|
{
|
||||||
|
if (basename.EndsWith(NORMAL_TAG))
|
||||||
|
{
|
||||||
|
importer.textureType = TextureImporterType.NormalMap;
|
||||||
|
if (NORMAL_GENERATE) importer.convertToNormalmap = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SPEC_ENABLE) {
|
||||||
|
if (basename.EndsWith(SPEC_TAG))
|
||||||
|
{
|
||||||
|
var othername = basename.Replace(SPEC_TAG, "");
|
||||||
|
var otherpath = directory + "/" + othername + extension;
|
||||||
|
_otherTexture = (Texture2D) AssetDatabase.LoadAssetAtPath<Texture2D>(otherpath);
|
||||||
|
if (_otherTexture == null)
|
||||||
|
{
|
||||||
|
LogError("Diffuse file " + otherpath + " not found. Aborting");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_isSpecular = true;
|
||||||
|
_hasSpecular = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var othername = basename + SPEC_TAG;
|
||||||
|
var otherpath = directory + "/" + othername + extension;
|
||||||
|
_otherTexture = (Texture2D) AssetDatabase.LoadAssetAtPath<Texture2D>(otherpath);
|
||||||
|
if (_otherTexture == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_hasSpecular = true;
|
||||||
|
importer.alphaSource = TextureImporterAlphaSource.FromGrayScale;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnPostprocessTexture(Texture2D texture)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (_isSpecular)
|
||||||
|
{
|
||||||
|
CopyAlphaChannel(texture, _otherTexture);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_hasSpecular)
|
||||||
|
{
|
||||||
|
CopyAlphaChannel(_otherTexture, texture);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CopyAlphaChannel(Texture2D source, Texture2D target)
|
||||||
|
{
|
||||||
|
var width = source.width;
|
||||||
|
var height = source.height;
|
||||||
|
var depth = source.mipmapCount;
|
||||||
|
|
||||||
|
if (width != target.width || height != target.height)
|
||||||
|
{
|
||||||
|
LogError("Specular and Diffuse texture sizes to not match in texture " + assetPath);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int level = 0; level < depth; level++)
|
||||||
|
{
|
||||||
|
var sourcePixels = source.GetPixels32(level);
|
||||||
|
var targetPixels = target.GetPixels32(level);
|
||||||
|
|
||||||
|
var length = sourcePixels.Length;
|
||||||
|
|
||||||
|
for (var i = 0; i < length; i++)
|
||||||
|
{
|
||||||
|
targetPixels[i].a = sourcePixels[i].r;
|
||||||
|
}
|
||||||
|
|
||||||
|
target.SetPixels32(targetPixels, level);
|
||||||
|
}
|
||||||
|
|
||||||
|
target.Apply();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
# ReStocked-Assets
|
||||||
|
My own Assets made for [ReStock](https://github.com/PorktoberRevolution/ReStocked). Please report any issues there. Models are made in Blender and textures are made with Photoshop CC and Affinity Designer. All files are licensed CC-BY-SA 4.0.
|
||||||
|
|
||||||
|
#### Naming Convention:
|
||||||
|
textures are named with the filename they will appear as in the final distributed version of the mod, with the exception of some specular maps which are copied into the alpha channel of the diffuse textures. For example:
|
||||||
|
* `restock-sciencebox-1`: Diffuse map
|
||||||
|
* `restock-sciencebox-1-s`: Specular map, copied into alpha channel of Albedo map except when the Specular (Mapped) shader is used
|
||||||
|
* `restock-sciencebox-1-spec`: Specular map, but gets automatically copied into the alpha channel on import into unity (used with Affinity Designer workflow)
|
||||||
|
* `restock-sciencebox-1-n`: Normal map, makes use of Smart Objects for the heightmap embedded within
|
||||||
|
* `restock-sciencebox-1-e`: Emissive map
|
||||||
|
|
||||||
|
#### Other Work
|
||||||
|
* Uses [High voltage warning.svg](https://commons.wikimedia.org/wiki/File:High_voltage_warning.svg) by various wikipedia contributors, licensed under the [Creative Commons Attribution-Share Alike license](https://creativecommons.org/licenses/by-sa/2.5/deed.en). It has been modified when embedding into textures for pixel-accuracy
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue