Shader "Custom/Shader_VertexColor" {
Properties {
_MainTex ("Albedo", 2D) = "white" { }
_Color ("Color" , Color ) = (1, 1, 1, 1)
_Metallic ("Metallic" , Range(0, 1)) = 0.0
_Glossiness ("Smoothness", Range(0, 1)) = 0.5
_Occlusion ("Occlusion" , Range(0, 1)) = 1.0
_BumpScale ("Scale", Float) = 1
_BumpMap ("Normal Map", 2D) = "bump" { }
_DetailAlbedoMap("Detail Albedo x2", 2D) = "white" {}
_DetailNormalMapScale("Scale", Float) = 1.0
_DetailNormalMap("Normal Map", 2D) = "bump" {}
_DetailMask("Detail Mask", 2D) = "white" {}
}
SubShader {
Tags {
"Queue" = "Geometry"
"RenderType" = "Opaque"
}
CGPROGRAM
#pragma target 3.0
#pragma surface surf Standard fullforwardshadows
fixed4 _Color;
sampler2D _MainTex;
sampler2D _BumpMap;
sampler2D _DetailAlbedoMap;
sampler2D _DetailNormalMap;
sampler2D _DetailMask;
half _BumpScale;
half _Glossiness;
half _Metallic;
half _Occlusion;
half _DetailNormalMapScale;
struct Input {
float2 uv_MainTex;
float2 uv2_DetailAlbedoMap;
fixed4 color : COLOR;
};
void surf (Input IN, inout SurfaceOutputStandard o) {
fixed4 c1 = tex2D(_MainTex, IN.uv_MainTex) * _Color;
fixed4 c2 = tex2D(_DetailAlbedoMap, IN.uv2_DetailAlbedoMap) * _Color;
fixed4 m = tex2D(_DetailMask, IN.uv_MainTex);
o.Albedo = lerp(c1, c2, m) * lerp(1, IN.color, _Occlusion);
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
fixed3 n = UnpackScaleNormal(tex2D(_BumpMap, IN.uv_MainTex), _BumpScale);
fixed3 n2 = UnpackScaleNormal(tex2D(_DetailNormalMap, IN.uv2_DetailAlbedoMap), _DetailNormalMapScale);
o.Normal= BlendNormals(n, n2);
}
ENDCG
}
FallBack "Diffuse"
}
using System;
using MSCLoader;
using UnityEngine;
using Object = System.Object;
namespace NSR50
{
public class NSR50 : Mod
{
public override string ID => "g_NSR50"; //Your mod ID (unique)
public override string Name => "g_NSR50"; //You mod name
public override string Author => "gosuke"; //Your Username
public override string Version => "1.0"; //Version
// Set this to true if you will be load custom assets from Assets folder.
// This will create subfolder in Assets folder for your mod.
public override bool UseAssetsFolder
{
get
{
return true;
}
}
public override void OnNewGame()
{
// Called once, when starting a New Game, you can reset your saves here
}
public override void OnLoad()
{
// Called once, when mod is loading after game is fully loaded
//アセットの読み込み
this.ab = LoadAssets.LoadBundle(this, "nsr50.unity3d");
//メッシュの読み込み
this.frame = this.ab.LoadAsset("frame.fbx") as GameObject;
//マテリアルの読み込み
this.nsrMat = this.ab.LoadAsset("nsrMat.mat") as Material;
this.ab.Unload(false);
this.frame = UnityEngine.Object.Instantiate<GameObject>(this.frame);
UnityEngine.Object.Destroy(this.frame);
//メッシュの置き換え
GameObject.Find("JONNEZ ES(Clone)/MESH/frame").GetComponent<MeshFilter>().sharedMesh = this.frame.GetComponentInChildren<MeshFilter>().sharedMesh;
//マテリアルの置き換え
GameObject.Find("JONNEZ ES(Clone)/MESH/frame").GetComponent<MeshRenderer>().sharedMaterial = this.nsrMat;
//位置・向き・スケールの設定
GameObject.Find("JONNEZ ES(Clone)/MESH/frame").transform.localPosition = new Vector3(0f, 0f, 0f);
GameObject.Find("JONNEZ ES(Clone)/MESH/frame").transform.localEulerAngles = new Vector3(0f, 0f, 0f);
GameObject.Find("JONNEZ ES(Clone)/MESH/frame").transform.localScale = new Vector3(1f, 1f, 1f);
}
private AssetBundle ab;
private GameObject frame;
private Material nsrMat;
}
}
Shader "Custom/Shader_VertexColor" {
Properties {
_MainTex ("Albedo", 2D) = "white" { }
_Color ("Color" , Color ) = (1, 1, 1, 1)
_Metallic ("Metallic" , Range(0, 1)) = 0.0
_Glossiness ("Smoothness", Range(0, 1)) = 0.5
_Occlusion ("Occlusion" , Range(0, 1)) = 1.0
_BumpScale ("Scale", Float) = 1
_BumpMap ("Normal Map", 2D) = "bump" { }
}
SubShader {
Tags {
"Queue" = "Geometry"
"RenderType" = "Opaque"
}
CGPROGRAM
#pragma target 3.0
#pragma surface surf Standard fullforwardshadows
fixed4 _Color;
sampler2D _MainTex;
sampler2D _BumpMap;
half _BumpScale;
half _Glossiness;
half _Metallic;
half _Occlusion;
struct Input {
float2 uv_MainTex;
fixed4 color : COLOR;
};
void surf (Input IN, inout SurfaceOutputStandard o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb * lerp(1, IN.color, _Occlusion);
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
fixed4 n = tex2D(_BumpMap, IN.uv_MainTex);
o.Normal = UnpackScaleNormal(n, _BumpScale);
}
ENDCG
}
FallBack "Diffuse"
}
-popupwindow