import pmx plugin

This commit is contained in:
CroakFang
2023-06-30 14:08:40 +08:00
parent c3d4e6b111
commit 33943e4205
203 changed files with 11810 additions and 0 deletions
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 hobosore
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 35aeaadcbad6b854a802ff3599f97f74
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: aa28e550e06110d46a2730835d37116e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: eda5c0d55dec76c489bd59a4e8998ada
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,26 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public static class Texture2DExtension
{
public static Texture2D CreateReadabeTexture2D(this Texture2D texture2d)
{
RenderTexture renderTexture = RenderTexture.GetTemporary(
texture2d.width,
texture2d.height,
0,
RenderTextureFormat.Default,
RenderTextureReadWrite.Linear);
Graphics.Blit(texture2d, renderTexture);
RenderTexture previous = RenderTexture.active;
RenderTexture.active = renderTexture;
Texture2D readableTextur2D = new Texture2D(texture2d.width, texture2d.height);
readableTextur2D.ReadPixels(new Rect(0, 0, renderTexture.width, renderTexture.height), 0, 0);
readableTextur2D.Apply();
RenderTexture.active = previous;
RenderTexture.ReleaseTemporary(renderTexture);
return readableTextur2D;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3b8cc2a385b1d5c4fb754bc89a35af77
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 99947f5bd2591ae4085f2494567a6621
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,41 @@
using UnityEngine;
namespace LibMMD.Material
{
public class MMDMaterial
{
public enum SubTextureTypeEnum : byte
{
MatSubTexOff = 0,
MatSubTexSph = 1,
MatSubTexSpa = 2,
MatSubTexSub = 3
}
public string Name { get; set; }
public string NameEn { get; set; }
public Color DiffuseColor { get; set; }
public Color SpecularColor { get; set; }
public Color AmbientColor { get; set; }
public float Shiness { get; set; }
public bool DrawDoubleFace { get; set; }
public bool DrawGroundShadow { get; set; }
public bool CastSelfShadow { get; set; }
public bool DrawSelfShadow { get; set; }
public bool DrawEdge { get; set; }
public Color EdgeColor { get; set; }
public float EdgeSize { get; set; }
public MMDTexture Toon { get; set; }
public MMDTexture Texture { get; set; }
public MMDTexture SubTexture { get; set; }
public SubTextureTypeEnum SubTextureType { get; set; }
public string MetaInfo { get; set; }
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 439296348e1847745b21029b3e124fb3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,35 @@
namespace LibMMD.Material
{
public class MMDTexture
{
public string TexturePath { get; set; }
public MMDTexture(string texturePath)
{
TexturePath = texturePath;
}
protected bool Equals(MMDTexture other)
{
return string.Equals(TexturePath, other.TexturePath);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return Equals((MMDTexture) obj);
}
public override int GetHashCode()
{
return TexturePath != null ? TexturePath.GetHashCode() : 0;
}
private MMDTexture()
{
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 748fb3d767b3fb84faabacb9d3899280
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e8dd6dee04f840d43985c9bddcdbf3e1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,160 @@
using System;
using System.Collections.Generic;
using UnityEngine;
namespace LibMMD.Model
{
public class Bone
{
public class IkLink
{
public int LinkIndex { get; set; }
public bool HasLimit { get; set; }
public Vector3 LoLimit { get; set; }
public Vector3 HiLimit { get; set; }
public static IkLink CopyOf(IkLink ikLink)
{
return new IkLink
{
LinkIndex = ikLink.LinkIndex,
HasLimit = ikLink.HasLimit,
LoLimit = ikLink.LoLimit,
HiLimit = ikLink.HiLimit
};
}
}
public class ChildBone
{
public bool ChildUseId { get; set; }
public Vector3 Offset { get; set; }
public int Index { get; set; }
public static ChildBone CopyOf(ChildBone childBone)
{
return new ChildBone
{
ChildUseId = childBone.ChildUseId,
Offset = childBone.Offset,
Index = childBone.Index
};
}
}
public class AppendBone
{
public int Index { get; set; }
public float Ratio { get; set; }
public static AppendBone CopyOf(AppendBone appendBone)
{
return new AppendBone
{
Index = appendBone.Index,
Ratio = appendBone.Ratio
};
}
}
public class IkInfo
{
public int IkTargetIndex { get; set; }
public int CcdIterateLimit { get; set; }
public float CcdAngleLimit { get; set; }
public IkLink[] IkLinks { get; set; }
public static IkInfo CopyOf(IkInfo ikInfo)
{
var ikLinksCopy = new IkLink[ikInfo.IkLinks.Length];
ikInfo.IkLinks.CopyTo(ikLinksCopy, 0);
return new IkInfo
{
IkTargetIndex = ikInfo.IkTargetIndex,
CcdIterateLimit = ikInfo.CcdIterateLimit,
CcdAngleLimit = ikInfo.CcdAngleLimit,
IkLinks = ikLinksCopy
};
}
}
public class LocalAxis
{
public Vector3 AxisX { get; set; }
public Vector3 AxisY { get; set; }
public Vector3 AxisZ { get; set; }
public static LocalAxis CopyOf(LocalAxis localAxis)
{
return new LocalAxis
{
AxisX = localAxis.AxisX,
AxisY = localAxis.AxisY,
AxisZ = localAxis.AxisZ
};
}
}
public Bone()
{
ChildBoneVal = new ChildBone();
AppendBoneVal = new AppendBone();
LocalAxisVal = new LocalAxis();
}
public string Name { get; set; }
public string NameEn { get; set; }
public Vector3 Position { get; set; }
public int ParentIndex { get; set; }
public int TransformLevel { get; set; }
public bool Rotatable { get; set; }
public bool Movable { get; set; }
public bool Visible { get; set; }
public bool Controllable { get; set; }
public bool HasIk { get; set; }
public bool AppendRotate { get; set; }
public bool AppendTranslate { get; set; }
public bool RotAxisFixed { get; set; }
public bool UseLocalAxis { get; set; }
public bool PostPhysics { get; set; }
public bool ReceiveTransform { get; set; }
public ChildBone ChildBoneVal { get; set; }
public AppendBone AppendBoneVal { get; set; }
public Vector3 RotAxis { get; set; }
public LocalAxis LocalAxisVal { get; set; }
public int ExportKey { get; set; }
public IkInfo IkInfoVal { get; set; }
public static Bone CopyOf(Bone bone)
{
return new Bone
{
Name = bone.Name,
NameEn = bone.NameEn,
Position = bone.Position,
ParentIndex = bone.ParentIndex,
TransformLevel = bone.TransformLevel,
Rotatable = bone.Rotatable,
Movable = bone.Movable,
Visible = bone.Visible,
Controllable = bone.Controllable,
HasIk = bone.HasIk,
AppendRotate = bone.AppendRotate,
AppendTranslate = bone.AppendTranslate,
RotAxisFixed = bone.RotAxisFixed,
UseLocalAxis = bone.UseLocalAxis,
PostPhysics = bone.PostPhysics,
ReceiveTransform = bone.ReceiveTransform,
ChildBoneVal = ChildBone.CopyOf(bone.ChildBoneVal),
AppendBoneVal = AppendBone.CopyOf(bone.AppendBoneVal),
RotAxis = bone.RotAxis,
LocalAxisVal = LocalAxis.CopyOf(bone.LocalAxisVal),
ExportKey = bone.ExportKey,
IkInfoVal = IkInfo.CopyOf(bone.IkInfoVal),
};
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0cd3fbcfbcc9edc4a8ba7660a838d4dc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,24 @@
using UnityEngine;
namespace LibMMD.Model
{
public class Joint
{
public Joint()
{
AssociatedRigidBodyIndex = new int[2];
}
public string Name { get; set; }
public string NameEn { get; set; }
public int[] AssociatedRigidBodyIndex { get; set; }
public Vector3 Position { get; set; }
public Vector3 Rotation { get; set; }
public Vector3 PositionLowLimit { get; set; }
public Vector3 PositionHiLimit { get; set; }
public Vector3 RotationLowLimit { get; set; }
public Vector3 RotationHiLimit { get; set; }
public Vector3 SpringTranslate { get; set; }
public Vector3 SpringRotate { get; set; }
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 10f6db9a9b776f341bfd7b5aabda88ae
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,38 @@
using UnityEngine;
namespace LibMMD.Model
{
public class MMDRigidBody
{
public enum RigidBodyShape : byte
{
RigidShapeSphere = 0x00,
RigidShapeBox = 0x01,
RigidShapeCapsule = 0x02
}
public enum RigidBodyType : byte
{
RigidTypeKinematic = 0x00,
RigidTypePhysics = 0x01,
RigidTypePhysicsStrict = 0x02,
RigidTypePhysicsGhost = 0x03
}
public string Name { get; set; }
public string NameEn { get; set; }
public int AssociatedBoneIndex { get; set; }
public int CollisionGroup { get; set; }
public ushort CollisionMask { get; set; }
public RigidBodyShape Shape { get; set; }
public Vector3 Dimemsions { get; set; }
public Vector3 Position { get; set; }
public Vector3 Rotation { get; set; }
public float Mass { get; set; }
public float TranslateDamp { get; set; }
public float RotateDamp { get; set; }
public float Restitution { get; set; }
public float Friction { get; set; }
public RigidBodyType Type { get; set; }
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 395400370dc114b4bbe68e03a1c99a0c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,87 @@
using System.Collections.Generic;
using LibMMD.Util;
using UnityEngine;
namespace LibMMD.Model
{
public class Morph
{
public enum MorphCategory : byte
{
MorphCatSystem = 0x00,
MorphCatEyebrow = 0x01,
MorphCatEye = 0x02,
MorphCatMouth = 0x03,
MorphCatOther = 0x04
}
public enum MorphType : byte
{
MorphTypeGroup = 0x00,
MorphTypeVertex = 0x01,
MorphTypeBone = 0x02,
MorphTypeUv = 0x03,
MorphTypeExtUv1 = 0x04,
MorphTypeExtUv2 = 0x05,
MorphTypeExtUv3 = 0x06,
MorphTypeExtUv4 = 0x07,
MorphTypeMaterial = 0x08
}
public abstract class MorphData
{
}
public class GroupMorphData : MorphData
{
public int MorphIndex { get; set; }
public float MorphRate { get; set; }
}
public class VertexMorphData : MorphData
{
public int VertexIndex { get; set; }
public Vector3 Offset { get; set; }
}
public class BoneMorphData : MorphData
{
public int BoneIndex { get; set; }
public Vector3 Translation { get; set; }
public Quaternion Rotation { get; set; }
}
public class UvMorphData : MorphData
{
public int VertexIndex { get; set; }
public Vector4 Offset { get; set; }
}
public class MaterialMorphData : MorphData
{
public enum MaterialMorphMethod : byte {
MorphMatMul = 0x00,
MorphMatAdd = 0x01
}
public int MaterialIndex { get; set; }
public bool Global { get; set; }
public MaterialMorphMethod Method { get; set; }
public Color Diffuse { get; set; }
public Color Specular { get; set; }
public Color Ambient { get; set; }
public float Shiness { get; set; }
public Color EdgeColor { get; set; }
public float EdgeSize { get; set; }
public Vector4 Texture { get; set; }
public Vector4 SubTexture { get; set; }
public Vector4 ToonTexture { get; set; }
}
public string Name { get; set; }
public string NameEn { get; set; }
public MorphCategory Category { get; set; }
public MorphType Type { get; set; }
public MorphData[] MorphDatas { get; set; }
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f7f998f4d72211a4bbfa615fed8ceacb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,9 @@
namespace LibMMD.Model
{
public class Part
{
public Material.MMDMaterial Material { get; set; }
public int BaseShift { get; set; } //注意这个和libmmd里的含义不同,这里是三角形顶点数
public int TriangleIndexNum { get; set; }
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d0fb693cf5950c84499b613bb97a23eb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,83 @@
using System;
namespace LibMMD.Model
{
public class RawMMDModel
{
public string Name { get; set; }
public string NameEn { get; set; }
public string Description { get; set; }
public string DescriptionEn { get; set; }
public Vertex[] Vertices { get; set; }
public int ExtraUvNumber { get; set; }
public int[] TriangleIndexes { get; set; }
public Part[] Parts { get; set; }
public Bone[] Bones { get; set; }
public Morph[] Morphs { get; set; }
public MMDRigidBody[] Rigidbodies { get; set; }
public Joint[] Joints { get; set; }
public void Normalize()
{
foreach (var vertex in Vertices)
{
switch (vertex.SkinningOperator.Type)
{
case SkinningOperator.SkinningType.SkinningBdef2:
{
var oldBdef2 = (SkinningOperator.Bdef2) vertex.SkinningOperator.Param;
var weight = oldBdef2.BoneWeight;
if (Math.Abs(weight) < 0.000001f)
{
var bdef1 = new SkinningOperator.Bdef1 {BoneId = oldBdef2.BoneId[1]};
vertex.SkinningOperator.Param = bdef1;
vertex.SkinningOperator.Type = SkinningOperator.SkinningType.SkinningBdef1;
}
else if (Math.Abs(weight - 1.0f) < 0.00001f)
{
var bdef1 = new SkinningOperator.Bdef1 {BoneId = oldBdef2.BoneId[0]};
vertex.SkinningOperator.Param = bdef1;
vertex.SkinningOperator.Type = SkinningOperator.SkinningType.SkinningBdef1;
}
break;
}
case SkinningOperator.SkinningType.SkinningSdef:
{
var oldSdef = (SkinningOperator.Sdef) vertex.SkinningOperator.Param;
var bone0 = oldSdef.BoneId[0];
var bone1 = oldSdef.BoneId[1];
var weight = oldSdef.BoneWeight;
if (
Bones[bone0].ParentIndex != bone1 &&
Bones[bone1].ParentIndex != bone0
)
{
if (Math.Abs(weight) < 0.000001f)
{
var bdef1 = new SkinningOperator.Bdef1 {BoneId = bone1};
vertex.SkinningOperator.Param = bdef1;
vertex.SkinningOperator.Type = SkinningOperator.SkinningType.SkinningBdef1;
}
else if (Math.Abs(weight - 1.0f) < 0.00001f)
{
var bdef1 = new SkinningOperator.Bdef1 {BoneId = bone0};
vertex.SkinningOperator.Param = bdef1;
vertex.SkinningOperator.Type = SkinningOperator.SkinningType.SkinningBdef1;
}
else
{
var bdef2 = new SkinningOperator.Bdef2();
bdef2.BoneId[0] = bone0;
bdef2.BoneId[1] = bone1;
bdef2.BoneWeight = weight;
vertex.SkinningOperator.Param = bdef2;
vertex.SkinningOperator.Type = SkinningOperator.SkinningType.SkinningBdef2;
}
}
break;
}
}
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 05367ea617bee1747a4786e33ec02123
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,64 @@
using UnityEngine;
namespace LibMMD.Model
{
public class SkinningOperator
{
public enum SkinningType : byte
{
SkinningBdef1 = 0,
SkinningBdef2 = 1,
SkinningBdef4 = 2,
SkinningSdef = 3
}
public abstract class SkinningParam
{
}
public class Bdef1 : SkinningParam
{
public int BoneId { get; set; }
}
public class Bdef2 : SkinningParam
{
public Bdef2()
{
BoneId = new int[2];
}
public int[] BoneId { get; set; }
public float BoneWeight { get; set; }
}
public class Bdef4 : SkinningParam
{
public Bdef4()
{
BoneId = new int[4];
BoneWeight = new float[4];
}
public int[] BoneId { get; set; }
public float[] BoneWeight { get; set; }
}
public class Sdef : SkinningParam
{
public Sdef()
{
BoneId = new int[2];
}
public int[] BoneId { get; set; }
public float BoneWeight { get; set; }
public Vector3 C { get; set; }
public Vector3 R0 { get; set; }
public Vector3 R1 { get; set; }
}
public SkinningType Type { get; set; }
public SkinningParam Param { get; set; }
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fcf11bb8f382aff4d8e67cd1d879439e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,14 @@
using UnityEngine;
namespace LibMMD.Model
{
public class Vertex
{
public Vector3 Coordinate { get; set; }
public Vector3 Normal { get; set; }
public Vector2 UvCoordinate { get; set; }
public Vector4[] ExtraUvCoordinate { get; set; }
public SkinningOperator SkinningOperator { get; set; }
public float EdgeScale { get; set; }
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a8dee8727f3427b4eab957bef13ea4b6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 880762e0e6c9b294894eb766068a3dad
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,32 @@
using System;
namespace LibMMD.Unity3D
{
public class ByteArrayReader
{
public static int ReadInt(byte[] data, ref int offset) {
var ret = BitConverter.ToInt32(data, offset);
offset += 4;
return ret;
}
public static uint ReadUInt(byte[] data, ref int offset) {
var ret = BitConverter.ToUInt32(data, offset);
offset += 4;
return ret;
}
public static short ReadShort(byte[] data, ref int offset) {
var ret = BitConverter.ToInt16(data, offset);
offset += 2;
return ret;
}
public static ushort ReadUShort(byte[] data, ref int offset) {
var ret = BitConverter.ToUInt16(data, offset);
offset += 2;
return ret;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 644ea355b01ce9e4a9bc31a2e4b08131
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,11 @@
using System;
namespace LibMMD.Reader
{
public class MMDFileParseException : Exception
{
public MMDFileParseException(string message) : base(message)
{
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7ca57088506381e4bb6d98196ff14be2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,7 @@
namespace LibMMD.Reader
{
public class ModelReadConfig
{
public string GlobalToonPath { get; set; }
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: beb1a7fbb7deca44c9cf8f9f4b0c2b10
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,39 @@
using System.IO;
using LibMMD.Model;
namespace LibMMD.Reader
{
public abstract class ModelReader
{
public RawMMDModel Read(string path, ModelReadConfig config)
{
using (var fileStream = new FileStream(path, FileMode.Open))
{
using (var bufferedStream = new BufferedStream(fileStream)) {
using (var binaryReader = new BinaryReader(bufferedStream))
{
return Read(binaryReader, config);
}
}
}
}
public abstract RawMMDModel Read(BinaryReader reader, ModelReadConfig config);
public static RawMMDModel LoadMmdModel(string path, ModelReadConfig config)
{
var fileExt = new FileInfo(path).Extension.ToLower();
if (".pmd".Equals(fileExt))
{
return new PMDReader().Read(path, config);
}
if (".pmx".Equals(fileExt))
{
return new PMXReader().Read(path, config);
}
throw new MMDFileParseException("File " + path +
" is not a MMD model file. File name should ends with \"pmd\" or \"pmx\".");
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c21137d135f1bba43b2de5ae8f7d0f45
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,730 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using LibMMD.Material;
using LibMMD.Model;
using LibMMD.Util;
using UnityEngine;
namespace LibMMD.Reader
{
public class PMDReader : ModelReader
{
public override RawMMDModel Read(BinaryReader reader, ModelReadConfig config)
{
var model = new RawMMDModel();
var context = new PmdReadContext();
var meta = ReadMeta(reader);
if (!"Pmd".Equals(meta.Magic) || Math.Abs(meta.Version - 1.0f) > 0.0001f)
{
throw new MMDFileParseException("File is not a PMD 1.0 file");
}
ReadDescription(reader, model);
ReadVertices(reader, model);
ReadTriangles(reader, model);
var toonTextureIds = new List<int>();
ReadParts(reader, model, toonTextureIds);
ReadBonesAndIks(reader, model, context);
ReadFaces(reader, model);
ReadFacdDisplayListNames(reader);
ReadBoneNameList(reader, context);
ReadBoneDisp(reader);
if (MMDReaderUtil.Eof(reader))
{
goto PMD_READER_READ_LEGACY_30;
}
ReadInfoEn(reader, model, context);
if (MMDReaderUtil.Eof(reader))
{
goto PMD_READER_READ_LEGACY_30;
}
ReadCustomTextures(reader, config, model, toonTextureIds);
if (MMDReaderUtil.Eof(reader))
{
goto PMD_READER_READ_LEGACY_50;
}
ReadRigidBodies(reader, model, context);
ReadConstraints(reader, model);
goto PMD_READER_READ_SUCCEED;
PMD_READER_READ_LEGACY_30:
for (var i = 0; i < model.Parts.Length; ++i)
{
var material = model.Parts[i].Material;
material.Toon = MMDTextureUtil.GetGlobalToon(toonTextureIds[i], config.GlobalToonPath);
}
PMD_READER_READ_LEGACY_50:
PMD_READER_READ_SUCCEED:
model.Normalize();
return model;
}
private static void ReadConstraints(BinaryReader reader, RawMMDModel model)
{
var constraintNum = reader.ReadUInt32();
model.Joints = new Model.Joint[constraintNum];
for (var i = 0; i < constraintNum; ++i)
{
var constraint = new Model.Joint();
constraint.Name = MMDReaderUtil.ReadStringFixedLength(reader, 20, Tools.JapaneseEncoding);
constraint.AssociatedRigidBodyIndex[0] = reader.ReadInt32();
constraint.AssociatedRigidBodyIndex[1] = reader.ReadInt32();
constraint.Position = MMDReaderUtil.ReadVector3(reader);
constraint.Rotation = MMDReaderUtil.ReadAmpVector3(reader, Mathf.Rad2Deg);
constraint.PositionLowLimit = MMDReaderUtil.ReadVector3(reader);
constraint.PositionHiLimit = MMDReaderUtil.ReadVector3(reader);
constraint.RotationLowLimit = MMDReaderUtil.ReadVector3(reader);
constraint.RotationHiLimit = MMDReaderUtil.ReadVector3(reader);
constraint.SpringTranslate = MMDReaderUtil.ReadVector3(reader);
constraint.SpringRotate = MMDReaderUtil.ReadVector3(reader);
model.Joints[i] = constraint;
}
}
private static void ReadRigidBodies(BinaryReader reader, RawMMDModel model, PmdReadContext context)
{
var rigidBodyNum = reader.ReadInt32();
model.Rigidbodies = new MMDRigidBody[rigidBodyNum];
for (var i = 0; i < rigidBodyNum; ++i)
{
var rigidBody = new MMDRigidBody();
rigidBody.Name = MMDReaderUtil.ReadStringFixedLength(reader, 20, Tools.JapaneseEncoding).Trim();
var boneIndex = reader.ReadUInt16();
if (boneIndex < context.BoneNum)
{
rigidBody.AssociatedBoneIndex = boneIndex;
}
else
{
if (context.CenterBoneIndex == null)
{
rigidBody.AssociatedBoneIndex = 0;
}
else
{
rigidBody.AssociatedBoneIndex = context.CenterBoneIndex.Value;
}
}
rigidBody.CollisionGroup = reader.ReadSByte();
rigidBody.CollisionMask = reader.ReadUInt16();
rigidBody.Shape = (MMDRigidBody.RigidBodyShape) reader.ReadByte();
rigidBody.Dimemsions = MMDReaderUtil.ReadVector3(reader);
var rbPosition = MMDReaderUtil.ReadVector3(reader);
rigidBody.Position = model.Bones[rigidBody.AssociatedBoneIndex].Position + rbPosition;
rigidBody.Rotation = MMDReaderUtil.ReadVector3(reader);
rigidBody.Mass = reader.ReadSingle();
rigidBody.TranslateDamp = reader.ReadSingle();
rigidBody.RotateDamp = reader.ReadSingle();
rigidBody.Restitution = reader.ReadSingle();
rigidBody.Friction = reader.ReadSingle();
var type = reader.ReadByte();
if (boneIndex < context.BoneNum)
{
rigidBody.Type = (MMDRigidBody.RigidBodyType) type;
}
else
{
rigidBody.Type = MMDRigidBody.RigidBodyType.RigidTypePhysicsGhost;
}
model.Rigidbodies[i] = rigidBody;
}
}
private static void ReadCustomTextures(BinaryReader reader, ModelReadConfig config, RawMMDModel model,
List<int> toonTextureIds)
{
var customTextures = new MMDTexture[10];
for (var i = 0; i < 10; ++i)
{
customTextures[i] =
new MMDTexture(MMDReaderUtil.ReadStringFixedLength(reader, 100, Tools.JapaneseEncoding));
}
for (var i = 0; i < model.Parts.Length; ++i)
{
var material = model.Parts[i].Material;
if (toonTextureIds[i] < 10)
{
material.Toon = customTextures[toonTextureIds[i]];
}
else
{
material.Toon = MMDTextureUtil.GetGlobalToon(0, config.GlobalToonPath);
}
}
}
private static void ReadInfoEn(BinaryReader reader, RawMMDModel model, PmdReadContext context)
{
var hasInfoEn = reader.ReadSByte() == 1;
if (!hasInfoEn) return;
model.NameEn = MMDReaderUtil.ReadStringFixedLength(reader, 20, Tools.JapaneseEncoding);
model.DescriptionEn = MMDReaderUtil.ReadStringFixedLength(reader, 256, Tools.JapaneseEncoding);
for (var i = 0; i < context.BoneNum; ++i)
{
var bone = model.Bones[i];
bone.NameEn = MMDReaderUtil.ReadStringFixedLength(reader, 20, Tools.JapaneseEncoding);
}
if (model.Morphs.Length > 0)
{
model.Morphs[0].NameEn = model.Morphs[0].Name;
}
for (var i = 1; i < model.Morphs.Length; ++i)
{
var morph = model.Morphs[i];
morph.NameEn = MMDReaderUtil.ReadStringFixedLength(reader, 20, Tools.JapaneseEncoding);
}
// UNDONE
for (var i = 0; i < context.BoneNameListNum; ++i)
{
MMDReaderUtil.ReadStringFixedLength(reader, 50, Tools.JapaneseEncoding);
}
}
private static void ReadBoneDisp(BinaryReader reader)
{
var boneDispNum = reader.ReadInt32();
for (var i = 0; i < boneDispNum; ++i)
{
reader.ReadUInt16();
reader.ReadSByte();
}
}
private static void ReadBoneNameList(BinaryReader reader, PmdReadContext context)
{
int boneNameListNum = reader.ReadSByte();
context.BoneNameListNum = boneNameListNum;
for (var i = 0; i < boneNameListNum; ++i)
{
MMDReaderUtil.ReadStringFixedLength(reader, 50, Tools.JapaneseEncoding);
}
}
private static void ReadFacdDisplayListNames(BinaryReader reader)
{
int faceDisplayListName = reader.ReadSByte();
for (var i = 0; i < faceDisplayListName; ++i)
{
reader.ReadUInt16();
}
}
private void ReadFaces(BinaryReader reader, RawMMDModel model)
{
var faceNum = reader.ReadUInt16();
int? baseMorphIndex = null;
model.Morphs = new Morph[faceNum];
for (var i = 0; i < faceNum; ++i)
{
var morph = new Morph();
var fp = ReadPmdFacePreamble(reader);
morph.Name = fp.Name;
morph.Category = (Morph.MorphCategory) fp.FaceType;
if (morph.Category == Morph.MorphCategory.MorphCatSystem)
{
baseMorphIndex = i;
}
morph.Type = Morph.MorphType.MorphTypeVertex;
morph.MorphDatas = new Morph.MorphData[fp.VertexNum];
for (var j = 0; j < fp.VertexNum; ++j)
{
var vertexMorphData = new Morph.VertexMorphData();
vertexMorphData.VertexIndex = reader.ReadInt32();
vertexMorphData.Offset = MMDReaderUtil.ReadVector3(reader);
morph.MorphDatas[j] = vertexMorphData;
}
model.Morphs[i] = morph;
}
if (baseMorphIndex != null)
{
var baseMorph = model.Morphs[baseMorphIndex.Value];
for (var i = 0; i < faceNum; ++i)
{
if (i == baseMorphIndex)
{
continue;
}
var morph = model.Morphs[i];
for (var j = 0; j < morph.MorphDatas.Length; ++j)
{
var vertexMorphData = (Morph.VertexMorphData) morph.MorphDatas[j];
var morphDataVertexIndex = vertexMorphData.VertexIndex;
vertexMorphData.VertexIndex = ((Morph.VertexMorphData) baseMorph.MorphDatas[morphDataVertexIndex])
.VertexIndex;
}
}
}
}
private PmdFacePreamble ReadPmdFacePreamble(BinaryReader reader)
{
return new PmdFacePreamble
{
Name = MMDReaderUtil.ReadStringFixedLength(reader, 20, Tools.JapaneseEncoding),
VertexNum = reader.ReadInt32(),
FaceType = reader.ReadSByte()
};
}
private void ReadBonesAndIks(BinaryReader reader, RawMMDModel model, PmdReadContext context)
{
int boneNum = reader.ReadUInt16();
context.BoneNum = boneNum;
var rawBones = new PmdBone[boneNum];
for (var i = 0; i < boneNum; ++i)
{
rawBones[i] = ReadPmdBone(reader);
}
var ikBoneIds = new HashSet<int>();
int ikNum = reader.ReadUInt16();
var rawIkList = new List<PmdRawIk>(ikNum);
for (var i = 0; i < ikNum; ++i)
{
var rawIk = new PmdRawIk();
rawIk.Preamble = ReadPmdIkPreamable(reader);
ikBoneIds.Add(rawIk.Preamble.IkBoneIndex);
rawIk.Chain = new int[rawIk.Preamble.IkChainLength];
for (var j = 0; j < rawIk.Preamble.IkChainLength; ++j)
{
rawIk.Chain[j] = reader.ReadUInt16();
}
rawIkList.Add(rawIk);
}
rawIkList.Sort((ik1, ik2) =>
{
var a1 = 0;
var a2 = 0;
if (ik1.Chain.Length > 0)
{
a1 = ik1.Chain[0];
}
if (ik2.Chain.Length > 0)
{
a2 = ik2.Chain[0];
}
return a1.CompareTo(a2);
});
var boneList = new List<Bone>();
int? centerBoneIndex = null;
model.Bones = new Bone[boneNum];
for (var i = 0; i < boneNum; ++i)
{
var bone = new Bone();
boneList.Add(bone);
var rawBone = rawBones[i];
bone.Name = rawBone.Name;
if ("\u30BB\u30F3\u30BF\u30FC".Equals(bone.Name)) //TODO 验证是不是这个值
{
centerBoneIndex = i;
}
bone.Position = rawBone.Position;
// TODO - workaround here, need fix, see [1].
if (i != rawBone.ParentId)
{
bone.ParentIndex = rawBone.ParentId;
}
else
{
bone.ParentIndex = 0; //TODO mmdlib里是nil
}
bone.TransformLevel = 0;
bone.ChildBoneVal.ChildUseId = true;
bone.ChildBoneVal.Index = rawBone.ChildId;
bone.Rotatable = true;
var type = (PmdBoneTypes) rawBone.Type;
bone.HasIk = type == PmdBoneTypes.PmdBoneIk || ikBoneIds.Contains(i);
bone.Movable = type == PmdBoneTypes.PmdBoneRotateAndTranslate || bone.HasIk;
bone.Visible = type != PmdBoneTypes.PmdBoneIkTo && type != PmdBoneTypes.PmdBoneInvisible &&
type != PmdBoneTypes.PmdBoneRotateRatio;
bone.Controllable = true;
bone.AppendRotate = type == PmdBoneTypes.PmdBoneRotateEffect || type == PmdBoneTypes.PmdBoneRotateRatio;
bone.AppendTranslate = false;
bone.RotAxisFixed = type == PmdBoneTypes.PmdBoneTwist;
bone.UseLocalAxis = false;
bone.PostPhysics = false;
bone.ReceiveTransform = false;
if (bone.AppendRotate)
{
if (type == PmdBoneTypes.PmdBoneRotateEffect)
{
bone.AppendBoneVal.Index = rawBone.IkNumber;
bone.AppendBoneVal.Ratio = 1.0f;
bone.TransformLevel = 2;
}
else
{
bone.ChildBoneVal.ChildUseId = false;
bone.ChildBoneVal.Offset = Vector3.zero;
bone.AppendBoneVal.Index = rawBone.ChildId;
bone.AppendBoneVal.Ratio = rawBone.IkNumber * 0.01f;
}
}
if (bone.HasIk)
{
bone.TransformLevel = 1;
}
if (bone.RotAxisFixed)
{
var childId = rawBone.ChildId;
if (childId > boneNum)
{
childId = 0;
}
bone.RotAxis = (rawBones[childId].Position - bone.Position).normalized;
if (bone.ChildBoneVal.ChildUseId)
{
bone.ChildBoneVal.ChildUseId = false;
bone.ChildBoneVal.Offset = Vector3.zero;
}
}
model.Bones[i] = bone;
}
var loLimit = Vector3.zero;
var hiLimit = Vector3.zero;
loLimit.x = (float) -Math.PI;
hiLimit.x = (float) (-0.5f / 180.0f * Math.PI);
for (var i = 0; i < boneNum; ++i)
{
if (!ikBoneIds.Contains(i))
{
boneList[i].IkInfoVal = new Bone.IkInfo
{
IkLinks = new Bone.IkLink[0]
};
continue;
}
var associatedIkCount = 0;
for (var j = 0; j < ikNum; ++j)
{
var rawIk = rawIkList[j];
if (i != rawIk.Preamble.IkBoneIndex)
{
continue;
}
Bone bone;
if (associatedIkCount == 0)
{
bone = boneList[i];
}
else
{
var originalBone = boneList[i];
bone = Bone.CopyOf(originalBone);
boneList.Add(bone);
bone.Name = "[IK]" + originalBone.Name;
bone.NameEn = "[IK]" + originalBone.NameEn;
bone.ParentIndex = i;
bone.ChildBoneVal.ChildUseId = false;
bone.ChildBoneVal.Offset = Vector3.zero;
bone.Visible = false;
bone.IkInfoVal.IkLinks = new Bone.IkLink[rawIk.Preamble.IkChainLength];
bone.HasIk = true;
}
bone.IkInfoVal = new Bone.IkInfo();
bone.IkInfoVal.IkTargetIndex = rawIk.Preamble.IkTargetBoneIndex;
bone.IkInfoVal.CcdIterateLimit = rawIk.Preamble.CcdIterateLimit;
bone.IkInfoVal.CcdAngleLimit = rawIk.Preamble.CcdAngleLimit;
bone.IkInfoVal.IkLinks = new Bone.IkLink[rawIk.Preamble.IkChainLength];
for (var k = 0; k < rawIk.Preamble.IkChainLength; ++k)
{
var link = new Bone.IkLink();
link.LinkIndex = rawIk.Chain[k];
var linkName = model.Bones[link.LinkIndex].Name;
if ("\u5DE6\u3072\u3056".Equals(linkName) || "\u53F3\u3072\u3056".Equals(linkName))
{
link.HasLimit = true;
link.LoLimit = loLimit;
link.HiLimit = hiLimit;
}
else
{
link.HasLimit = false;
}
bone.IkInfoVal.IkLinks[k] = link;
}
associatedIkCount++;
}
}
model.Bones = boneList.ToArray();
// TODO - need verification
for (var i = 0; i < boneNum; ++i)
{
var stable = true;
for (var j = 0; j < boneNum; ++j)
{
var bone = model.Bones[j];
var transformLevel = bone.TransformLevel;
var parentId = bone.ParentIndex;
while (parentId < boneNum)
{
var parentTransformLevel = model.Bones[parentId].TransformLevel;
if (transformLevel < parentTransformLevel)
{
transformLevel = parentTransformLevel;
stable = false;
}
parentId = model.Bones[parentId].ParentIndex;
}
bone.TransformLevel = transformLevel;
}
if (stable)
{
break;
}
}
context.CenterBoneIndex = centerBoneIndex;
}
private static void ReadParts(BinaryReader reader, RawMMDModel model, List<int> tooTextureIds)
{
var partNum = reader.ReadInt32();
var partBaseShift = 0;
model.Parts = new Part[partNum];
for (var i = 0; i < partNum; ++i)
{
var material = new MMDMaterial();
material.DiffuseColor = MMDReaderUtil.ReadColor(reader, true);
material.Shiness = reader.ReadSingle();
material.SpecularColor = MMDReaderUtil.ReadColor(reader, false);
material.AmbientColor = MMDReaderUtil.ReadColor(reader, false);
var toonId = reader.ReadByte();
var edgeFlag = reader.ReadSByte();
var vertexNum = reader.ReadInt32();
var textureName = MMDReaderUtil.ReadStringFixedLength(reader, 20, Tools.JapaneseEncoding);
material.DrawDoubleFace = material.DiffuseColor.a < 0.9999f;
material.DrawGroundShadow = edgeFlag != 0;
material.CastSelfShadow = true;
material.DrawSelfShadow = true;
material.DrawEdge = edgeFlag != 0;
material.EdgeColor = Color.black;
if (!string.IsNullOrEmpty(textureName))
{
var dlmPos = textureName.IndexOf("*", StringComparison.Ordinal);
if (dlmPos >= 0)
{
var texPath = textureName.Substring(0, dlmPos);
var sphPath = textureName.Substring(dlmPos + 1);
if (!string.IsNullOrEmpty(texPath))
{
material.Texture = new MMDTexture(texPath);
}
if (!string.IsNullOrEmpty(sphPath))
{
material.SubTexture = new MMDTexture(sphPath);
}
if (sphPath.EndsWith("a") || sphPath.EndsWith("A"))
{
material.SubTextureType = MMDMaterial.SubTextureTypeEnum.MatSubTexSpa;
}
else
{
material.SubTextureType = MMDMaterial.SubTextureTypeEnum.MatSubTexSph;
}
}
else
{
var extDlmPos = textureName.LastIndexOf(".", StringComparison.Ordinal);
if (extDlmPos >= 0)
{
var ext = textureName.Substring(extDlmPos + 1);
ext = ext.ToLower();
if (!ext.Equals("sph") && !ext.Equals("spa"))
{
material.Texture = new MMDTexture(textureName);
}
else
{
material.SubTexture = new MMDTexture(textureName);
;
if (ext.EndsWith("a"))
{
material.SubTextureType = MMDMaterial.SubTextureTypeEnum.MatSubTexSpa;
}
else
{
material.SubTextureType = MMDMaterial.SubTextureTypeEnum.MatSubTexSph;
}
}
}
else
{
material.Texture = new MMDTexture(textureName);
}
}
}
var part = new Part();
part.Material = material;
tooTextureIds.Add(toonId);
part.BaseShift = partBaseShift;
part.TriangleIndexNum = vertexNum;
partBaseShift += vertexNum;
model.Parts[i] = part;
}
}
private static void ReadTriangles(BinaryReader reader, RawMMDModel model)
{
var triangleIndexCount = reader.ReadInt32();
model.TriangleIndexes = new int[triangleIndexCount];
if (triangleIndexCount % 3 != 0)
{
throw new MMDFileParseException("triangle index count " + triangleIndexCount + " is not multiple of 3");
}
for (var i = 0; i < triangleIndexCount; ++i)
{
model.TriangleIndexes[i] = reader.ReadUInt16();
}
}
private static void ReadVertices(BinaryReader reader, RawMMDModel model)
{
var vertexNum = reader.ReadInt32();
model.Vertices = new Vertex[vertexNum];
for (var i = 0; i < vertexNum; ++i)
{
var vertex = new Vertex
{
Coordinate = MMDReaderUtil.ReadVector3(reader),
Normal = MMDReaderUtil.ReadVector3(reader),
UvCoordinate = MMDReaderUtil.ReadVector2(reader)
};
var skinningOperator = new SkinningOperator();
var bdef2 = new SkinningOperator.Bdef2();
bdef2.BoneId = new int[2];
bdef2.BoneId[0] = reader.ReadInt16();
bdef2.BoneId[1] = reader.ReadInt16();
bdef2.BoneWeight = reader.ReadSByte() * 0.01f;
skinningOperator.Param = bdef2;
skinningOperator.Type = SkinningOperator.SkinningType.SkinningBdef2;
vertex.SkinningOperator = skinningOperator;
var noEdge = reader.ReadByte() != 0;
vertex.EdgeScale = noEdge ? 0.0f : 1.0f;
model.Vertices[i] = vertex;
}
}
private static void ReadDescription(BinaryReader reader, RawMMDModel model)
{
model.Name = MMDReaderUtil.ReadStringFixedLength(reader, 20, Tools.JapaneseEncoding);
model.Description = MMDReaderUtil.ReadStringFixedLength(reader, 256, Tools.JapaneseEncoding);
}
private static PmdMeta ReadMeta(BinaryReader reader)
{
PmdMeta ret;
ret.Magic = MMDReaderUtil.ReadStringFixedLength(reader, 3, Encoding.ASCII);
ret.Version = reader.ReadSingle();
return ret;
}
private struct PmdMeta
{
public string Magic;
public float Version;
}
private PmdBone ReadPmdBone(BinaryReader reader)
{
return new PmdBone
{
Name = MMDReaderUtil.ReadStringFixedLength(reader, 20, Tools.JapaneseEncoding),
ParentId = reader.ReadUInt16(),
ChildId = reader.ReadUInt16(),
Type = reader.ReadSByte(),
IkNumber = reader.ReadUInt16(),
Position = MMDReaderUtil.ReadVector3(reader)
};
}
private PmdIkPreamble ReadPmdIkPreamable(BinaryReader reader)
{
return new PmdIkPreamble
{
IkBoneIndex = reader.ReadInt16(),
IkTargetBoneIndex = reader.ReadInt16(),
IkChainLength = reader.ReadSByte(),
CcdIterateLimit = reader.ReadUInt16(),
CcdAngleLimit = reader.ReadSingle()
};
}
private class PmdBone
{
public string Name { get; set; }
public ushort ParentId { get; set; }
public ushort ChildId { get; set; }
public sbyte Type { get; set; }
public ushort IkNumber { get; set; }
public Vector3 Position { get; set; }
}
private class PmdIkPreamble
{
public short IkBoneIndex { get; set; }
public short IkTargetBoneIndex { get; set; }
public sbyte IkChainLength { get; set; }
public ushort CcdIterateLimit { get; set; }
public float CcdAngleLimit { get; set; }
}
private class PmdRawIk
{
public PmdIkPreamble Preamble { get; set; }
public int[] Chain { get; set; }
}
private enum PmdBoneTypes : byte
{
PmdBoneRotate = 0,
PmdBoneRotateAndTranslate = 1,
PmdBoneIk = 2,
PmdBoneUnknown = 3,
PmdBoneIkLink = 4,
PmdBoneRotateEffect = 5,
PmdBoneIkTo = 6,
PmdBoneInvisible = 7,
PmdBoneTwist = 8,
PmdBoneRotateRatio = 9
}
private class PmdFacePreamble
{
public string Name { get; set; }
public int VertexNum { get; set; }
public sbyte FaceType { get; set; }
}
private class PmdReadContext
{
public int? CenterBoneIndex { get; set; }
public int BoneNum { get; set; }
public int BoneNameListNum { get; set; }
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 719b4729c95822f45aff8f670135851b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,627 @@
using System;
using System.IO;
using System.Text;
using LibMMD.Material;
using LibMMD.Model;
using LibMMD.Util;
using UnityEngine;
namespace LibMMD.Reader
{
public class PMXReader : ModelReader
{
const float JointSplingAmp = 0.08f;
const float JointDampAmp = 0.08f;
public override RawMMDModel Read(BinaryReader reader, ModelReadConfig config)
{
PmxMeta pmxHeader;
try
{
pmxHeader = ReadMeta(reader);
}
catch
{
throw new MMDFileParseException("Could not read pmx meta data.");
}
if (!"PMX ".Equals(pmxHeader.Magic) || Math.Abs(pmxHeader.Version - 2.0f) > 0.0001f || pmxHeader.FileFlagSize !=8)
{
throw new MMDFileParseException("File is not a PMX 2.0 file");
}
var model = new RawMMDModel();
var pmxConfig = ReadPmxConfig(reader, model);
ReadModelNameAndDescription(reader, model, pmxConfig);
ReadVertices(reader, model, pmxConfig);
ReadTriangles(reader, model, pmxConfig);
var textureList = ReadTextureList(reader, pmxConfig);
ReadParts(reader, config, model, pmxConfig, textureList);
ReadBones(reader, model, pmxConfig);
ReadMorphs(reader, model, pmxConfig);
ReadEntries(reader, pmxConfig);
ReadRigidBodies(reader, model, pmxConfig);
ReadJoints(reader, model, pmxConfig);
model.Normalize();
return model;
}
private static void ReadJoints(BinaryReader reader, RawMMDModel model, PmxConfig pmxConfig)
{
var constraintNum = reader.ReadInt32();
model.Joints = new Model.Joint[constraintNum];
for (var i = 0; i < constraintNum; ++i)
{
var joint = new Model.Joint
{
Name = MMDReaderUtil.ReadSizedString(reader, pmxConfig.Encoding),
NameEn = MMDReaderUtil.ReadSizedString(reader, pmxConfig.Encoding)
};
var dofType = reader.ReadByte();
if (dofType == 0)
{
joint.AssociatedRigidBodyIndex[0] =
MMDReaderUtil.ReadIndex(reader, pmxConfig.RigidBodyIndexSize);
joint.AssociatedRigidBodyIndex[1] =
MMDReaderUtil.ReadIndex(reader, pmxConfig.RigidBodyIndexSize);
joint.Position = MMDReaderUtil.ReadVector3(reader);
joint.Rotation = MMDReaderUtil.ReadAmpVector3(reader, Mathf.Rad2Deg);
joint.PositionLowLimit = MMDReaderUtil.ReadVector3(reader);
joint.PositionHiLimit = MMDReaderUtil.ReadVector3(reader);
joint.RotationLowLimit = MMDReaderUtil.ReadVector3(reader);
joint.RotationHiLimit = MMDReaderUtil.ReadVector3(reader);
joint.SpringTranslate = MMDReaderUtil.ReadVector3(reader);
joint.SpringRotate = MMDReaderUtil.ReadVector3(reader);
}
else
{
throw new MMDFileParseException("Only 6DOF spring joints are supported.");
}
model.Joints[i] = joint;
}
}
private static PmxConfig ReadPmxConfig(BinaryReader reader, RawMMDModel model)
{
var pmxConfig = new PmxConfig();
pmxConfig.Utf8Encoding = reader.ReadByte() != 0;
pmxConfig.ExtraUvNumber = reader.ReadSByte();
pmxConfig.VertexIndexSize = reader.ReadSByte();
pmxConfig.TextureIndexSize = reader.ReadSByte();
pmxConfig.MaterialIndexSize = reader.ReadSByte();
pmxConfig.BoneIndexSize = reader.ReadSByte();
pmxConfig.MorphIndexSize = reader.ReadSByte();
pmxConfig.RigidBodyIndexSize = reader.ReadSByte();
model.ExtraUvNumber = pmxConfig.ExtraUvNumber;
pmxConfig.Encoding = pmxConfig.Utf8Encoding ? Encoding.UTF8 : Encoding.Unicode;
return pmxConfig;
}
private static void ReadRigidBodies(BinaryReader reader, RawMMDModel model, PmxConfig pmxConfig)
{
var rigidBodyNum = reader.ReadInt32();
model.Rigidbodies = new MMDRigidBody[rigidBodyNum];
for (var i = 0; i < rigidBodyNum; ++i)
{
var rigidBody = new MMDRigidBody
{
Name = MMDReaderUtil.ReadSizedString(reader, pmxConfig.Encoding),
NameEn = MMDReaderUtil.ReadSizedString(reader, pmxConfig.Encoding),
AssociatedBoneIndex = MMDReaderUtil.ReadIndex(reader, pmxConfig.BoneIndexSize),
CollisionGroup = reader.ReadByte(),
CollisionMask = reader.ReadUInt16(),
Shape = (MMDRigidBody.RigidBodyShape) reader.ReadByte(),
Dimemsions = MMDReaderUtil.ReadRawCoordinateVector3(reader),
Position = MMDReaderUtil.ReadVector3(reader),
Rotation = MMDReaderUtil.ReadAmpVector3(reader, Mathf.Rad2Deg),
Mass = reader.ReadSingle(),
TranslateDamp = reader.ReadSingle(),
RotateDamp = reader.ReadSingle(),
Restitution = reader.ReadSingle(),
Friction = reader.ReadSingle(),
Type = (MMDRigidBody.RigidBodyType) reader.ReadByte()
};
model.Rigidbodies[i] = rigidBody;
}
}
//unused data
private static void ReadEntries(BinaryReader reader, PmxConfig pmxConfig)
{
var entryItemNum = reader.ReadInt32();
for (var i = 0; i < entryItemNum; ++i)
{
MMDReaderUtil.ReadSizedString(reader, pmxConfig.Encoding); //entryItemName
MMDReaderUtil.ReadSizedString(reader, pmxConfig.Encoding); //entryItemNameEn
reader.ReadByte(); //isSpecial
var elementNum = reader.ReadInt32();
for (var j = 0; j < elementNum; ++j)
{
var isMorph = reader.ReadByte() == 1;
if (isMorph)
{
MMDReaderUtil.ReadIndex(reader, pmxConfig.MorphIndexSize); //morphIndex
}
else
{
MMDReaderUtil.ReadIndex(reader, pmxConfig.BoneIndexSize); //boneIndex
}
}
}
}
private static void ReadMorphs(BinaryReader reader, RawMMDModel model, PmxConfig pmxConfig)
{
var morphNum = reader.ReadInt32();
int? baseMorphIndex = null;
model.Morphs = new Morph[morphNum];
for (var i = 0; i < morphNum; ++i)
{
var morph = new Morph
{
Name = MMDReaderUtil.ReadSizedString(reader, pmxConfig.Encoding),
NameEn = MMDReaderUtil.ReadSizedString(reader, pmxConfig.Encoding),
Category = (Morph.MorphCategory) reader.ReadByte()
};
if (morph.Category == Morph.MorphCategory.MorphCatSystem)
{
baseMorphIndex = i;
}
morph.Type = (Morph.MorphType) reader.ReadByte();
var morphDataNum = reader.ReadInt32();
morph.MorphDatas = new Morph.MorphData[morphDataNum];
switch (morph.Type)
{
case Morph.MorphType.MorphTypeGroup:
for (var j = 0; j < morphDataNum; ++j)
{
var morphData =
new Morph.GroupMorphData
{
MorphIndex = MMDReaderUtil.ReadIndex(reader, pmxConfig.MorphIndexSize),
MorphRate = reader.ReadSingle()
};
morph.MorphDatas[j] = morphData;
}
break;
case Morph.MorphType.MorphTypeVertex:
for (var j = 0; j < morphDataNum; ++j)
{
var morphData =
new Morph.VertexMorphData
{
VertexIndex = MMDReaderUtil.ReadIndex(reader, pmxConfig.VertexIndexSize),
Offset = MMDReaderUtil.ReadVector3(reader)
};
morph.MorphDatas[j] = morphData;
}
break;
case Morph.MorphType.MorphTypeBone:
for (var j = 0; j < morphDataNum; ++j)
{
var morphData =
new Morph.BoneMorphData
{
BoneIndex = MMDReaderUtil.ReadIndex(reader, pmxConfig.BoneIndexSize),
Translation = MMDReaderUtil.ReadVector3(reader),
Rotation = MMDReaderUtil.ReadQuaternion(reader)
};
morph.MorphDatas[j] = morphData;
}
break;
case Morph.MorphType.MorphTypeUv:
case Morph.MorphType.MorphTypeExtUv1:
case Morph.MorphType.MorphTypeExtUv2:
case Morph.MorphType.MorphTypeExtUv3:
case Morph.MorphType.MorphTypeExtUv4:
for (var j = 0; j < morphDataNum; ++j)
{
var morphData =
new Morph.UvMorphData
{
VertexIndex = MMDReaderUtil.ReadIndex(reader, pmxConfig.VertexIndexSize),
Offset = MMDReaderUtil.ReadVector4(reader)
};
morph.MorphDatas[j] = morphData;
}
break;
case Morph.MorphType.MorphTypeMaterial:
for (var j = 0; j < morphDataNum; j++)
{
var morphData = new Morph.MaterialMorphData();
var mmIndex = MMDReaderUtil.ReadIndex(reader, pmxConfig.MaterialIndexSize);
if (mmIndex < model.Parts.Length && mmIndex > 0) //TODO mmdlib的代码里是和bone数比较。确认这个逻辑
{
morphData.MaterialIndex = mmIndex;
morphData.Global = false;
}
else
{
morphData.MaterialIndex = 0;
morphData.Global = true;
}
morphData.Method = (Morph.MaterialMorphData.MaterialMorphMethod) reader.ReadByte();
morphData.Diffuse = MMDReaderUtil.ReadColor(reader, true);
morphData.Specular = MMDReaderUtil.ReadColor(reader, false);
morphData.Shiness = reader.ReadSingle();
morphData.Ambient = MMDReaderUtil.ReadColor(reader, false);
morphData.EdgeColor = MMDReaderUtil.ReadColor(reader, true);
morphData.EdgeSize = reader.ReadSingle();
morphData.Texture = MMDReaderUtil.ReadVector4(reader);
morphData.SubTexture = MMDReaderUtil.ReadVector4(reader);
morphData.ToonTexture = MMDReaderUtil.ReadVector4(reader);
morph.MorphDatas[j] = morphData;
}
break;
default:
throw new MMDFileParseException("invalid morph type " + morph.Type);
}
if (baseMorphIndex != null)
{
//TODO rectify system-reserved category
}
model.Morphs[i] = morph;
}
}
private static void ReadBones(BinaryReader reader, RawMMDModel model, PmxConfig pmxConfig)
{
var boneNum = reader.ReadInt32();
model.Bones = new Bone[boneNum];
for (var i = 0; i < boneNum; ++i)
{
var bone = new Bone
{
Name = MMDReaderUtil.ReadSizedString(reader, pmxConfig.Encoding),
NameEn = MMDReaderUtil.ReadSizedString(reader, pmxConfig.Encoding),
Position = MMDReaderUtil.ReadVector3(reader)
};
var parentIndex = MMDReaderUtil.ReadIndex(reader, pmxConfig.BoneIndexSize);
if (parentIndex < boneNum && parentIndex >= 0)
{
bone.ParentIndex = parentIndex;
}
else
{
bone.ParentIndex = -1;
}
bone.TransformLevel = reader.ReadInt32();
var flag = reader.ReadUInt16();
bone.ChildBoneVal.ChildUseId = (flag & PmxBoneFlags.PmxBoneChildUseId) != 0;
bone.Rotatable = (flag & PmxBoneFlags.PmxBoneRotatable) != 0;
bone.Movable = (flag & PmxBoneFlags.PmxBoneMovable) != 0;
bone.Visible = (flag & PmxBoneFlags.PmxBoneVisible) != 0;
bone.Controllable = (flag & PmxBoneFlags.PmxBoneControllable) != 0;
bone.HasIk = (flag & PmxBoneFlags.PmxBoneHasIk) != 0;
bone.AppendRotate = (flag & PmxBoneFlags.PmxBoneAcquireRotate) != 0;
bone.AppendTranslate = (flag & PmxBoneFlags.PmxBoneAcquireTranslate) != 0;
bone.RotAxisFixed = (flag & PmxBoneFlags.PmxBoneRotAxisFixed) != 0;
bone.UseLocalAxis = (flag & PmxBoneFlags.PmxBoneUseLocalAxis) != 0;
bone.PostPhysics = (flag & PmxBoneFlags.PmxBonePostPhysics) != 0;
bone.ReceiveTransform = (flag & PmxBoneFlags.PmxBoneReceiveTransform) != 0;
if (bone.ChildBoneVal.ChildUseId)
{
bone.ChildBoneVal.Index = MMDReaderUtil.ReadIndex(reader, pmxConfig.BoneIndexSize);
}
else
{
bone.ChildBoneVal.Offset = MMDReaderUtil.ReadVector3(reader);
}
if (bone.RotAxisFixed)
{
bone.RotAxis = MMDReaderUtil.ReadVector3(reader);
}
if (bone.AppendRotate || bone.AppendTranslate)
{
bone.AppendBoneVal.Index = MMDReaderUtil.ReadIndex(reader, pmxConfig.BoneIndexSize);
bone.AppendBoneVal.Ratio = reader.ReadSingle();
}
if (bone.UseLocalAxis)
{
var localX = MMDReaderUtil.ReadVector3(reader);
var localZ = MMDReaderUtil.ReadVector3(reader);
var localY = Vector3.Cross(localX, localZ);
localZ = Vector3.Cross(localX, localY);
localX.Normalize();
localY.Normalize();
localZ.Normalize();
bone.LocalAxisVal.AxisX = localX;
bone.LocalAxisVal.AxisY = localY;
bone.LocalAxisVal.AxisZ = localZ;
}
if (bone.ReceiveTransform)
{
bone.ExportKey = reader.ReadInt32();
}
if (bone.HasIk)
{
ReadBoneIk(reader, bone, pmxConfig.BoneIndexSize);
}
model.Bones[i] = bone;
}
}
private static void ReadBoneIk(BinaryReader reader, Bone bone, int boneIndexSize)
{
bone.IkInfoVal = new Bone.IkInfo();
bone.IkInfoVal.IkTargetIndex = MMDReaderUtil.ReadIndex(reader, boneIndexSize);
bone.IkInfoVal.CcdIterateLimit = reader.ReadInt32();
bone.IkInfoVal.CcdAngleLimit = reader.ReadSingle();
var ikLinkNum = reader.ReadInt32();
bone.IkInfoVal.IkLinks = new Bone.IkLink[ikLinkNum];
for (var j = 0; j < ikLinkNum; ++j)
{
var link = new Bone.IkLink();
link.LinkIndex = MMDReaderUtil.ReadIndex(reader, boneIndexSize);
link.HasLimit = reader.ReadByte() != 0;
if (link.HasLimit)
{
link.LoLimit = MMDReaderUtil.ReadVector3(reader);
link.HiLimit = MMDReaderUtil.ReadVector3(reader);
}
bone.IkInfoVal.IkLinks[j] = link;
}
}
private static void ReadParts(BinaryReader reader, ModelReadConfig config, RawMMDModel model, PmxConfig pmxConfig, MMDTexture[] textureList)
{
var partNum = reader.ReadInt32();
var partBaseShift = 0;
model.Parts = new Part[partNum];
for (var i = 0; i < partNum; i++)
{
var part = new Part();
var material = ReadMaterial(reader, config, pmxConfig.Encoding, pmxConfig.TextureIndexSize, textureList);
part.Material = material;
var partTriangleIndexNum = reader.ReadInt32();
if (partTriangleIndexNum % 3 != 0)
{
throw new MMDFileParseException("part" + i + " triangle index count " + partTriangleIndexNum +
" is not multiple of 3");
}
part.BaseShift = partBaseShift;
part.TriangleIndexNum = partTriangleIndexNum;
partBaseShift += partTriangleIndexNum;
model.Parts[i] = part;
}
}
private static MMDTexture[] ReadTextureList(BinaryReader reader, PmxConfig pmxConfig)
{
var textureNum = reader.ReadInt32();
var textureList = new MMDTexture[textureNum];
for (var i = 0; i < textureNum; ++i)
{
var texturePathEncoding = pmxConfig.Utf8Encoding ? Encoding.UTF8 : Encoding.Unicode;
var texturePath = MMDReaderUtil.ReadSizedString(reader, texturePathEncoding);
textureList[i] = new MMDTexture(texturePath);
}
return textureList;
}
private static void ReadTriangles(BinaryReader reader, RawMMDModel model, PmxConfig pmxConfig)
{
var triangleIndexCount = reader.ReadInt32();
model.TriangleIndexes = new int[triangleIndexCount];
if (triangleIndexCount % 3 != 0)
{
throw new MMDFileParseException("triangle index count " + triangleIndexCount + " is not multiple of 3");
}
for (var i = 0; i < triangleIndexCount; ++i)
{
model.TriangleIndexes[i] = MMDReaderUtil.ReadIndex(reader, pmxConfig.VertexIndexSize);
}
}
private static void ReadVertices(BinaryReader reader, RawMMDModel model, PmxConfig pmxConfig)
{
var vertexNum = reader.ReadInt32();
model.Vertices = new Vertex[vertexNum];
for (uint i = 0; i < vertexNum; ++i)
{
var vertex = ReadVertex(reader, pmxConfig);
model.Vertices[i] = vertex;
}
}
private static void ReadModelNameAndDescription(BinaryReader reader, RawMMDModel model, PmxConfig pmxConfig)
{
model.Name = MMDReaderUtil.ReadSizedString(reader, pmxConfig.Encoding);
model.NameEn = MMDReaderUtil.ReadSizedString(reader, pmxConfig.Encoding);
model.Description = MMDReaderUtil.ReadSizedString(reader, pmxConfig.Encoding);
model.DescriptionEn = MMDReaderUtil.ReadSizedString(reader, pmxConfig.Encoding);
}
private static Vertex ReadVertex(BinaryReader reader, PmxConfig pmxConfig)
{
var pv = ReadVertexBasic(reader);
var vertex = new Vertex
{
Coordinate = pv.Coordinate,
Normal = pv.Normal,
UvCoordinate = pv.UvCoordinate
};
if (pmxConfig.ExtraUvNumber > 0)
{
var extraUv = new Vector4[pmxConfig.ExtraUvNumber];
for (var ei = 0; ei < pmxConfig.ExtraUvNumber; ++ei)
{
extraUv[ei] = MMDReaderUtil.ReadVector4(reader);
}
vertex.ExtraUvCoordinate = extraUv;
}
var op = new SkinningOperator();
var skinningType = (SkinningOperator.SkinningType) reader.ReadByte();
op.Type = skinningType;
switch (skinningType)
{
case SkinningOperator.SkinningType.SkinningBdef1:
var bdef1 = new SkinningOperator.Bdef1();
bdef1.BoneId = MMDReaderUtil.ReadIndex(reader, pmxConfig.BoneIndexSize);
op.Param = bdef1;
break;
case SkinningOperator.SkinningType.SkinningBdef2:
var bdef2 = new SkinningOperator.Bdef2();
bdef2.BoneId[0] = MMDReaderUtil.ReadIndex(reader, pmxConfig.BoneIndexSize);
bdef2.BoneId[1] = MMDReaderUtil.ReadIndex(reader, pmxConfig.BoneIndexSize);
bdef2.BoneWeight = reader.ReadSingle();
op.Param = bdef2;
break;
case SkinningOperator.SkinningType.SkinningBdef4:
var bdef4 = new SkinningOperator.Bdef4();
for (var j = 0; j < 4; ++j)
{
bdef4.BoneId[j] = MMDReaderUtil.ReadIndex(reader, pmxConfig.BoneIndexSize);
}
for (var j = 0; j < 4; ++j)
{
bdef4.BoneWeight[j] = reader.ReadSingle();
}
op.Param = bdef4;
break;
case SkinningOperator.SkinningType.SkinningSdef:
var sdef = new SkinningOperator.Sdef();
sdef.BoneId[0] = MMDReaderUtil.ReadIndex(reader, pmxConfig.BoneIndexSize);
sdef.BoneId[1] = MMDReaderUtil.ReadIndex(reader, pmxConfig.BoneIndexSize);
sdef.BoneWeight = reader.ReadSingle();
sdef.C = MMDReaderUtil.ReadVector3(reader);
sdef.R0 = MMDReaderUtil.ReadVector3(reader);
sdef.R1 = MMDReaderUtil.ReadVector3(reader);
op.Param = sdef;
break;
default:
throw new MMDFileParseException("invalid skinning type: " + skinningType);
}
vertex.SkinningOperator = op;
vertex.EdgeScale = reader.ReadSingle();
return vertex;
}
private static MMDMaterial ReadMaterial(BinaryReader reader, ModelReadConfig config, Encoding encoding,
int textureIndexSize, MMDTexture[] textureList)
{
var material = new MMDMaterial();
material.Name = MMDReaderUtil.ReadSizedString(reader, encoding);
material.NameEn = MMDReaderUtil.ReadSizedString(reader, encoding);
material.DiffuseColor = MMDReaderUtil.ReadColor(reader, true);
material.SpecularColor = MMDReaderUtil.ReadColor(reader, false);
material.Shiness = reader.ReadSingle();
material.AmbientColor = MMDReaderUtil.ReadColor(reader, false);
var drawFlag = reader.ReadByte();
material.DrawDoubleFace = (drawFlag & PmxMaterialDrawFlags.PmxMaterialDrawDoubleFace) != 0;
material.DrawGroundShadow = (drawFlag & PmxMaterialDrawFlags.PmxMaterialDrawGroundShadow) != 0;
material.CastSelfShadow = (drawFlag & PmxMaterialDrawFlags.PmxMaterialCastSelfShadow) != 0;
material.DrawSelfShadow = (drawFlag & PmxMaterialDrawFlags.PmxMaterialDrawSelfShadow) != 0;
material.DrawEdge = (drawFlag & PmxMaterialDrawFlags.PmxMaterialDrawEdge) != 0;
material.EdgeColor = MMDReaderUtil.ReadColor(reader, true);
material.EdgeSize = reader.ReadSingle();
var textureIndex = MMDReaderUtil.ReadIndex(reader, textureIndexSize);
if (textureIndex < textureList.Length && textureIndex >= 0)
{
material.Texture = textureList[textureIndex];
}
var subTextureIndex = MMDReaderUtil.ReadIndex(reader, textureIndexSize);
if (subTextureIndex < textureList.Length && subTextureIndex >= 0)
{
material.SubTexture = textureList[subTextureIndex];
}
material.SubTextureType = (MMDMaterial.SubTextureTypeEnum) reader.ReadByte();
var useGlobalToon = reader.ReadByte() != 0;
if (useGlobalToon)
{
int globalToonIndex = reader.ReadByte();
material.Toon = MMDTextureUtil.GetGlobalToon(globalToonIndex, config.GlobalToonPath);
}
else
{
var toonIndex = MMDReaderUtil.ReadIndex(reader, textureIndexSize);
if (toonIndex < textureList.Length && toonIndex >= 0)
{
material.Toon = textureList[toonIndex];
}
}
material.MetaInfo = MMDReaderUtil.ReadSizedString(reader, encoding);
return material;
}
private static PmxMeta ReadMeta(BinaryReader reader)
{
PmxMeta ret;
ret.Magic = MMDReaderUtil.ReadStringFixedLength(reader, 4, Encoding.ASCII);
ret.Version = reader.ReadSingle();
ret.FileFlagSize = reader.ReadByte();
return ret;
}
private static PmxVertexBasic ReadVertexBasic(BinaryReader reader)
{
PmxVertexBasic ret;
ret.Coordinate = MMDReaderUtil.ReadVector3(reader);
ret.Normal = MMDReaderUtil.ReadVector3(reader);
ret.UvCoordinate = MMDReaderUtil.ReadVector2(reader);
return ret;
}
private struct PmxMeta
{
public string Magic;
public float Version;
public byte FileFlagSize;
}
private struct PmxVertexBasic
{
public Vector3 Coordinate;
public Vector3 Normal;
public Vector2 UvCoordinate;
}
private class PmxConfig
{
public bool Utf8Encoding { get; set; }
public Encoding Encoding { get; set; }
public int ExtraUvNumber { get; set; }
public int VertexIndexSize { get; set; }
public int TextureIndexSize { get; set; }
public int MaterialIndexSize{ get; set; }
public int BoneIndexSize { get; set; }
public int MorphIndexSize { get; set; }
public int RigidBodyIndexSize { get; set; }
}
private abstract class PmxMaterialDrawFlags
{
public const byte PmxMaterialDrawDoubleFace = 0x01;
public const byte PmxMaterialDrawGroundShadow = 0x02;
public const byte PmxMaterialCastSelfShadow = 0x04;
public const byte PmxMaterialDrawSelfShadow = 0x08;
public const byte PmxMaterialDrawEdge = 0x10;
}
private abstract class PmxBoneFlags
{
public const ushort PmxBoneChildUseId = 0x0001;
public const ushort PmxBoneRotatable = 0x0002;
public const ushort PmxBoneMovable = 0x0004;
public const ushort PmxBoneVisible = 0x0008;
public const ushort PmxBoneControllable = 0x0010;
public const ushort PmxBoneHasIk = 0x0020;
public const ushort PmxBoneAcquireRotate = 0x0100;
public const ushort PmxBoneAcquireTranslate = 0x0200;
public const ushort PmxBoneRotAxisFixed = 0x0400;
public const ushort PmxBoneUseLocalAxis = 0x0800;
public const ushort PmxBonePostPhysics = 0x1000;
public const ushort PmxBoneReceiveTransform = 0x2000;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3b0fb3bed9b8b8743bc9152bd6cea3ac
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f16b59dd6d99a5e4fa38e2b672e92353
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 660944cfede8de84d8945cc950ba37f2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1de5827113caaf740b55336c1719eaa1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

@@ -0,0 +1,112 @@
fileFormatVersion: 2
guid: d64ba096e6df12e45a4b226a99353ef2
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

@@ -0,0 +1,112 @@
fileFormatVersion: 2
guid: 255c68c702fc8ff4b8796b43eebc15d5
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

@@ -0,0 +1,112 @@
fileFormatVersion: 2
guid: 32fa5d23e3c479e48a9cbbd0bb690a6f
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

@@ -0,0 +1,112 @@
fileFormatVersion: 2
guid: ec1f8bdff911c8a41b8bed7c8335d4f2
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

@@ -0,0 +1,112 @@
fileFormatVersion: 2
guid: 43591bdde4bdc474492bf0aa6f2e2ae1
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

@@ -0,0 +1,112 @@
fileFormatVersion: 2
guid: 15cbcd5fb2371d041a1097e22d6d1d19
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

@@ -0,0 +1,112 @@
fileFormatVersion: 2
guid: 0ae4097b717681340b3b41b997154405
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

@@ -0,0 +1,112 @@
fileFormatVersion: 2
guid: b32dd17f1a671c245927bd16f85569e1
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

@@ -0,0 +1,112 @@
fileFormatVersion: 2
guid: 8b21f503f5fe1a64cb351891db627bb7
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

@@ -0,0 +1,112 @@
fileFormatVersion: 2
guid: 269ec9a189789e94eb0b75624ac058da
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

@@ -0,0 +1,112 @@
fileFormatVersion: 2
guid: bfe46bb09f22414458a9f626f2f047cc
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 88abb39375d5da0469fb7aeb358ae504
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,145 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &177590
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 417552}
- component: {fileID: 3310420}
- component: {fileID: 114787368994509120}
- component: {fileID: 137932525872769078}
m_Layer: 0
m_Name: MMDGameObject
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &417552
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 177590}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &3310420
MeshFilter:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 177590}
m_Mesh: {fileID: 0}
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 0}
propertyPath: m_CastShadows
value: 1
objectReference: {fileID: 0}
- target: {fileID: 0}
propertyPath: m_StaticEditorFlags
value: 0
objectReference: {fileID: 0}
- target: {fileID: 0}
propertyPath: m_LocalScale.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 0}
propertyPath: m_LocalScale.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 0}
propertyPath: m_LocalScale.z
value: 1
objectReference: {fileID: 0}
- target: {fileID: 0}
propertyPath: m_FadeMode
value: 0
objectReference: {fileID: 0}
- target: {fileID: 0}
propertyPath: m_ReceiveShadows
value: 1
objectReference: {fileID: 0}
- target: {fileID: 0}
propertyPath: m_UseLightProbes
value: 0
objectReference: {fileID: 0}
- target: {fileID: 0}
propertyPath: m_ReflectionProbeUsage
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 177590}
m_IsPrefabParent: 1
--- !u!114 &114787368994509120
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 177590}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9addb051abdb431f8fafe04b8c4388a3, type: 3}
m_Name:
m_EditorClassIdentifier:
AutoPhysicsStepLength: 1
Playing: 0
PhysicsCacheFrameSize: 60
PhysicsMode: 2
--- !u!137 &137932525872769078
SkinnedMeshRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 177590}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_MotionVectors: 1
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_Materials: []
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
serializedVersion: 2
m_Quality: 4
m_UpdateWhenOffscreen: 0
m_SkinnedMotionVectors: 0
m_Mesh: {fileID: 0}
m_Bones: []
m_BlendShapeWeights: []
m_RootBone: {fileID: 0}
m_AABB:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_DirtyAABB: 1
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 70b1f02c41a9a3042b808297ca23f687
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1ef162dda4227e94ab1c4e4e22b46c31
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,56 @@
/*
* MMD Shader for Unity
*
* Copyright 2012 Masataka SUMI, Takahiro INOUE
*
*    Licensed under the Apache License, Version 2.0 (the "License");
*    you may not use this file except in compliance with the License.
*    You may obtain a copy of the License at
*
*        http://www.apache.org/licenses/LICENSE-2.0
*
*    Unless required by applicable law or agreed to in writing, software
*    distributed under the License is distributed on an "AS IS" BASIS,
*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*    See the License for the specific language governing permissions and
*    limitations under the License.
*/
Shader "MMD/PMDMaterial-CullBack-NoCastShadow"
{
Properties
{
_Color("拡散色", Color) = (1,1,1,1)
_SpecularColor("反射色", Color) = (1,1,1)
_AmbColor("環境色", Color) = (1,1,1)
_Shininess("反射強度", Float) = 0
_MainTex("テクスチャ", 2D) = "white" {}
_ToonTex("トゥーン", 2D) = "white" {}
_SphereAddTex("スフィア(加算)", 2D) = "black" {}
_SphereMulTex("スフィア(乗算)", 2D) = "white" {}
}
SubShader
{
// Settings
Tags
{
"ForceNoShadowCasting" = "True"
}
// First Pass
Pass
{
Cull Back
}
// Surface Shader
CGPROGRAM
#pragma surface surf MMD
#pragma multi_compile SELFSHADOW_OFF SELFSHADOW_ON
#include "MeshPmdMaterialSurface.cginc"
ENDCG
}
// Other Environment
Fallback "Diffuse"
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 9c0dae108095f084dac4a04ea82dd207
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,70 @@
/*
* MMD Shader for Unity
*
* Copyright 2012 Masataka SUMI, Takahiro INOUE
*
*    Licensed under the Apache License, Version 2.0 (the "License");
*    you may not use this file except in compliance with the License.
*    You may obtain a copy of the License at
*
*        http://www.apache.org/licenses/LICENSE-2.0
*
*    Unless required by applicable law or agreed to in writing, software
*    distributed under the License is distributed on an "AS IS" BASIS,
*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*    See the License for the specific language governing permissions and
*    limitations under the License.
*/
Shader "MMD/PMDMaterial-CullBack"
{
Properties
{
_Color("拡散色", Color) = (1,1,1,1)
_SpecularColor("反射色", Color) = (1,1,1)
_AmbColor("環境色", Color) = (1,1,1)
_Shininess("反射強度", Float) = 0
_MainTex("テクスチャ", 2D) = "white" {}
_ToonTex("トゥーン", 2D) = "white" {}
_SphereAddTex("スフィア(加算)", 2D) = "black" {}
_SphereMulTex("スフィア(乗算)", 2D) = "white" {}
}
SubShader
{
// First Pass
Pass
{
Cull Back
}
// Surface Shader
CGPROGRAM
#pragma surface surf MMD
#pragma multi_compile SELFSHADOW_OFF SELFSHADOW_ON
#include "MeshPmdMaterialSurface.cginc"
ENDCG
// ShadowCast Pass
Pass
{
Tags
{
"LightMode" = "ShadowCaster"
}
Cull Off
Lighting Off
//Offset [_ShadowBias], [_ShadowBiasSlope] //使えない様なのでコメントアウト
AlphaTest Greater 0.25
CGPROGRAM
#pragma vertex shadow_vert
#pragma fragment shadow_frag
#include "UnityCG.cginc"
#include "MeshPmdMaterialShadowVertFrag.cginc"
ENDCG
}
}
// Other Environment
Fallback "Diffuse"
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: b878465034ca5b84892787cd959ae37f
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,56 @@
/*
* MMD Shader for Unity
*
* Copyright 2012 Masataka SUMI, Takahiro INOUE
*
*    Licensed under the Apache License, Version 2.0 (the "License");
*    you may not use this file except in compliance with the License.
*    You may obtain a copy of the License at
*
*        http://www.apache.org/licenses/LICENSE-2.0
*
*    Unless required by applicable law or agreed to in writing, software
*    distributed under the License is distributed on an "AS IS" BASIS,
*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*    See the License for the specific language governing permissions and
*    limitations under the License.
*/
Shader "MMD/PMDMaterial-NoCastShadow"
{
Properties
{
_Color("拡散色", Color) = (1,1,1,1)
_SpecularColor("反射色", Color) = (1,1,1)
_AmbColor("環境色", Color) = (1,1,1)
_Shininess("反射強度", Float) = 0
_MainTex("テクスチャ", 2D) = "white" {}
_ToonTex("トゥーン", 2D) = "white" {}
_SphereAddTex("スフィア(加算)", 2D) = "black" {}
_SphereMulTex("スフィア(乗算)", 2D) = "white" {}
}
SubShader
{
// Settings
Tags
{
"ForceNoShadowCasting" = "True"
}
// First Pass
Pass
{
Cull Off
}
// Surface Shader
CGPROGRAM
#pragma surface surf MMD
#pragma multi_compile SELFSHADOW_OFF SELFSHADOW_ON
#include "MeshPmdMaterialSurface.cginc"
ENDCG
}
// Other Environment
Fallback "Diffuse"
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 6e4e659cc5a17a64bbd02a96dde31fe6
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,57 @@
/*
* MMD Shader for Unity
*
* Copyright 2012 Masataka SUMI, Takahiro INOUE
*
*    Licensed under the Apache License, Version 2.0 (the "License");
*    you may not use this file except in compliance with the License.
*    You may obtain a copy of the License at
*
*        http://www.apache.org/licenses/LICENSE-2.0
*
*    Unless required by applicable law or agreed to in writing, software
*    distributed under the License is distributed on an "AS IS" BASIS,
*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*    See the License for the specific language governing permissions and
*    limitations under the License.
*/
Shader "MMD/Transparent/PMDMaterial-CullBack-NoCastShadow"
{
Properties
{
_Color("拡散色", Color) = (1,1,1,1)
_Opacity("不透明度", Float) = 1.0
_SpecularColor("反射色", Color) = (1,1,1)
_AmbColor("環境色", Color) = (1,1,1)
_Shininess("反射強度", Float) = 0
_MainTex("テクスチャ", 2D) = "white" {}
_ToonTex("トゥーン", 2D) = "white" {}
_SphereAddTex("スフィア(加算)", 2D) = "black" {}
_SphereMulTex("スフィア(乗算)", 2D) = "white" {}
}
SubShader
{
// Settings
Tags
{
"Queue" = "Geometry+2"
"RenderType" = "Transparent"
}
// Surface Shader
Cull Back
ZWrite On
Blend SrcAlpha OneMinusSrcAlpha
AlphaTest Greater 0.0
CGPROGRAM
#pragma surface surf MMD keepalpha
#pragma multi_compile SELFSHADOW_OFF SELFSHADOW_ON
#include "MeshPmdMaterialSurface.cginc"
ENDCG
}
// Other Environment
Fallback "Transparent/Diffuse"
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: bc3f4ca3abc77df4dbc26041c0c93134
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,77 @@
/*
* MMD Shader for Unity
*
* Copyright 2012 Masataka SUMI, Takahiro INOUE
*
*    Licensed under the Apache License, Version 2.0 (the "License");
*    you may not use this file except in compliance with the License.
*    You may obtain a copy of the License at
*
*        http://www.apache.org/licenses/LICENSE-2.0
*
*    Unless required by applicable law or agreed to in writing, software
*    distributed under the License is distributed on an "AS IS" BASIS,
*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*    See the License for the specific language governing permissions and
*    limitations under the License.
*/
Shader "MMD/Transparent/PMDMaterial-CullBack"
{
Properties
{
_Color("拡散色", Color) = (1,1,1,1)
_Opacity("不透明度", Float) = 1.0
_SpecularColor("反射色", Color) = (1,1,1)
_AmbColor("環境色", Color) = (1,1,1)
_Shininess("反射強度", Float) = 0
_MainTex("テクスチャ", 2D) = "white" {}
_ToonTex("トゥーン", 2D) = "white" {}
_SphereAddTex("スフィア(加算)", 2D) = "black" {}
_SphereMulTex("スフィア(乗算)", 2D) = "white" {}
}
SubShader
{
// Settings
Tags
{
"Queue" = "Geometry+2"
"RenderType" = "Transparent"
}
// Surface Shader
Cull Back
ZWrite On
Blend SrcAlpha OneMinusSrcAlpha
AlphaTest Greater 0.0
CGPROGRAM
#pragma surface surf MMD keepalpha
#pragma multi_compile SELFSHADOW_OFF SELFSHADOW_ON
#include "MeshPmdMaterialSurface.cginc"
ENDCG
// ShadowCast Pass
Pass
{
Tags
{
"LightMode" = "ShadowCaster"
}
Cull Off
Lighting Off
//Offset [_ShadowBias], [_ShadowBiasSlope] //使えない様なのでコメントアウト
AlphaTest Greater 0.25
CGPROGRAM
#pragma vertex shadow_vert
#pragma fragment shadow_frag
#include "UnityCG.cginc"
#include "MeshPmdMaterialShadowVertFrag.cginc"
ENDCG
}
}
// Other Environment
Fallback "Transparent/Diffuse"
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 131572510e2098449ad2c0d3ac4c0221
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,67 @@
/*
* MMD Shader for Unity
*
* Copyright 2012 Masataka SUMI, Takahiro INOUE
*
*    Licensed under the Apache License, Version 2.0 (the "License");
*    you may not use this file except in compliance with the License.
*    You may obtain a copy of the License at
*
*        http://www.apache.org/licenses/LICENSE-2.0
*
*    Unless required by applicable law or agreed to in writing, software
*    distributed under the License is distributed on an "AS IS" BASIS,
*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*    See the License for the specific language governing permissions and
*    limitations under the License.
*/
Shader "MMD/Transparent/PMDMaterial-NoCastShadow"
{
Properties
{
_Color("拡散色", Color) = (1,1,1,1)
_Opacity("不透明度", Float) = 1.0
_SpecularColor("反射色", Color) = (1,1,1)
_AmbColor("環境色", Color) = (1,1,1)
_Shininess("反射強度", Float) = 0
_MainTex("テクスチャ", 2D) = "white" {}
_ToonTex("トゥーン", 2D) = "white" {}
_SphereAddTex("スフィア(加算)", 2D) = "black" {}
_SphereMulTex("スフィア(乗算)", 2D) = "white" {}
}
SubShader
{
// Settings
Tags
{
"Queue" = "Geometry+2"
"RenderType" = "Transparent"
}
// Surface Shader
Cull Front
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
AlphaTest Greater 0.0
CGPROGRAM
#pragma surface surf MMD keepalpha
#pragma multi_compile SELFSHADOW_OFF SELFSHADOW_ON
#include "MeshPmdMaterialSurface.cginc"
ENDCG
// Surface Shader
Cull Back
ZWrite On
Blend SrcAlpha OneMinusSrcAlpha
AlphaTest Greater 0.0
CGPROGRAM
#pragma surface surf MMD keepalpha
#include "MeshPmdMaterialSurface.cginc"
ENDCG
}
// Other Environment
Fallback "Transparent/Diffuse"
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 4d4e93a8f67f71347878527ffa14f1da
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,87 @@
/*
* MMD Shader for Unity
*
* Copyright 2012 Masataka SUMI, Takahiro INOUE
*
*    Licensed under the Apache License, Version 2.0 (the "License");
*    you may not use this file except in compliance with the License.
*    You may obtain a copy of the License at
*
*        http://www.apache.org/licenses/LICENSE-2.0
*
*    Unless required by applicable law or agreed to in writing, software
*    distributed under the License is distributed on an "AS IS" BASIS,
*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*    See the License for the specific language governing permissions and
*    limitations under the License.
*/
Shader "MMD/Transparent/PMDMaterial"
{
Properties
{
_Color("拡散色", Color) = (1,1,1,1)
_Opacity("不透明度", Float) = 1.0
_SpecularColor("反射色", Color) = (1,1,1)
_AmbColor("環境色", Color) = (1,1,1)
_Shininess("反射強度", Float) = 0
_MainTex("テクスチャ", 2D) = "white" {}
_ToonTex("トゥーン", 2D) = "white" {}
_SphereAddTex("スフィア(加算)", 2D) = "black" {}
_SphereMulTex("スフィア(乗算)", 2D) = "white" {}
}
SubShader
{
// Settings
Tags
{
"Queue" = "Geometry+2"
"RenderType" = "Transparent"
}
// Surface Shader
Cull Front
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
AlphaTest Greater 0.0
CGPROGRAM
#pragma surface surf MMD keepalpha
#pragma multi_compile SELFSHADOW_OFF SELFSHADOW_ON
#include "MeshPmdMaterialSurface.cginc"
ENDCG
// Surface Shader
Cull Back
ZWrite On
Blend SrcAlpha OneMinusSrcAlpha
AlphaTest Greater 0.0
CGPROGRAM
#pragma surface surf MMD keepalpha
#include "MeshPmdMaterialSurface.cginc"
ENDCG
// ShadowCast Pass
Pass
{
Tags
{
"LightMode" = "ShadowCaster"
}
Cull Off
Lighting Off
//Offset [_ShadowBias], [_ShadowBiasSlope] //使えない様なのでコメントアウト
AlphaTest Greater 0.25
CGPROGRAM
#pragma vertex shadow_vert
#pragma fragment shadow_frag
#include "UnityCG.cginc"
#include "MeshPmdMaterialShadowVertFrag.cginc"
ENDCG
}
}
// Other Environment
Fallback "Transparent/Diffuse"
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 850c72c94eaa31b45b4ded8ad3951eaf
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,70 @@
/*
* MMD Shader for Unity
*
* Copyright 2012 Masataka SUMI, Takahiro INOUE
*
*    Licensed under the Apache License, Version 2.0 (the "License");
*    you may not use this file except in compliance with the License.
*    You may obtain a copy of the License at
*
*        http://www.apache.org/licenses/LICENSE-2.0
*
*    Unless required by applicable law or agreed to in writing, software
*    distributed under the License is distributed on an "AS IS" BASIS,
*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*    See the License for the specific language governing permissions and
*    limitations under the License.
*/
Shader "MMD/PMDMaterial"
{
Properties
{
_Color("拡散色", Color) = (1,1,1,1)
_SpecularColor("反射色", Color) = (1,1,1)
_AmbColor("環境色", Color) = (1,1,1)
_Shininess("反射強度", Float) = 0
_MainTex("テクスチャ", 2D) = "white" {}
_ToonTex("トゥーン", 2D) = "white" {}
_SphereAddTex("スフィア(加算)", 2D) = "black" {}
_SphereMulTex("スフィア(乗算)", 2D) = "white" {}
}
SubShader
{
// First Pass
Pass
{
Cull Off
}
// Surface Shader
CGPROGRAM
#pragma surface surf MMD
#pragma multi_compile SELFSHADOW_OFF SELFSHADOW_ON
#include "MeshPmdMaterialSurface.cginc"
ENDCG
// ShadowCast Pass
Pass
{
Tags
{
"LightMode" = "ShadowCaster"
}
Cull Off
Lighting Off
//Offset [_ShadowBias], [_ShadowBiasSlope] //使えない様なのでコメントアウト
AlphaTest Greater 0.25
CGPROGRAM
#pragma vertex shadow_vert
#pragma fragment shadow_frag
#include "UnityCG.cginc"
#include "MeshPmdMaterialShadowVertFrag.cginc"
ENDCG
}
}
// Other Environment
Fallback "Diffuse"
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: ec7b78b42916c9b4c894b3e4a3e2f8c0
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,55 @@
/*
* MMD Shader for Unity
*
* Copyright 2012 Masataka SUMI, Takahiro INOUE
*
*    Licensed under the Apache License, Version 2.0 (the "License");
*    you may not use this file except in compliance with the License.
*    You may obtain a copy of the License at
*
*        http://www.apache.org/licenses/LICENSE-2.0
*
*    Unless required by applicable law or agreed to in writing, software
*    distributed under the License is distributed on an "AS IS" BASIS,
*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*    See the License for the specific language governing permissions and
*    limitations under the License.
*/
Shader "MMD/Dummy"
{
Properties
{
_Color("拡散色", Color) = (1,1,1,1)
_Opacity("不透明度", Float) = 1.0
_SpecularColor("反射色", Color) = (1,1,1)
_AmbColor("環境色", Color) = (1,1,1)
_Shininess("反射強度", Float) = 0
_OutlineColor("エッジ色", Color) = (0,0,0,1)
_OutlineWidth("エッジ幅", Range(0,1)) = 0.2
_MainTex("テクスチャ", 2D) = "white" {}
_ToonTex("トゥーン", 2D) = "white" {}
_SphereAddTex("スフィア(加算)", 2D) = "black" {}
_SphereMulTex("スフィア(乗算)", 2D) = "white" {}
_DummyColor("ダミー色", Color) = (1,0,1,1)
_DummyOriginalShaderType("オリジナルシェーダータイプ", Float) = 0
}
SubShader
{
// First Pass
Pass
{
Color[_DummyColor]
Lighting Off
Cull Off
ZWrite On
ZTest LEqual
Offset 0, 0
AlphaTest Greater 0.0
}
}
// Other Environment
Fallback "Diffuse"
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 6e403e015449f7b4ba8c501578489f0c
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,67 @@
/*
* MMD Shader for Unity
*
* Copyright 2012 Masataka SUMI, Takahiro INOUE
*
*    Licensed under the Apache License, Version 2.0 (the "License");
*    you may not use this file except in compliance with the License.
*    You may obtain a copy of the License at
*
*        http://www.apache.org/licenses/LICENSE-2.0
*
*    Unless required by applicable law or agreed to in writing, software
*    distributed under the License is distributed on an "AS IS" BASIS,
*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*    See the License for the specific language governing permissions and
*    limitations under the License.
*/
Shader "MMD/PMDMaterial-with-Outline-CullBack-NoCastShadow"
{
Properties
{
_Color("拡散色", Color) = (1,1,1,1)
_SpecularColor("反射色", Color) = (1,1,1)
_AmbColor("環境色", Color) = (1,1,1)
_Shininess("反射強度", Float) = 0
_OutlineColor("エッジ色", Color) = (0,0,0,1)
_OutlineWidth("エッジ幅", Range(0,1)) = 0.2
_MainTex("テクスチャ", 2D) = "white" {}
_ToonTex("トゥーン", 2D) = "white" {}
_SphereAddTex("スフィア(加算)", 2D) = "black" {}
_SphereMulTex("スフィア(乗算)", 2D) = "white" {}
}
SubShader
{
// Settings
Tags
{
"ForceNoShadowCasting" = "True"
}
// Surface Shader
Cull Back
CGPROGRAM
#pragma surface surf MMD
#pragma multi_compile SELFSHADOW_OFF SELFSHADOW_ON
#include "MeshPmdMaterialSurface.cginc"
ENDCG
// Outline Pass
Pass
{
Cull Front
Lighting Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "MeshPmdMaterialVertFrag.cginc"
ENDCG
}
}
// Other Environment
Fallback "Diffuse"
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 0f3f49635e17095438204bb6b2a66f2c
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,81 @@
/*
* MMD Shader for Unity
*
* Copyright 2012 Masataka SUMI, Takahiro INOUE
*
*    Licensed under the Apache License, Version 2.0 (the "License");
*    you may not use this file except in compliance with the License.
*    You may obtain a copy of the License at
*
*        http://www.apache.org/licenses/LICENSE-2.0
*
*    Unless required by applicable law or agreed to in writing, software
*    distributed under the License is distributed on an "AS IS" BASIS,
*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*    See the License for the specific language governing permissions and
*    limitations under the License.
*/
Shader "MMD/PMDMaterial-with-Outline-CullBack"
{
Properties
{
_Color("拡散色", Color) = (1,1,1,1)
_SpecularColor("反射色", Color) = (1,1,1)
_AmbColor("環境色", Color) = (1,1,1)
_Shininess("反射強度", Float) = 0
_OutlineColor("エッジ色", Color) = (0,0,0,1)
_OutlineWidth("エッジ幅", Range(0,1)) = 0.2
_MainTex("テクスチャ", 2D) = "white" {}
_ToonTex("トゥーン", 2D) = "white" {}
_SphereAddTex("スフィア(加算)", 2D) = "black" {}
_SphereMulTex("スフィア(乗算)", 2D) = "white" {}
}
SubShader
{
// Surface Shader
Cull Back
CGPROGRAM
#pragma surface surf MMD
#pragma multi_compile SELFSHADOW_OFF SELFSHADOW_ON
#include "MeshPmdMaterialSurface.cginc"
ENDCG
// Outline Pass
Pass
{
Cull Front
Lighting Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "MeshPmdMaterialVertFrag.cginc"
ENDCG
}
// ShadowCast Pass
Pass
{
Tags
{
"LightMode" = "ShadowCaster"
}
Cull Off
Lighting Off
//Offset [_ShadowBias], [_ShadowBiasSlope] //使えない様なのでコメントアウト
AlphaTest Greater 0.25
CGPROGRAM
#pragma vertex shadow_vert
#pragma fragment shadow_frag
#include "UnityCG.cginc"
#include "MeshPmdMaterialShadowVertFrag.cginc"
ENDCG
}
}
// Other Environment
Fallback "Diffuse"
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: bfee4751c7c365f4a98e3e1deaaffcf2
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,67 @@
/*
* MMD Shader for Unity
*
* Copyright 2012 Masataka SUMI, Takahiro INOUE
*
*    Licensed under the Apache License, Version 2.0 (the "License");
*    you may not use this file except in compliance with the License.
*    You may obtain a copy of the License at
*
*        http://www.apache.org/licenses/LICENSE-2.0
*
*    Unless required by applicable law or agreed to in writing, software
*    distributed under the License is distributed on an "AS IS" BASIS,
*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*    See the License for the specific language governing permissions and
*    limitations under the License.
*/
Shader "MMD/PMDMaterial-with-Outline-NoCastShadow"
{
Properties
{
_Color("拡散色", Color) = (1,1,1,1)
_SpecularColor("反射色", Color) = (1,1,1)
_AmbColor("環境色", Color) = (1,1,1)
_Shininess("反射強度", Float) = 0
_OutlineColor("エッジ色", Color) = (0,0,0,1)
_OutlineWidth("エッジ幅", Range(0,1)) = 0.2
_MainTex("テクスチャ", 2D) = "white" {}
_ToonTex("トゥーン", 2D) = "white" {}
_SphereAddTex("スフィア(加算)", 2D) = "black" {}
_SphereMulTex("スフィア(乗算)", 2D) = "white" {}
}
SubShader
{
// Settings
Tags
{
"ForceNoShadowCasting" = "True"
}
// Surface Shader
Cull Off
CGPROGRAM
#pragma surface surf MMD
#pragma multi_compile SELFSHADOW_OFF SELFSHADOW_ON
#include "MeshPmdMaterialSurface.cginc"
ENDCG
// Outline Pass
Pass
{
Cull Front
Lighting Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "MeshPmdMaterialVertFrag.cginc"
ENDCG
}
}
// Other Environment
Fallback "Diffuse"
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: d36802937c7c6ea45b93a5032211415f
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,72 @@
/*
* MMD Shader for Unity
*
* Copyright 2012 Masataka SUMI, Takahiro INOUE
*
*    Licensed under the Apache License, Version 2.0 (the "License");
*    you may not use this file except in compliance with the License.
*    You may obtain a copy of the License at
*
*        http://www.apache.org/licenses/LICENSE-2.0
*
*    Unless required by applicable law or agreed to in writing, software
*    distributed under the License is distributed on an "AS IS" BASIS,
*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*    See the License for the specific language governing permissions and
*    limitations under the License.
*/
Shader "MMD/Transparent/PMDMaterial-with-Outline-CullBack-NoCastShadow"
{
Properties
{
_Color("拡散色", Color) = (1,1,1,1)
_Opacity("不透明度", Float) = 1.0
_SpecularColor("反射色", Color) = (1,1,1)
_AmbColor("環境色", Color) = (1,1,1)
_Shininess("反射強度", Float) = 0
_OutlineColor("エッジ色", Color) = (0,0,0,1)
_OutlineWidth("エッジ幅", Range(0,1)) = 0.2
_MainTex("テクスチャ", 2D) = "white" {}
_ToonTex("トゥーン", 2D) = "white" {}
_SphereAddTex("スフィア(加算)", 2D) = "black" {}
_SphereMulTex("スフィア(乗算)", 2D) = "white" {}
}
SubShader
{
// Settings
Tags
{
"Queue" = "Geometry+2"
"RenderType" = "Transparent"
}
// Surface Shader Pass
Cull Back
ZWrite On
Blend SrcAlpha OneMinusSrcAlpha
AlphaTest Greater 0.0
CGPROGRAM
#pragma surface surf MMD keepalpha
#pragma multi_compile SELFSHADOW_OFF SELFSHADOW_ON
#include "MeshPmdMaterialSurface.cginc"
ENDCG
// Outline Pass
Pass
{
Cull Front
Lighting Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "MeshPmdMaterialVertFrag.cginc"
ENDCG
}
}
// Other Environment
Fallback "Transparent/Diffuse"
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 22dcf7f6054975948a2561f9cc3113a5
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,92 @@
/*
* MMD Shader for Unity
*
* Copyright 2012 Masataka SUMI, Takahiro INOUE
*
*    Licensed under the Apache License, Version 2.0 (the "License");
*    you may not use this file except in compliance with the License.
*    You may obtain a copy of the License at
*
*        http://www.apache.org/licenses/LICENSE-2.0
*
*    Unless required by applicable law or agreed to in writing, software
*    distributed under the License is distributed on an "AS IS" BASIS,
*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*    See the License for the specific language governing permissions and
*    limitations under the License.
*/
Shader "MMD/Transparent/PMDMaterial-with-Outline-CullBack"
{
Properties
{
_Color("拡散色", Color) = (1,1,1,1)
_Opacity("不透明度", Float) = 1.0
_SpecularColor("反射色", Color) = (1,1,1)
_AmbColor("環境色", Color) = (1,1,1)
_Shininess("反射強度", Float) = 0
_OutlineColor("エッジ色", Color) = (0,0,0,1)
_OutlineWidth("エッジ幅", Range(0,1)) = 0.2
_MainTex("テクスチャ", 2D) = "white" {}
_ToonTex("トゥーン", 2D) = "white" {}
_SphereAddTex("スフィア(加算)", 2D) = "black" {}
_SphereMulTex("スフィア(乗算)", 2D) = "white" {}
}
SubShader
{
// Settings
Tags
{
"Queue" = "Geometry+2"
"RenderType" = "Transparent"
}
// Surface Shader Pass
Cull Back
ZWrite On
Blend SrcAlpha OneMinusSrcAlpha
AlphaTest Greater 0.0
CGPROGRAM
#pragma surface surf MMD alpha keepalpha
#pragma multi_compile SELFSHADOW_OFF SELFSHADOW_ON
#include "MeshPmdMaterialSurface.cginc"
ENDCG
// Outline Pass
Pass
{
Cull Front
Lighting Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "MeshPmdMaterialVertFrag.cginc"
ENDCG
}
// ShadowCast Pass
Pass
{
Tags
{
"LightMode" = "ShadowCaster"
}
Cull Off
Lighting Off
//Offset [_ShadowBias], [_ShadowBiasSlope] //使えない様なのでコメントアウト
AlphaTest Greater 0.25
CGPROGRAM
#pragma vertex shadow_vert
#pragma fragment shadow_frag
#include "UnityCG.cginc"
#include "MeshPmdMaterialShadowVertFrag.cginc"
ENDCG
}
}
// Other Environment
Fallback "Transparent/Diffuse"
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: fd87ac48bd4e44349a164ed7c5b12494
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,82 @@
/*
* MMD Shader for Unity
*
* Copyright 2012 Masataka SUMI, Takahiro INOUE
*
*    Licensed under the Apache License, Version 2.0 (the "License");
*    you may not use this file except in compliance with the License.
*    You may obtain a copy of the License at
*
*        http://www.apache.org/licenses/LICENSE-2.0
*
*    Unless required by applicable law or agreed to in writing, software
*    distributed under the License is distributed on an "AS IS" BASIS,
*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*    See the License for the specific language governing permissions and
*    limitations under the License.
*/
Shader "MMD/Transparent/PMDMaterial-with-Outline-NoCastShadow"
{
Properties
{
_Color("拡散色", Color) = (1,1,1,1)
_Opacity("不透明度", Float) = 1.0
_SpecularColor("反射色", Color) = (1,1,1)
_AmbColor("環境色", Color) = (1,1,1)
_Shininess("反射強度", Float) = 0
_OutlineColor("エッジ色", Color) = (0,0,0,1)
_OutlineWidth("エッジ幅", Range(0,1)) = 0.2
_MainTex("テクスチャ", 2D) = "white" {}
_ToonTex("トゥーン", 2D) = "white" {}
_SphereAddTex("スフィア(加算)", 2D) = "black" {}
_SphereMulTex("スフィア(乗算)", 2D) = "white" {}
}
SubShader
{
// Settings
Tags
{
"Queue" = "Geometry+2"
"RenderType" = "Transparent"
}
// Surface Shader Pass ( Back )
Cull Front
ZWrite On
Blend SrcAlpha OneMinusSrcAlpha
AlphaTest Greater 0.0
CGPROGRAM
#pragma surface surf MMD keepalpha
#pragma multi_compile SELFSHADOW_OFF SELFSHADOW_ON
#include "MeshPmdMaterialSurface.cginc"
ENDCG
// Surface Shader Pass
Cull Back
ZWrite On
Blend SrcAlpha OneMinusSrcAlpha
AlphaTest Greater 0.0
CGPROGRAM
#pragma surface surf MMD keepalpha
#include "MeshPmdMaterialSurface.cginc"
ENDCG
// Outline Pass
Pass
{
Cull Front
Lighting Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "MeshPmdMaterialVertFrag.cginc"
ENDCG
}
}
// Other Environment
Fallback "Transparent/Diffuse"
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 7dd9e14aec0d8a34085ea0307e35d348
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

Some files were not shown because too many files have changed in this diff Show More