导入技术美术特效
This commit is contained in:
parent
b69bee2a61
commit
e42fa3efbf
8
Assets/Render/SpecialMaterials/JingTi.meta
Normal file
8
Assets/Render/SpecialMaterials/JingTi.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a0facaea376a17b418e34534036830f6
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
8
Assets/Render/SpecialMaterials/JingTi/Bur.meta
Normal file
8
Assets/Render/SpecialMaterials/JingTi/Bur.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3876ef4e688a9824caaf4112d4e189b5
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
132
Assets/Render/SpecialMaterials/JingTi/Bur/Bur.shader
Normal file
132
Assets/Render/SpecialMaterials/JingTi/Bur/Bur.shader
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
Shader "Unlit URP Shader/Bur"
|
||||||
|
{
|
||||||
|
Properties
|
||||||
|
{
|
||||||
|
_BaseColor("Base Color",color) = (1,1,1,1)
|
||||||
|
//_BaseMap("BaseMap", 2D) = "white" {}
|
||||||
|
_MainTex("MainTex",2d)="white"{}
|
||||||
|
//_Value("Value", Float) = 1
|
||||||
|
}
|
||||||
|
HLSLINCLUDE
|
||||||
|
#pragma multi_compile _ LIGHTMAP_ON
|
||||||
|
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS //接受主光源阴影
|
||||||
|
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE //投射主光源的阴影
|
||||||
|
#pragma multi_compile _ _SHADOWS_SOFT //软阴影
|
||||||
|
#pragma multi_compile _ _ADDITIONAL_LIGHTS //附加光源
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||||
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
struct Attributes
|
||||||
|
{
|
||||||
|
float4 positionOS : POSITION;
|
||||||
|
float2 uv : TEXCOORD0;
|
||||||
|
float3 normal:NORMAL;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Varyings
|
||||||
|
{
|
||||||
|
float4 positionCS : SV_POSITION;
|
||||||
|
float2 uv : TEXCOORD0;
|
||||||
|
float3 Wnormal : TEXCOORD1;
|
||||||
|
float3 Wpos:TEXCOORD2;
|
||||||
|
};
|
||||||
|
|
||||||
|
CBUFFER_START(UnityPerMaterial)
|
||||||
|
half4 _BaseColor;
|
||||||
|
float4 _MainTex_TexelSize;
|
||||||
|
float4 _BaseMap_ST;
|
||||||
|
float _Value;
|
||||||
|
float2 HorV;
|
||||||
|
CBUFFER_END
|
||||||
|
TEXTURE2D (_MainTex);SAMPLER(sampler_MainTex);
|
||||||
|
//TEXTURE2D (_CameraOpaqueTexture);SAMPLER(sampler_CameraOpaqueTexture);
|
||||||
|
|
||||||
|
Varyings vert(Attributes v)
|
||||||
|
{
|
||||||
|
Varyings o = (Varyings)0;
|
||||||
|
|
||||||
|
o.positionCS = TransformObjectToHClip(v.positionOS.xyz);
|
||||||
|
o.uv = TRANSFORM_TEX(v.uv, _BaseMap);
|
||||||
|
o.Wpos = TransformObjectToWorld(v.positionOS);
|
||||||
|
o.Wnormal=TransformObjectToWorldNormal(v.normal);
|
||||||
|
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
half4 fragHorV(Varyings i) : SV_Target
|
||||||
|
{
|
||||||
|
float2 offset=_MainTex_TexelSize.xy;
|
||||||
|
half4 c;
|
||||||
|
float2 uv=i.positionCS.xy/_ScreenParams.xy;
|
||||||
|
half4 baseMap = 0.4*SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex,uv);
|
||||||
|
c = baseMap ;//* _BaseColor;
|
||||||
|
{
|
||||||
|
c+= 0.15*SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex,uv+offset*1*_Value*HorV);
|
||||||
|
c+= 0.15*SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex,uv+offset*-2*_Value*HorV);
|
||||||
|
c+= 0.10 *SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex,uv+offset*2*_Value*HorV);
|
||||||
|
c+= 0.10 *SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex,uv+offset*-2*_Value*HorV);
|
||||||
|
c+= 0.05 *SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex,uv+offset*3*_Value*HorV);
|
||||||
|
c+= 0.05 *SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex,uv+offset*-3*_Value*HorV);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
half4 fragBur(Varyings i) : SV_Target
|
||||||
|
{
|
||||||
|
float2 offset=_MainTex_TexelSize.xy;
|
||||||
|
|
||||||
|
half4 c=half4(0,0,0,0);
|
||||||
|
float2 uv=i.positionCS.xy/_ScreenParams.xy;
|
||||||
|
//c = baseMap ;//* _BaseColor;
|
||||||
|
{
|
||||||
|
float f=0.4;
|
||||||
|
c+= SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex,uv+offset*float2(1,1)*_Value*f);
|
||||||
|
c+= SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex,uv+offset*float2(-1,1)*_Value*f);
|
||||||
|
c+= SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex,uv+offset*float2(1,-1)*_Value*f);
|
||||||
|
c+= SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex,uv+offset*float2(-1,-1)*_Value*f);
|
||||||
|
|
||||||
|
c+= SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex,uv+offset*float2(2,2)*_Value*f);
|
||||||
|
c+= SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex,uv+offset*float2(-2,2)*_Value*f);
|
||||||
|
c+= SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex,uv+offset*float2(2,-2)*_Value*f);
|
||||||
|
c+= SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex,uv+offset*float2(-2,-2)*_Value*f);
|
||||||
|
c/=8;
|
||||||
|
}
|
||||||
|
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
ENDHLSL
|
||||||
|
SubShader
|
||||||
|
{
|
||||||
|
Tags { "Queue"="Transparent" "RenderType" = "Transparent" "RenderPipeline" = "UniversalPipeline" }
|
||||||
|
ZTest Always
|
||||||
|
Cull Off
|
||||||
|
LOD 100
|
||||||
|
//高斯模糊
|
||||||
|
Pass
|
||||||
|
{
|
||||||
|
Tags {"LightMode" = "UniversalForward"}
|
||||||
|
HLSLPROGRAM
|
||||||
|
#pragma vertex vert
|
||||||
|
#pragma fragment fragHorV
|
||||||
|
ENDHLSL
|
||||||
|
}
|
||||||
|
//快速模糊
|
||||||
|
Pass
|
||||||
|
{
|
||||||
|
Tags {"LightMode" = "UniversalForward"}
|
||||||
|
HLSLPROGRAM
|
||||||
|
#pragma vertex vert
|
||||||
|
#pragma fragment fragBur
|
||||||
|
|
||||||
|
ENDHLSL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
10
Assets/Render/SpecialMaterials/JingTi/Bur/Bur.shader.meta
Normal file
10
Assets/Render/SpecialMaterials/JingTi/Bur/Bur.shader.meta
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ab89475eab71d344eb252d7e2828add6
|
||||||
|
ShaderImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
defaultTextures: []
|
||||||
|
nonModifiableTextures: []
|
||||||
|
preprocessorOverride: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -0,0 +1,96 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Rendering;
|
||||||
|
using UnityEngine.Rendering.Universal;
|
||||||
|
|
||||||
|
public class BurRenderPassFeature : ScriptableRendererFeature
|
||||||
|
{
|
||||||
|
public float Value=1;
|
||||||
|
class BurRenderPass : ScriptableRenderPass
|
||||||
|
{
|
||||||
|
public float Value;
|
||||||
|
private readonly int BurTexture = Shader.PropertyToID("_BurTexture");
|
||||||
|
private readonly int BurTemp = Shader.PropertyToID("BurTemp");
|
||||||
|
private Material mat;
|
||||||
|
private Vector4 H = new Vector4(1, 0, 0, 0);
|
||||||
|
private Vector4 V = new Vector4(0, 1, 0, 0);
|
||||||
|
|
||||||
|
// This method is called before executing the render pass.
|
||||||
|
// It can be used to configure render targets and their clear state. Also to create temporary render target textures.
|
||||||
|
// When empty this render pass will render to the active camera render target.
|
||||||
|
// You should never call CommandBuffer.SetRenderTarget. Instead call <c>ConfigureTarget</c> and <c>ConfigureClear</c>.
|
||||||
|
// The render pipeline will ensure target setup and clearing happens in a performant manner.
|
||||||
|
public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData)
|
||||||
|
{
|
||||||
|
if (mat == null) mat = CoreUtils.CreateEngineMaterial("Unlit URP Shader/Bur");
|
||||||
|
//if(bur==null)
|
||||||
|
//var dp = renderingData.cameraData.cameraTargetDescriptor;
|
||||||
|
//dp.msaaSamples = 1;
|
||||||
|
//cmd.GetTemporaryRT(BurTexture, dp);
|
||||||
|
//bur = RTHandles.Alloc(BurTexture);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Here you can implement the rendering logic.
|
||||||
|
// Use <c>ScriptableRenderContext</c> to issue drawing commands or execute command buffers
|
||||||
|
// https://docs.unity3d.com/ScriptReference/Rendering.ScriptableRenderContext.html
|
||||||
|
// You don't have to call ScriptableRenderContext.submit, the render pipeline will call it at specific points in the pipeline.
|
||||||
|
public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
|
||||||
|
{
|
||||||
|
CommandBuffer cmd = CommandBufferPool.Get("Bur");
|
||||||
|
var dp = renderingData.cameraData.cameraTargetDescriptor;
|
||||||
|
dp.msaaSamples = 1;
|
||||||
|
|
||||||
|
cmd.GetTemporaryRT(BurTemp, dp);
|
||||||
|
cmd.GetTemporaryRT(BurTexture, dp);
|
||||||
|
|
||||||
|
//mat.SetFloat("_Value",Value);
|
||||||
|
cmd.SetGlobalVector("HorV",H);
|
||||||
|
cmd.Blit(renderingData.cameraData.renderer.cameraColorTarget,BurTexture,mat,0);
|
||||||
|
cmd.SetGlobalVector("HorV",V);
|
||||||
|
cmd.Blit(BurTexture,BurTemp,mat,0);
|
||||||
|
cmd.Blit(BurTemp,BurTexture,mat,1);
|
||||||
|
cmd.SetRenderTarget(renderingData.cameraData.renderer.cameraColorTarget);
|
||||||
|
cmd.ReleaseTemporaryRT(BurTemp);
|
||||||
|
cmd.ReleaseTemporaryRT(BurTexture);
|
||||||
|
|
||||||
|
context.ExecuteCommandBuffer(cmd);
|
||||||
|
cmd.Release();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cleanup any allocated resources that were created during the execution of this render pass.
|
||||||
|
public override void OnCameraCleanup(CommandBuffer cmd)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Disop()
|
||||||
|
{
|
||||||
|
if(mat!=null)
|
||||||
|
CoreUtils.Destroy(mat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BurRenderPass m_ScriptablePass;
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public override void Create()
|
||||||
|
{
|
||||||
|
m_ScriptablePass = new BurRenderPass();
|
||||||
|
|
||||||
|
// Configures where the render pass should be injected.
|
||||||
|
m_ScriptablePass.renderPassEvent = RenderPassEvent.BeforeRenderingPostProcessing;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Here you can inject one or multiple render passes in the renderer.
|
||||||
|
// This method is called when setting up the renderer once per-camera.
|
||||||
|
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
|
||||||
|
{
|
||||||
|
m_ScriptablePass.Value = Value;
|
||||||
|
renderer.EnqueuePass(m_ScriptablePass);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
m_ScriptablePass.Disop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b2175cb1f6f57794ea63d290dbaf906d
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
20
Assets/Render/SpecialMaterials/JingTi/Bur/BurValue.cs
Normal file
20
Assets/Render/SpecialMaterials/JingTi/Bur/BurValue.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
[ExecuteAlways]
|
||||||
|
public class BurValue : MonoBehaviour
|
||||||
|
{
|
||||||
|
[Range(0,10)]public float Value;
|
||||||
|
// Start is called before the first frame update
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
Shader.SetGlobalFloat("_Value",Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Render/SpecialMaterials/JingTi/Bur/BurValue.cs.meta
Normal file
11
Assets/Render/SpecialMaterials/JingTi/Bur/BurValue.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1a875baee8e85d24a8addec970f2485a
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!21 &2100000
|
||||||
|
Material:
|
||||||
|
serializedVersion: 8
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: Unlit URP Shader_sampbur
|
||||||
|
m_Shader: {fileID: 4800000, guid: dedbc0fc0ecaf744fb075c715a940c87, type: 3}
|
||||||
|
m_ValidKeywords: []
|
||||||
|
m_InvalidKeywords: []
|
||||||
|
m_LightmapFlags: 4
|
||||||
|
m_EnableInstancingVariants: 0
|
||||||
|
m_DoubleSidedGI: 0
|
||||||
|
m_CustomRenderQueue: -1
|
||||||
|
stringTagMap: {}
|
||||||
|
disabledShaderPasses: []
|
||||||
|
m_SavedProperties:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TexEnvs:
|
||||||
|
- _BaseMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
m_Ints: []
|
||||||
|
m_Floats: []
|
||||||
|
m_Colors:
|
||||||
|
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
m_BuildTextureStacks: []
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f7336ae76112887468c35a66492667c3
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 2100000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
95
Assets/Render/SpecialMaterials/JingTi/Bur/sampbur.shader
Normal file
95
Assets/Render/SpecialMaterials/JingTi/Bur/sampbur.shader
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
Shader "Unlit URP Shader/sampbur"
|
||||||
|
{
|
||||||
|
Properties
|
||||||
|
{
|
||||||
|
_BaseColor("Base Color",color) = (1,1,1,1)
|
||||||
|
_BaseMap("BaseMap", 2D) = "white" {}
|
||||||
|
}
|
||||||
|
|
||||||
|
SubShader
|
||||||
|
{
|
||||||
|
Tags { "Queue"="Geometry" "RenderType" = "Opaque" "RenderPipeline" = "UniversalPipeline" }
|
||||||
|
LOD 100
|
||||||
|
|
||||||
|
Pass
|
||||||
|
{
|
||||||
|
Tags {"LightMode" = "UniversalForward"}
|
||||||
|
HLSLPROGRAM
|
||||||
|
// Required to compile gles 2.0 with standard srp library
|
||||||
|
#pragma prefer_hlslcc gles
|
||||||
|
#pragma exclude_renderers d3d11_9x
|
||||||
|
|
||||||
|
#pragma multi_compile _ LIGHTMAP_ON
|
||||||
|
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS //接受主光源阴影
|
||||||
|
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE //投射主光源的阴影
|
||||||
|
#pragma multi_compile _ _SHADOWS_SOFT //软阴影
|
||||||
|
#pragma multi_compile _ _ADDITIONAL_LIGHTS //附加光源
|
||||||
|
|
||||||
|
#pragma vertex vert
|
||||||
|
#pragma fragment frag
|
||||||
|
|
||||||
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||||
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
struct Attributes
|
||||||
|
{
|
||||||
|
float4 positionOS : POSITION;
|
||||||
|
float2 uv : TEXCOORD0;
|
||||||
|
float3 normal:NORMAL;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Varyings
|
||||||
|
{
|
||||||
|
float4 positionCS : SV_POSITION;
|
||||||
|
float2 uv : TEXCOORD0;
|
||||||
|
float3 Wnormal : TEXCOORD1;
|
||||||
|
float3 Wpos:TEXCOORD2;
|
||||||
|
};
|
||||||
|
|
||||||
|
CBUFFER_START(UnityPerMaterial)
|
||||||
|
half4 _BaseColor;
|
||||||
|
float4 _BaseMap_ST;
|
||||||
|
CBUFFER_END
|
||||||
|
TEXTURE2D (_BurTexture);SAMPLER(sampler_BurTexture);
|
||||||
|
|
||||||
|
|
||||||
|
Varyings vert(Attributes v)
|
||||||
|
{
|
||||||
|
Varyings o = (Varyings)0;
|
||||||
|
|
||||||
|
o.positionCS = TransformObjectToHClip(v.positionOS.xyz);
|
||||||
|
o.uv = TRANSFORM_TEX(v.uv, _BaseMap);
|
||||||
|
o.Wpos = TransformObjectToWorld(v.positionOS);
|
||||||
|
o.Wnormal=TransformObjectToWorldNormal(v.normal);
|
||||||
|
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
half4 frag(Varyings i) : SV_Target
|
||||||
|
{
|
||||||
|
float3 N=normalize(i.Wnormal);
|
||||||
|
float3 V=normalize(_WorldSpaceCameraPos.xyz-i.Wpos.xyz);
|
||||||
|
float2 uv=i.positionCS.xy/_ScreenParams.xy;
|
||||||
|
half4 c;
|
||||||
|
half4 baseMap = SAMPLE_TEXTURE2D(_BurTexture, sampler_BurTexture, uv);
|
||||||
|
c = baseMap * _BaseColor;
|
||||||
|
//c.rgb = MixFog(c.rgb, i.fogCoord);
|
||||||
|
float _Me=0.6;//干净的透明玻璃漫反射少,所以金属度直接拉满
|
||||||
|
|
||||||
|
//间接高光和漫反射
|
||||||
|
float aa=1;
|
||||||
|
BRDFData brdfData;
|
||||||
|
InitializeBRDFData(c,_Me,1,1,aa, brdfData);
|
||||||
|
half3 ambient_contrib = SampleSH(float4(N, 1));
|
||||||
|
float3 ambient = 0.3 * c;// 随便乘个暗的系数
|
||||||
|
float3 iblDiffuse = max(half3(0, 0, 0), ambient.rgb + ambient_contrib);
|
||||||
|
float3 inssp= GlobalIllumination(brdfData,iblDiffuse,1,i.Wpos,N,V);
|
||||||
|
c.rgb+=inssp*0.5;
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
ENDHLSL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: dedbc0fc0ecaf744fb075c715a940c87
|
||||||
|
ShaderImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
defaultTextures: []
|
||||||
|
nonModifiableTextures: []
|
||||||
|
preprocessorOverride: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
8
Assets/Render/SpecialMaterials/JingTi/YvShi.meta
Normal file
8
Assets/Render/SpecialMaterials/JingTi/YvShi.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d185642e79220d4428dce0ee5f6e9000
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
8
Assets/Render/SpecialMaterials/JingTi/YvShi/sources.meta
Normal file
8
Assets/Render/SpecialMaterials/JingTi/YvShi/sources.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ed418064695901b48b5932ab6d0781bd
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
117
Assets/Render/SpecialMaterials/JingTi/YvShi/sources/SSS.shader
Normal file
117
Assets/Render/SpecialMaterials/JingTi/YvShi/sources/SSS.shader
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
Shader "Unlit URP Shader"
|
||||||
|
{
|
||||||
|
Properties
|
||||||
|
{
|
||||||
|
_BaseColor("Base Color",color) = (1,1,1,1)
|
||||||
|
_BaseMap("BaseMap", 2D) = "white" {}
|
||||||
|
_Thickness("Thickness",2D)="white"{}
|
||||||
|
_MatCap("MatCap",2D)="white"{}
|
||||||
|
|
||||||
|
_NormalDistortion("NormalDistortion",Range(0.1,5))=1
|
||||||
|
_SSSPower("SSSPower",Range(0.1,5))=1
|
||||||
|
_SSSScale("_SSSScale",Range(0.1,5))=1
|
||||||
|
}
|
||||||
|
|
||||||
|
SubShader
|
||||||
|
{
|
||||||
|
Tags { "Queue"="Geometry" "RenderType" = "Opaque" "RenderPipeline" = "UniversalPipeline" }
|
||||||
|
LOD 100
|
||||||
|
|
||||||
|
Pass
|
||||||
|
{
|
||||||
|
Tags {"LightMode" = "UniversalForward"}
|
||||||
|
HLSLPROGRAM
|
||||||
|
// Required to compile gles 2.0 with standard srp library
|
||||||
|
#pragma prefer_hlslcc gles
|
||||||
|
#pragma exclude_renderers d3d11_9x
|
||||||
|
|
||||||
|
#pragma multi_compile _ LIGHTMAP_ON
|
||||||
|
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS //接受主光源阴影
|
||||||
|
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE //投射主光源的阴影
|
||||||
|
#pragma multi_compile _ _SHADOWS_SOFT //软阴影
|
||||||
|
#pragma multi_compile _ _ADDITIONAL_LIGHTS //附加光源
|
||||||
|
|
||||||
|
#pragma vertex vert
|
||||||
|
#pragma fragment frag
|
||||||
|
|
||||||
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||||
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
struct Attributes
|
||||||
|
{
|
||||||
|
float4 positionOS : POSITION;
|
||||||
|
float2 uv : TEXCOORD0;
|
||||||
|
float3 normal:NORMAL;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Varyings
|
||||||
|
{
|
||||||
|
float4 positionCS : SV_POSITION;
|
||||||
|
float2 uv : TEXCOORD0;
|
||||||
|
float3 Wnormal : TEXCOORD1;
|
||||||
|
float3 Wpos:TEXCOORD2;
|
||||||
|
};
|
||||||
|
|
||||||
|
CBUFFER_START(UnityPerMaterial)
|
||||||
|
half4 _BaseColor;
|
||||||
|
float4 _BaseMap_ST;
|
||||||
|
CBUFFER_END
|
||||||
|
TEXTURE2D (_BaseMap);SAMPLER(sampler_BaseMap);
|
||||||
|
TEXTURE2D (_Thickness);SAMPLER(sampler_Thickness);
|
||||||
|
TEXTURE2D (_MatCap);SAMPLER(sampler_MatCap);
|
||||||
|
float _NormalDistortion;
|
||||||
|
float _SSSPower;
|
||||||
|
float _SSSScale;
|
||||||
|
Varyings vert(Attributes v)
|
||||||
|
{
|
||||||
|
Varyings o = (Varyings)0;
|
||||||
|
|
||||||
|
o.positionCS = TransformObjectToHClip(v.positionOS.xyz);
|
||||||
|
o.uv = TRANSFORM_TEX(v.uv, _BaseMap);
|
||||||
|
o.Wpos = TransformObjectToWorld(v.positionOS);
|
||||||
|
o.Wnormal=TransformObjectToWorldNormal(v.normal);
|
||||||
|
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
half4 frag(Varyings i) : SV_Target
|
||||||
|
{
|
||||||
|
half4 c;
|
||||||
|
half4 baseMap = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, i.uv);
|
||||||
|
c = baseMap * _BaseColor;
|
||||||
|
float3 L=normalize(_MainLightPosition);
|
||||||
|
float3 V=normalize(_WorldSpaceCameraPos.xyz-i.Wpos.xyz);
|
||||||
|
float3 N=normalize(i.Wnormal);
|
||||||
|
float3 H=normalize(V+L);
|
||||||
|
//float3
|
||||||
|
float3 Back=-normalize(L+N*_NormalDistortion);
|
||||||
|
float NdV=pow(1-saturate(dot(N,V)),3)*0.2;
|
||||||
|
float NdL=dot(N,L)*0.5+0.5;
|
||||||
|
float NdH=pow(saturate(dot(N,H)),2)*0.1;
|
||||||
|
float VdB=pow(saturate(dot(V,Back)),_SSSPower)*_SSSScale;
|
||||||
|
float thickness=1-SAMPLE_TEXTURE2D(_Thickness,sampler_Thickness,i.uv).r*0.5;
|
||||||
|
float3 sss=max(VdB,0.5)*thickness*_BaseColor;
|
||||||
|
|
||||||
|
float3 reflectVec=reflect(-V,N);
|
||||||
|
half4 rgbm = SAMPLE_TEXTURECUBE_LOD(unity_SpecCube0,samplerunity_SpecCube0,reflectVec, 4);
|
||||||
|
float3 iblSpecular = DecodeHDREnvironment(rgbm, unity_SpecCube0_HDR);
|
||||||
|
|
||||||
|
float3 viewNorm = normalize(mul((i.Wnormal),(float3x3)UNITY_MATRIX_I_V));
|
||||||
|
float3 viewPos = normalize(TransformWorldToView(i.Wpos).xyz);
|
||||||
|
float3 viewCross = cross(viewPos, viewNorm);
|
||||||
|
viewNorm = float3(-viewCross.y, viewCross.x, 0.0);
|
||||||
|
float2 matCapUV = viewNorm.xy* 0.5 + 0.5;
|
||||||
|
half4 matCap = min(SAMPLE_TEXTURE2D_LOD(_MatCap, sampler_MatCap, matCapUV,2),0.5);
|
||||||
|
|
||||||
|
//次表面散射+漫反射+高光+环境高光+matcap高光采样
|
||||||
|
c.rgb = sss+NdL*_BaseColor*_MainLightColor*0.5+NdH*_MainLightColor*saturate(dot(N,L))+iblSpecular*0.2+matCap*max(NdL,0.3)+NdV*_BaseColor;
|
||||||
|
|
||||||
|
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
ENDHLSL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 18f99f35cb0098946a1a36647fcc293c
|
||||||
|
ShaderImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
defaultTextures: []
|
||||||
|
nonModifiableTextures: []
|
||||||
|
preprocessorOverride: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
BIN
Assets/Render/SpecialMaterials/JingTi/YvShi/sources/matcap05.jpg
Normal file
BIN
Assets/Render/SpecialMaterials/JingTi/YvShi/sources/matcap05.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 139 KiB |
@ -0,0 +1,146 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b633fd7e58b12b54183daeb4cde4701c
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 11
|
||||||
|
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: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
vTOnly: 0
|
||||||
|
ignoreMasterTextureLimit: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 1
|
||||||
|
aniso: 1
|
||||||
|
mipBias: 0
|
||||||
|
wrapU: 0
|
||||||
|
wrapV: 0
|
||||||
|
wrapW: 0
|
||||||
|
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
|
||||||
|
flipbookRows: 1
|
||||||
|
flipbookColumns: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
ignorePngGamma: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Server
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Android
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: WebGL
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID:
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
nameFileIdTable: {}
|
||||||
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
8
Assets/Render/SpecialMaterials/JingTi/Zuan.meta
Normal file
8
Assets/Render/SpecialMaterials/JingTi/Zuan.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6ec97165eccc4bc4e98031a5d910772a
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
@ -0,0 +1,128 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6db2befc32f8aeb4abb077c571f41678
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 11
|
||||||
|
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: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 1
|
||||||
|
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: 2
|
||||||
|
singleChannelComponent: 0
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: iPhone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Android
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID:
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
433
Assets/Render/SpecialMaterials/JingTi/Zuan/CushionCut.obj
Normal file
433
Assets/Render/SpecialMaterials/JingTi/Zuan/CushionCut.obj
Normal file
@ -0,0 +1,433 @@
|
|||||||
|
# Mesh "CushionCut" exported with Unity Assets Bundle Extractor; 174 vertices, 234 indices, 320 bits per vertex
|
||||||
|
g CushionCut
|
||||||
|
# SubMesh 0
|
||||||
|
# Vertices
|
||||||
|
v -0.063436 -0.185491 -0.063442
|
||||||
|
vn -0.585752 -0.773320 -0.242634
|
||||||
|
v -0.089717 -0.185491 0.000004
|
||||||
|
vn -0.585752 -0.773320 -0.242634
|
||||||
|
v -0.000000 -0.253789 0.000000
|
||||||
|
vn -0.587515 -0.771751 -0.243364
|
||||||
|
v -0.429143 0.125808 -0.177757
|
||||||
|
vn -0.583985 -0.774884 -0.241902
|
||||||
|
v -0.063436 -0.185491 -0.063442
|
||||||
|
vn -0.561019 -0.770348 -0.303022
|
||||||
|
v -0.341977 0.126922 -0.341969
|
||||||
|
vn -0.561019 -0.770348 -0.303022
|
||||||
|
v -0.429143 0.125808 -0.177757
|
||||||
|
vn -0.561019 -0.770348 -0.303022
|
||||||
|
v -0.063436 -0.185491 -0.063442
|
||||||
|
vn -0.302934 -0.770326 -0.561096
|
||||||
|
v -0.177743 0.125808 -0.429109
|
||||||
|
vn -0.302934 -0.770326 -0.561096
|
||||||
|
v -0.341977 0.126922 -0.341969
|
||||||
|
vn -0.302934 -0.770326 -0.561096
|
||||||
|
v -0.246829 0.210963 -0.246825
|
||||||
|
vn -0.245307 0.937904 -0.245275
|
||||||
|
v -0.096629 0.253789 -0.233283
|
||||||
|
vn -0.245307 0.937904 -0.245275
|
||||||
|
v -0.233270 0.253789 -0.096624
|
||||||
|
vn -0.245307 0.937904 -0.245275
|
||||||
|
v -0.000004 -0.185491 -0.089717
|
||||||
|
vn -0.242637 -0.773310 -0.585764
|
||||||
|
v -0.063436 -0.185491 -0.063442
|
||||||
|
vn -0.242637 -0.773310 -0.585764
|
||||||
|
v -0.000000 -0.253789 0.000000
|
||||||
|
vn -0.243357 -0.771763 -0.587502
|
||||||
|
v -0.177743 0.125808 -0.429109
|
||||||
|
vn -0.241916 -0.774851 -0.584022
|
||||||
|
v -0.000004 -0.185491 -0.089717
|
||||||
|
vn -0.000065 -0.735680 -0.677330
|
||||||
|
v 0.000005 0.126939 -0.429062
|
||||||
|
vn -0.000065 -0.735680 -0.677330
|
||||||
|
v -0.177743 0.125808 -0.429109
|
||||||
|
vn 0.004860 -0.735671 -0.677321
|
||||||
|
v 0.177757 0.125808 -0.429143
|
||||||
|
vn -0.004990 -0.735671 -0.677321
|
||||||
|
v 0.000003 0.210963 -0.349066
|
||||||
|
vn -0.000000 0.937904 -0.346894
|
||||||
|
v 0.096624 0.253789 -0.233270
|
||||||
|
vn -0.000000 0.937904 -0.346894
|
||||||
|
v -0.096629 0.253789 -0.233283
|
||||||
|
vn -0.000000 0.937904 -0.346894
|
||||||
|
v 0.063442 -0.185491 -0.063436
|
||||||
|
vn 0.242634 -0.773320 -0.585752
|
||||||
|
v -0.000004 -0.185491 -0.089717
|
||||||
|
vn 0.242634 -0.773320 -0.585752
|
||||||
|
v -0.000000 -0.253789 0.000000
|
||||||
|
vn 0.243364 -0.771751 -0.587515
|
||||||
|
v 0.177757 0.125808 -0.429143
|
||||||
|
vn 0.241902 -0.774884 -0.583985
|
||||||
|
v 0.063442 -0.185491 -0.063436
|
||||||
|
vn 0.303024 -0.770348 -0.561018
|
||||||
|
v 0.341968 0.126922 -0.341977
|
||||||
|
vn 0.303024 -0.770348 -0.561018
|
||||||
|
v 0.177757 0.125808 -0.429143
|
||||||
|
vn 0.303024 -0.770348 -0.561018
|
||||||
|
v 0.063442 -0.185491 -0.063436
|
||||||
|
vn 0.561093 -0.770326 -0.302939
|
||||||
|
v 0.429110 0.125808 -0.177743
|
||||||
|
vn 0.561093 -0.770326 -0.302939
|
||||||
|
v 0.341968 0.126922 -0.341977
|
||||||
|
vn 0.561093 -0.770326 -0.302939
|
||||||
|
v 0.246825 0.210963 -0.246829
|
||||||
|
vn 0.245275 0.937904 -0.245307
|
||||||
|
v 0.233283 0.253789 -0.096629
|
||||||
|
vn 0.245275 0.937904 -0.245307
|
||||||
|
v 0.096624 0.253789 -0.233270
|
||||||
|
vn 0.245275 0.937904 -0.245307
|
||||||
|
v 0.089717 -0.185491 -0.000004
|
||||||
|
vn 0.585764 -0.773310 -0.242637
|
||||||
|
v 0.063442 -0.185491 -0.063436
|
||||||
|
vn 0.585764 -0.773310 -0.242637
|
||||||
|
v -0.000000 -0.253789 0.000000
|
||||||
|
vn 0.587502 -0.771763 -0.243357
|
||||||
|
v 0.429110 0.125808 -0.177743
|
||||||
|
vn 0.584022 -0.774852 -0.241915
|
||||||
|
v 0.089717 -0.185491 -0.000004
|
||||||
|
vn 0.677307 -0.735656 0.008110
|
||||||
|
v 0.429062 0.126939 0.000005
|
||||||
|
vn 0.677307 -0.735656 0.008110
|
||||||
|
v 0.429110 0.125808 -0.177743
|
||||||
|
vn 0.677321 -0.735671 0.004864
|
||||||
|
v 0.424883 0.125808 0.175992
|
||||||
|
vn 0.677286 -0.735632 0.011355
|
||||||
|
v 0.349066 0.210963 0.000003
|
||||||
|
vn 0.346894 0.937904 0.000000
|
||||||
|
v 0.233270 0.253789 0.096624
|
||||||
|
vn 0.346894 0.937904 0.000000
|
||||||
|
v 0.233283 0.253789 -0.096629
|
||||||
|
vn 0.346894 0.937904 0.000000
|
||||||
|
v 0.063436 -0.185491 0.063442
|
||||||
|
vn 0.587879 -0.771427 0.243515
|
||||||
|
v 0.089717 -0.185491 -0.000004
|
||||||
|
vn 0.587879 -0.771427 0.243515
|
||||||
|
v -0.000000 -0.253789 0.000000
|
||||||
|
vn 0.587515 -0.771751 0.243364
|
||||||
|
v 0.424883 0.125808 0.175992
|
||||||
|
vn 0.588243 -0.771101 0.243666
|
||||||
|
v 0.063436 -0.185491 0.063442
|
||||||
|
vn 0.570961 -0.767917 0.290356
|
||||||
|
v 0.341976 0.126922 0.341968
|
||||||
|
vn 0.570961 -0.767917 0.290356
|
||||||
|
v 0.424883 0.125808 0.175992
|
||||||
|
vn 0.570961 -0.767917 0.290356
|
||||||
|
v 0.063436 -0.185491 0.063442
|
||||||
|
vn 0.302938 -0.770326 0.561094
|
||||||
|
v 0.177743 0.125808 0.429109
|
||||||
|
vn 0.302938 -0.770326 0.561094
|
||||||
|
v 0.341976 0.126922 0.341968
|
||||||
|
vn 0.302938 -0.770326 0.561094
|
||||||
|
v 0.246829 0.210963 0.246825
|
||||||
|
vn 0.245180 0.937932 0.245295
|
||||||
|
v 0.096624 0.253772 0.233271
|
||||||
|
vn 0.245180 0.937932 0.245295
|
||||||
|
v 0.233270 0.253789 0.096624
|
||||||
|
vn 0.245180 0.937932 0.245295
|
||||||
|
v 0.000004 -0.185491 0.089717
|
||||||
|
vn 0.242637 -0.773310 0.585764
|
||||||
|
v 0.063436 -0.185491 0.063442
|
||||||
|
vn 0.242637 -0.773310 0.585764
|
||||||
|
v -0.000000 -0.253789 0.000000
|
||||||
|
vn 0.243357 -0.771763 0.587502
|
||||||
|
v 0.177743 0.125808 0.429109
|
||||||
|
vn 0.241916 -0.774851 0.584022
|
||||||
|
v 0.000004 -0.185491 0.089717
|
||||||
|
vn 0.000032 -0.735680 0.677330
|
||||||
|
v -0.000005 0.126939 0.429062
|
||||||
|
vn 0.000032 -0.735680 0.677330
|
||||||
|
v 0.177743 0.125808 0.429109
|
||||||
|
vn -0.004860 -0.735671 0.677321
|
||||||
|
v -0.177750 0.125808 0.429126
|
||||||
|
vn 0.004925 -0.735671 0.677321
|
||||||
|
v -0.000003 0.210963 0.349066
|
||||||
|
vn -0.000000 0.937933 0.346818
|
||||||
|
v -0.096624 0.253789 0.233270
|
||||||
|
vn -0.000000 0.937933 0.346818
|
||||||
|
v 0.096624 0.253772 0.233271
|
||||||
|
vn -0.000000 0.937933 0.346818
|
||||||
|
v -0.063442 -0.185491 0.063436
|
||||||
|
vn -0.242637 -0.773312 0.585760
|
||||||
|
v 0.000004 -0.185491 0.089717
|
||||||
|
vn -0.242637 -0.773312 0.585760
|
||||||
|
v -0.000000 -0.253789 0.000000
|
||||||
|
vn -0.243364 -0.771751 0.587515
|
||||||
|
v -0.177750 0.125808 0.429126
|
||||||
|
vn -0.241909 -0.774869 0.584002
|
||||||
|
v -0.089717 -0.185491 0.000004
|
||||||
|
vn -0.585756 -0.773317 0.242634
|
||||||
|
v -0.063442 -0.185491 0.063436
|
||||||
|
vn -0.585756 -0.773317 0.242634
|
||||||
|
v -0.000000 -0.253789 0.000000
|
||||||
|
vn -0.587502 -0.771763 0.243357
|
||||||
|
v -0.429126 0.125808 0.177750
|
||||||
|
vn -0.584006 -0.774866 0.241909
|
||||||
|
v -0.089717 -0.185491 0.000004
|
||||||
|
vn -0.677330 -0.735680 0.000032
|
||||||
|
v -0.429062 0.126939 -0.000005
|
||||||
|
vn -0.677330 -0.735680 0.000032
|
||||||
|
v -0.429126 0.125808 0.177750
|
||||||
|
vn -0.677321 -0.735671 -0.004925
|
||||||
|
v -0.429143 0.125808 -0.177757
|
||||||
|
vn -0.677321 -0.735671 0.004990
|
||||||
|
v -0.349066 0.210963 -0.000003
|
||||||
|
vn -0.346894 0.937904 0.000000
|
||||||
|
v -0.233270 0.253789 -0.096624
|
||||||
|
vn -0.346894 0.937904 0.000000
|
||||||
|
v -0.233283 0.253789 0.096629
|
||||||
|
vn -0.346894 0.937904 0.000000
|
||||||
|
v -0.429126 0.125808 0.177750
|
||||||
|
vn -0.724247 0.689528 0.004127
|
||||||
|
v -0.429062 0.126939 -0.000005
|
||||||
|
vn -0.724253 0.689534 0.000035
|
||||||
|
v -0.349066 0.210963 -0.000003
|
||||||
|
vn -0.724253 0.689534 0.000035
|
||||||
|
v -0.429143 0.125808 -0.177757
|
||||||
|
vn -0.724247 0.689528 -0.004057
|
||||||
|
v 0.177743 0.125808 0.429109
|
||||||
|
vn 0.004196 0.689528 0.724247
|
||||||
|
v -0.000005 0.126939 0.429062
|
||||||
|
vn 0.000035 0.689534 0.724253
|
||||||
|
v -0.000003 0.210963 0.349066
|
||||||
|
vn 0.000035 0.689534 0.724253
|
||||||
|
v -0.177750 0.125808 0.429126
|
||||||
|
vn -0.004127 0.689528 0.724247
|
||||||
|
v 0.341976 0.126922 0.341968
|
||||||
|
vn 0.252421 0.836464 0.486427
|
||||||
|
v 0.177743 0.125808 0.429109
|
||||||
|
vn 0.252421 0.836464 0.486427
|
||||||
|
v 0.246829 0.210963 0.246825
|
||||||
|
vn 0.252421 0.836464 0.486427
|
||||||
|
v 0.341976 0.126922 0.341968
|
||||||
|
vn 0.495253 0.834425 0.241784
|
||||||
|
v 0.246829 0.210963 0.246825
|
||||||
|
vn 0.491099 0.842408 0.221746
|
||||||
|
v 0.424883 0.125808 0.175992
|
||||||
|
vn 0.491099 0.842408 0.221746
|
||||||
|
v 0.349066 0.210963 0.000003
|
||||||
|
vn 0.484417 0.851516 0.200652
|
||||||
|
v 0.233270 0.253789 0.096624
|
||||||
|
vn 0.482121 0.853041 0.199701
|
||||||
|
v 0.429110 0.125808 -0.177743
|
||||||
|
vn 0.724247 0.689528 -0.004192
|
||||||
|
v 0.429062 0.126939 0.000005
|
||||||
|
vn 0.724226 0.689508 0.008717
|
||||||
|
v 0.349066 0.210963 0.000003
|
||||||
|
vn 0.724226 0.689508 0.008717
|
||||||
|
v 0.424883 0.125808 0.175992
|
||||||
|
vn 0.724084 0.689373 0.021624
|
||||||
|
v 0.341968 0.126922 -0.341977
|
||||||
|
vn 0.486425 0.836465 -0.252422
|
||||||
|
v 0.429110 0.125808 -0.177743
|
||||||
|
vn 0.486425 0.836465 -0.252422
|
||||||
|
v 0.246825 0.210963 -0.246829
|
||||||
|
vn 0.486425 0.836465 -0.252422
|
||||||
|
v 0.341968 0.126922 -0.341977
|
||||||
|
vn 0.252492 0.836483 -0.486358
|
||||||
|
v 0.246825 0.210963 -0.246829
|
||||||
|
vn 0.252492 0.836483 -0.486358
|
||||||
|
v 0.177757 0.125808 -0.429143
|
||||||
|
vn 0.252492 0.836483 -0.486358
|
||||||
|
v 0.177757 0.125808 -0.429143
|
||||||
|
vn 0.004057 0.689528 -0.724247
|
||||||
|
v 0.000003 0.210963 -0.349066
|
||||||
|
vn -0.000069 0.689534 -0.724253
|
||||||
|
v 0.000005 0.126939 -0.429062
|
||||||
|
vn -0.000069 0.689534 -0.724253
|
||||||
|
v -0.177743 0.125808 -0.429109
|
||||||
|
vn -0.004196 0.689528 -0.724247
|
||||||
|
v -0.341977 0.126922 -0.341969
|
||||||
|
vn -0.252416 0.836466 -0.486426
|
||||||
|
v -0.177743 0.125808 -0.429109
|
||||||
|
vn -0.252416 0.836466 -0.486426
|
||||||
|
v -0.246829 0.210963 -0.246825
|
||||||
|
vn -0.252416 0.836466 -0.486426
|
||||||
|
v -0.341977 0.126922 -0.341969
|
||||||
|
vn -0.486358 0.836484 -0.252491
|
||||||
|
v -0.246829 0.210963 -0.246825
|
||||||
|
vn -0.486358 0.836484 -0.252491
|
||||||
|
v -0.429143 0.125808 -0.177757
|
||||||
|
vn -0.486358 0.836484 -0.252491
|
||||||
|
v -0.349066 0.210963 -0.000003
|
||||||
|
vn -0.478633 0.855339 -0.198256
|
||||||
|
v -0.429143 0.125808 -0.177757
|
||||||
|
vn -0.475135 0.857621 -0.196807
|
||||||
|
v -0.246829 0.210963 -0.246825
|
||||||
|
vn -0.478633 0.855339 -0.198256
|
||||||
|
v -0.233270 0.253789 -0.096624
|
||||||
|
vn -0.482121 0.853041 -0.199701
|
||||||
|
v -0.096629 0.253789 -0.233283
|
||||||
|
vn -0.199734 0.852987 -0.482202
|
||||||
|
v -0.246829 0.210963 -0.246825
|
||||||
|
vn -0.198290 0.855285 -0.478716
|
||||||
|
v 0.000003 0.210963 -0.349066
|
||||||
|
vn -0.198290 0.855285 -0.478716
|
||||||
|
v -0.177743 0.125808 -0.429109
|
||||||
|
vn -0.196842 0.857566 -0.475220
|
||||||
|
v 0.096624 0.253789 -0.233270
|
||||||
|
vn 0.199701 0.853041 -0.482121
|
||||||
|
v 0.000003 0.210963 -0.349066
|
||||||
|
vn 0.198256 0.855339 -0.478633
|
||||||
|
v 0.246825 0.210963 -0.246829
|
||||||
|
vn 0.198256 0.855339 -0.478633
|
||||||
|
v 0.177757 0.125808 -0.429143
|
||||||
|
vn 0.196807 0.857621 -0.475135
|
||||||
|
v 0.233283 0.253789 -0.096629
|
||||||
|
vn 0.482202 0.852987 -0.199734
|
||||||
|
v 0.246825 0.210963 -0.246829
|
||||||
|
vn 0.478715 0.855286 -0.198290
|
||||||
|
v 0.349066 0.210963 0.000003
|
||||||
|
vn 0.478715 0.855286 -0.198290
|
||||||
|
v 0.429110 0.125808 -0.177743
|
||||||
|
vn 0.475218 0.857567 -0.196841
|
||||||
|
v 0.096624 0.253772 0.233271
|
||||||
|
vn 0.199649 0.853123 0.481997
|
||||||
|
v 0.246829 0.210963 0.246825
|
||||||
|
vn 0.198248 0.855352 0.478613
|
||||||
|
v -0.000003 0.210963 0.349066
|
||||||
|
vn 0.198248 0.855352 0.478613
|
||||||
|
v 0.177743 0.125808 0.429109
|
||||||
|
vn 0.196842 0.857566 0.475220
|
||||||
|
v 0.233283 0.253789 -0.096629
|
||||||
|
vn -0.000000 1.000000 0.000000
|
||||||
|
v 0.233270 0.253789 0.096624
|
||||||
|
vn -0.000000 1.000000 0.000000
|
||||||
|
v 0.096624 0.253772 0.233271
|
||||||
|
vn -0.000000 1.000000 0.000000
|
||||||
|
v -0.233283 0.253789 0.096629
|
||||||
|
vn -0.000000 1.000000 0.000000
|
||||||
|
v -0.096629 0.253789 -0.233283
|
||||||
|
vn -0.000000 1.000000 0.000000
|
||||||
|
v -0.233270 0.253789 -0.096624
|
||||||
|
vn -0.000000 1.000000 0.000000
|
||||||
|
v 0.096624 0.253789 -0.233270
|
||||||
|
vn -0.000000 1.000000 0.000000
|
||||||
|
v -0.096624 0.253789 0.233270
|
||||||
|
vn -0.000000 1.000000 0.000000
|
||||||
|
v -0.341977 0.126922 0.341968
|
||||||
|
vn -0.252462 0.836473 0.486391
|
||||||
|
v -0.246829 0.210963 0.246825
|
||||||
|
vn -0.252462 0.836473 0.486391
|
||||||
|
v -0.177750 0.125808 0.429126
|
||||||
|
vn -0.252462 0.836473 0.486391
|
||||||
|
v -0.341977 0.126922 0.341968
|
||||||
|
vn -0.486393 0.836475 0.252450
|
||||||
|
v -0.429126 0.125808 0.177750
|
||||||
|
vn -0.486393 0.836475 0.252450
|
||||||
|
v -0.246829 0.210963 0.246825
|
||||||
|
vn -0.486393 0.836475 0.252450
|
||||||
|
v -0.246829 0.210963 0.246825
|
||||||
|
vn -0.478693 0.855301 0.198276
|
||||||
|
v -0.429126 0.125808 0.177750
|
||||||
|
vn -0.475179 0.857593 0.196821
|
||||||
|
v -0.349066 0.210963 -0.000003
|
||||||
|
vn -0.478693 0.855301 0.198276
|
||||||
|
v -0.233283 0.253789 0.096629
|
||||||
|
vn -0.482198 0.852991 0.199728
|
||||||
|
v -0.177750 0.125808 0.429126
|
||||||
|
vn -0.196829 0.857593 0.475176
|
||||||
|
v -0.246829 0.210963 0.246825
|
||||||
|
vn -0.198270 0.855324 0.478655
|
||||||
|
v -0.000003 0.210963 0.349066
|
||||||
|
vn -0.198270 0.855324 0.478655
|
||||||
|
v -0.096624 0.253789 0.233270
|
||||||
|
vn -0.199707 0.853038 0.482125
|
||||||
|
v -0.246829 0.210963 0.246825
|
||||||
|
vn -0.245275 0.937904 0.245307
|
||||||
|
v -0.233283 0.253789 0.096629
|
||||||
|
vn -0.245275 0.937904 0.245307
|
||||||
|
v -0.096624 0.253789 0.233270
|
||||||
|
vn -0.245275 0.937904 0.245307
|
||||||
|
v -0.063442 -0.185491 0.063436
|
||||||
|
vn -0.302985 -0.770337 0.561053
|
||||||
|
v -0.341977 0.126922 0.341968
|
||||||
|
vn -0.302985 -0.770337 0.561053
|
||||||
|
v -0.177750 0.125808 0.429126
|
||||||
|
vn -0.302985 -0.770337 0.561053
|
||||||
|
v -0.063442 -0.185491 0.063436
|
||||||
|
vn -0.561060 -0.770336 0.302975
|
||||||
|
v -0.429126 0.125808 0.177750
|
||||||
|
vn -0.561060 -0.770336 0.302975
|
||||||
|
v -0.341977 0.126922 0.341968
|
||||||
|
vn -0.561060 -0.770336 0.302975
|
||||||
|
# Faces (1 to 174)
|
||||||
|
g CushionCut_0
|
||||||
|
f -172//-172 -173//-173 -174//-174
|
||||||
|
f -173//-173 -171//-171 -174//-174
|
||||||
|
f -168//-168 -169//-169 -170//-170
|
||||||
|
f -165//-165 -166//-166 -167//-167
|
||||||
|
f -162//-162 -163//-163 -164//-164
|
||||||
|
f -159//-159 -160//-160 -161//-161
|
||||||
|
f -160//-160 -158//-158 -161//-161
|
||||||
|
f -155//-155 -156//-156 -157//-157
|
||||||
|
f -156//-156 -154//-154 -157//-157
|
||||||
|
f -151//-151 -152//-152 -153//-153
|
||||||
|
f -148//-148 -149//-149 -150//-150
|
||||||
|
f -149//-149 -147//-147 -150//-150
|
||||||
|
f -144//-144 -145//-145 -146//-146
|
||||||
|
f -141//-141 -142//-142 -143//-143
|
||||||
|
f -138//-138 -139//-139 -140//-140
|
||||||
|
f -135//-135 -136//-136 -137//-137
|
||||||
|
f -136//-136 -134//-134 -137//-137
|
||||||
|
f -131//-131 -132//-132 -133//-133
|
||||||
|
f -132//-132 -130//-130 -133//-133
|
||||||
|
f -127//-127 -128//-128 -129//-129
|
||||||
|
f -124//-124 -125//-125 -126//-126
|
||||||
|
f -125//-125 -123//-123 -126//-126
|
||||||
|
f -120//-120 -121//-121 -122//-122
|
||||||
|
f -117//-117 -118//-118 -119//-119
|
||||||
|
f -114//-114 -115//-115 -116//-116
|
||||||
|
f -111//-111 -112//-112 -113//-113
|
||||||
|
f -112//-112 -110//-110 -113//-113
|
||||||
|
f -107//-107 -108//-108 -109//-109
|
||||||
|
f -108//-108 -106//-106 -109//-109
|
||||||
|
f -103//-103 -104//-104 -105//-105
|
||||||
|
f -100//-100 -101//-101 -102//-102
|
||||||
|
f -101//-101 -99//-99 -102//-102
|
||||||
|
f -96//-96 -97//-97 -98//-98
|
||||||
|
f -97//-97 -95//-95 -98//-98
|
||||||
|
f -92//-92 -93//-93 -94//-94
|
||||||
|
f -93//-93 -91//-91 -94//-94
|
||||||
|
f -88//-88 -89//-89 -90//-90
|
||||||
|
f -85//-85 -86//-86 -87//-87
|
||||||
|
f -84//-84 -86//-86 -85//-85
|
||||||
|
f -81//-81 -82//-82 -83//-83
|
||||||
|
f -80//-80 -82//-82 -81//-81
|
||||||
|
f -77//-77 -78//-78 -79//-79
|
||||||
|
f -74//-74 -75//-75 -76//-76
|
||||||
|
f -74//-74 -73//-73 -75//-75
|
||||||
|
f -72//-72 -75//-75 -73//-73
|
||||||
|
f -69//-69 -70//-70 -71//-71
|
||||||
|
f -69//-69 -68//-68 -70//-70
|
||||||
|
f -65//-65 -66//-66 -67//-67
|
||||||
|
f -62//-62 -63//-63 -64//-64
|
||||||
|
f -59//-59 -60//-60 -61//-61
|
||||||
|
f -58//-58 -60//-60 -59//-59
|
||||||
|
f -55//-55 -56//-56 -57//-57
|
||||||
|
f -52//-52 -53//-53 -54//-54
|
||||||
|
f -49//-49 -50//-50 -51//-51
|
||||||
|
f -48//-48 -49//-49 -51//-51
|
||||||
|
f -45//-45 -46//-46 -47//-47
|
||||||
|
f -46//-46 -45//-45 -44//-44
|
||||||
|
f -41//-41 -42//-42 -43//-43
|
||||||
|
f -40//-40 -42//-42 -41//-41
|
||||||
|
f -37//-37 -38//-38 -39//-39
|
||||||
|
f -36//-36 -38//-38 -37//-37
|
||||||
|
f -33//-33 -34//-34 -35//-35
|
||||||
|
f -32//-32 -34//-34 -33//-33
|
||||||
|
f -29//-29 -30//-30 -31//-31
|
||||||
|
f -29//-29 -31//-31 -28//-28
|
||||||
|
f -31//-31 -27//-27 -28//-28
|
||||||
|
f -28//-28 -27//-27 -26//-26
|
||||||
|
f -25//-25 -27//-27 -31//-31
|
||||||
|
f -24//-24 -29//-29 -28//-28
|
||||||
|
f -21//-21 -22//-22 -23//-23
|
||||||
|
f -18//-18 -19//-19 -20//-20
|
||||||
|
f -15//-15 -16//-16 -17//-17
|
||||||
|
f -15//-15 -17//-17 -14//-14
|
||||||
|
f -11//-11 -12//-12 -13//-13
|
||||||
|
f -12//-12 -11//-11 -10//-10
|
||||||
|
f -7//-7 -8//-8 -9//-9
|
||||||
|
f -4//-4 -5//-5 -6//-6
|
||||||
|
f -1//-1 -2//-2 -3//-3
|
||||||
|
|
||||||
@ -0,0 +1,96 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d1c1a9b9aebc51d4f95540616902957a
|
||||||
|
ModelImporter:
|
||||||
|
serializedVersion: 19300
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
materials:
|
||||||
|
materialImportMode: 1
|
||||||
|
materialName: 0
|
||||||
|
materialSearch: 1
|
||||||
|
materialLocation: 1
|
||||||
|
animations:
|
||||||
|
legacyGenerateAnimations: 4
|
||||||
|
bakeSimulation: 0
|
||||||
|
resampleCurves: 1
|
||||||
|
optimizeGameObjects: 0
|
||||||
|
motionNodeName:
|
||||||
|
rigImportErrors:
|
||||||
|
rigImportWarnings:
|
||||||
|
animationImportErrors:
|
||||||
|
animationImportWarnings:
|
||||||
|
animationRetargetingWarnings:
|
||||||
|
animationDoRetargetingWarnings: 0
|
||||||
|
importAnimatedCustomProperties: 0
|
||||||
|
importConstraints: 0
|
||||||
|
animationCompression: 1
|
||||||
|
animationRotationError: 0.5
|
||||||
|
animationPositionError: 0.5
|
||||||
|
animationScaleError: 0.5
|
||||||
|
animationWrapMode: 0
|
||||||
|
extraExposedTransformPaths: []
|
||||||
|
extraUserProperties: []
|
||||||
|
clipAnimations: []
|
||||||
|
isReadable: 0
|
||||||
|
meshes:
|
||||||
|
lODScreenPercentages: []
|
||||||
|
globalScale: 1
|
||||||
|
meshCompression: 0
|
||||||
|
addColliders: 0
|
||||||
|
useSRGBMaterialColor: 1
|
||||||
|
sortHierarchyByName: 1
|
||||||
|
importVisibility: 1
|
||||||
|
importBlendShapes: 1
|
||||||
|
importCameras: 1
|
||||||
|
importLights: 1
|
||||||
|
swapUVChannels: 0
|
||||||
|
generateSecondaryUV: 0
|
||||||
|
useFileUnits: 1
|
||||||
|
keepQuads: 0
|
||||||
|
weldVertices: 1
|
||||||
|
preserveHierarchy: 0
|
||||||
|
skinWeightsMode: 0
|
||||||
|
maxBonesPerVertex: 4
|
||||||
|
minBoneWeight: 0.001
|
||||||
|
meshOptimizationFlags: -1
|
||||||
|
indexFormat: 0
|
||||||
|
secondaryUVAngleDistortion: 8
|
||||||
|
secondaryUVAreaDistortion: 15.000001
|
||||||
|
secondaryUVHardAngle: 88
|
||||||
|
secondaryUVPackMargin: 4
|
||||||
|
useFileScale: 1
|
||||||
|
tangentSpace:
|
||||||
|
normalSmoothAngle: 60
|
||||||
|
normalImportMode: 0
|
||||||
|
tangentImportMode: 3
|
||||||
|
normalCalculationMode: 4
|
||||||
|
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
|
||||||
|
blendShapeNormalImportMode: 1
|
||||||
|
normalSmoothingSource: 0
|
||||||
|
referencedClips: []
|
||||||
|
importAnimation: 1
|
||||||
|
humanDescription:
|
||||||
|
serializedVersion: 3
|
||||||
|
human: []
|
||||||
|
skeleton: []
|
||||||
|
armTwist: 0.5
|
||||||
|
foreArmTwist: 0.5
|
||||||
|
upperLegTwist: 0.5
|
||||||
|
legTwist: 0.5
|
||||||
|
armStretch: 0.05
|
||||||
|
legStretch: 0.05
|
||||||
|
feetSpacing: 0
|
||||||
|
globalScale: 1
|
||||||
|
rootMotionBoneName:
|
||||||
|
hasTranslationDoF: 0
|
||||||
|
hasExtraRoot: 0
|
||||||
|
skeletonHasParents: 1
|
||||||
|
lastHumanDescriptionAvatarSource: {instanceID: 0}
|
||||||
|
autoGenerateAvatarMappingIfUnspecified: 1
|
||||||
|
animationType: 2
|
||||||
|
humanoidOversampling: 1
|
||||||
|
avatarSetup: 0
|
||||||
|
additionalBone: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
using UnityEditor;
|
||||||
|
namespace DiamondRender
|
||||||
|
{
|
||||||
|
[CustomEditor(typeof(DiamondRenderer)), CanEditMultipleObjects]
|
||||||
|
public class CustomInspector : Editor
|
||||||
|
{
|
||||||
|
|
||||||
|
public override void OnInspectorGUI()
|
||||||
|
{
|
||||||
|
DrawDefaultInspector();
|
||||||
|
if (GUILayout.Button("CalculateMesh"))
|
||||||
|
{
|
||||||
|
foreach (var obj in targets)
|
||||||
|
{
|
||||||
|
DiamondRenderer ed = (DiamondRenderer)obj;
|
||||||
|
ed.Setup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bdb877c81256e154182b7da1d5fc1b08
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
415
Assets/Render/SpecialMaterials/JingTi/Zuan/DiamondRenderer.cs
Normal file
415
Assets/Render/SpecialMaterials/JingTi/Zuan/DiamondRenderer.cs
Normal file
@ -0,0 +1,415 @@
|
|||||||
|
|
||||||
|
|
||||||
|
using UnityEngine;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
using UnityEditor;
|
||||||
|
#endif
|
||||||
|
namespace DiamondRender
|
||||||
|
{
|
||||||
|
|
||||||
|
[RequireComponent(typeof(MeshFilter))]
|
||||||
|
[RequireComponent(typeof(MeshRenderer))]
|
||||||
|
[ExecuteAlways]
|
||||||
|
public class DiamondRenderer : MonoBehaviour
|
||||||
|
{
|
||||||
|
// public JewelModel model;
|
||||||
|
public Color color = new Color(1,1,1,1);
|
||||||
|
|
||||||
|
[Range(0, 3)]
|
||||||
|
public float ColorIntensity = 1.7f;
|
||||||
|
|
||||||
|
[Range(0, 1.5f)]
|
||||||
|
public float LightTransmission = 0.5f;
|
||||||
|
|
||||||
|
[Range(0, 1)]
|
||||||
|
public float ColorByDepth = 0.1f;
|
||||||
|
|
||||||
|
[Range(0,10)]
|
||||||
|
public int MaxReflection = 4;
|
||||||
|
|
||||||
|
[Range(1, 5)]
|
||||||
|
public float RefractiveIndex = 1.6f;
|
||||||
|
// public int maxReflectionCount;
|
||||||
|
Cubemap environment;
|
||||||
|
|
||||||
|
|
||||||
|
public bool autoCaptureEnvironment = false;
|
||||||
|
public bool captureEnvironmentOnSetup = false;
|
||||||
|
public int captureEnvironmentSize = 512;
|
||||||
|
|
||||||
|
|
||||||
|
// public ReflectionProbe _reflectionProbe;
|
||||||
|
|
||||||
|
public MaterialPropertyBlock block;
|
||||||
|
|
||||||
|
|
||||||
|
/* public Shader ShaderCubeMap;
|
||||||
|
public Shader ShaderReflectionProbe; */
|
||||||
|
|
||||||
|
// calculated
|
||||||
|
[SerializeField]
|
||||||
|
// [HideInInspector]
|
||||||
|
float scale;
|
||||||
|
[SerializeField]
|
||||||
|
// [HideInInspector]
|
||||||
|
Texture2D shapeTexture;
|
||||||
|
[SerializeField]
|
||||||
|
[HideInInspector]
|
||||||
|
int planeCount;
|
||||||
|
|
||||||
|
Cubemap capturedEnvironment = null;
|
||||||
|
Material mat;
|
||||||
|
|
||||||
|
float Time_;
|
||||||
|
|
||||||
|
Vector3 MinPos;
|
||||||
|
|
||||||
|
Vector3 MaxPos;
|
||||||
|
|
||||||
|
[HideInInspector]
|
||||||
|
public Vector4 CentreModel;
|
||||||
|
|
||||||
|
MeshRenderer MR;
|
||||||
|
|
||||||
|
[HideInInspector]
|
||||||
|
public Matrix4x4 m;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
|
||||||
|
MR = GetComponent<MeshRenderer>();
|
||||||
|
|
||||||
|
if (block == null)
|
||||||
|
{
|
||||||
|
block = new MaterialPropertyBlock();
|
||||||
|
MR.GetPropertyBlock(block);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Enable()
|
||||||
|
{
|
||||||
|
|
||||||
|
MR = GetComponent<MeshRenderer>();
|
||||||
|
mat = MR.sharedMaterial;
|
||||||
|
|
||||||
|
if (block == null)
|
||||||
|
{
|
||||||
|
block = new MaterialPropertyBlock();
|
||||||
|
MR.GetPropertyBlock(block);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
|
||||||
|
if(block == null)
|
||||||
|
{
|
||||||
|
block = new MaterialPropertyBlock();
|
||||||
|
|
||||||
|
MR.GetPropertyBlock(block);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MR == null)
|
||||||
|
{
|
||||||
|
MR = GetComponent<MeshRenderer>();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mat == null)
|
||||||
|
mat = MR.sharedMaterial;
|
||||||
|
|
||||||
|
|
||||||
|
m = MR.worldToLocalMatrix;
|
||||||
|
|
||||||
|
m.m03 -= CentreModel.x;
|
||||||
|
m.m13 -= CentreModel.y;
|
||||||
|
m.m23 -= CentreModel.z;
|
||||||
|
|
||||||
|
block.SetVector("CentreModel", CentreModel);
|
||||||
|
block.SetFloat("ColorByDepth", ColorByDepth);
|
||||||
|
block.SetColor("_Color", color);
|
||||||
|
block.SetFloat("ColorIntensity", ColorIntensity);
|
||||||
|
block.SetFloat("lighttransmission", LightTransmission);
|
||||||
|
block.SetFloat("_RefractiveIndex", RefractiveIndex);
|
||||||
|
block.SetInt("_MaxReflection", MaxReflection);
|
||||||
|
block.SetMatrix("MatrixWorldToObject", m);
|
||||||
|
|
||||||
|
if (shapeTexture != null) {
|
||||||
|
block.SetTexture("_ShapeTex", shapeTexture);
|
||||||
|
block.SetInt("_SizeX", shapeTexture.width);
|
||||||
|
block.SetInt("_SizeY", shapeTexture.height);
|
||||||
|
block.SetFloat("_Scale", scale);
|
||||||
|
block.SetInt("_PlaneCount", planeCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
MR.SetPropertyBlock(block);
|
||||||
|
|
||||||
|
if (mat == null)
|
||||||
|
mat = MR.sharedMaterial;
|
||||||
|
|
||||||
|
|
||||||
|
if (autoCaptureEnvironment)
|
||||||
|
{
|
||||||
|
CaptureEnvironment();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[ContextMenu("Setup")]
|
||||||
|
public void Setup()
|
||||||
|
{
|
||||||
|
mat = MR.sharedMaterial;
|
||||||
|
|
||||||
|
|
||||||
|
AnalyzeMesh();
|
||||||
|
|
||||||
|
MeshRenderer mr = GetComponent<MeshRenderer>();
|
||||||
|
|
||||||
|
if (mat == null)
|
||||||
|
mat = mr.sharedMaterial;
|
||||||
|
|
||||||
|
block.SetTexture("_ShapeTex", shapeTexture);
|
||||||
|
block.SetInt("_SizeX", shapeTexture.width);
|
||||||
|
block.SetInt("_SizeY", shapeTexture.height);
|
||||||
|
block.SetFloat("_Scale", scale);
|
||||||
|
block.SetInt("_PlaneCount", planeCount);
|
||||||
|
|
||||||
|
mr.SetPropertyBlock(block);
|
||||||
|
mr.material = mat;
|
||||||
|
|
||||||
|
if (captureEnvironmentOnSetup)
|
||||||
|
{
|
||||||
|
CaptureEnvironment();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ContextMenu("CaptureEnvironment")]
|
||||||
|
public void CaptureEnvironment()
|
||||||
|
{
|
||||||
|
Material m = GetComponent<MeshRenderer>().sharedMaterial;
|
||||||
|
|
||||||
|
if( m == null )
|
||||||
|
{
|
||||||
|
Debug.LogWarning("Material is not setup yet. please do Setup first.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (capturedEnvironment == null)
|
||||||
|
{
|
||||||
|
capturedEnvironment = new Cubemap(captureEnvironmentSize, TextureFormat.ARGB32, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
Camera cameraComponent = GetComponent<Camera>();
|
||||||
|
|
||||||
|
bool temporaryCameraComponent = false;
|
||||||
|
if (cameraComponent == null)
|
||||||
|
{
|
||||||
|
cameraComponent = gameObject.AddComponent<Camera>();
|
||||||
|
temporaryCameraComponent = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
cameraComponent.RenderToCubemap(capturedEnvironment);
|
||||||
|
|
||||||
|
environment = capturedEnvironment;
|
||||||
|
|
||||||
|
m.SetTexture("_Environment", capturedEnvironment);
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
if ( temporaryCameraComponent)
|
||||||
|
{
|
||||||
|
DestroyImmediate(cameraComponent);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
[ContextMenu("ApplyNumericParameters")]
|
||||||
|
public void ApplyNumericParameters()
|
||||||
|
{
|
||||||
|
Material m = GetComponent<MeshRenderer>().sharedMaterial;
|
||||||
|
m.SetInt("_SizeX", shapeTexture.width);
|
||||||
|
m.SetInt("_SizeY", shapeTexture.height);
|
||||||
|
m.SetFloat("_Scale", scale);
|
||||||
|
m.SetInt("_PlaneCount", planeCount);
|
||||||
|
m.SetColor("_Color", color);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AnalyzeMesh()
|
||||||
|
{
|
||||||
|
Mesh sourceMesh = GetComponent<MeshFilter>().sharedMesh;
|
||||||
|
|
||||||
|
if (sourceMesh == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector3[] vertices = sourceMesh.vertices;
|
||||||
|
Vector3[] normals = sourceMesh.normals;
|
||||||
|
int[] indices = sourceMesh.GetIndices(0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
MeshTopology topology = sourceMesh.GetTopology(0);
|
||||||
|
|
||||||
|
|
||||||
|
CentreModel = new Vector4(1, 1, 1, 1);
|
||||||
|
|
||||||
|
MaxPos = new Vector4(-9999999, -9999999, -9999999, 1);
|
||||||
|
MinPos = new Vector4(9999999, 9999999, 9999999, 1);
|
||||||
|
|
||||||
|
for (int i = 0; i < vertices.Length; i++)
|
||||||
|
{
|
||||||
|
if (vertices[i].x < MinPos.x)
|
||||||
|
{
|
||||||
|
MinPos.x = vertices[i].x;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vertices[i].y < MinPos.y)
|
||||||
|
{
|
||||||
|
MinPos.y = vertices[i].y;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vertices[i].z < MinPos.z)
|
||||||
|
{
|
||||||
|
MinPos.z = vertices[i].z;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (vertices[i].x > MaxPos.x)
|
||||||
|
{
|
||||||
|
MaxPos.x = vertices[i].x;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vertices[i].y > MaxPos.y)
|
||||||
|
{
|
||||||
|
MaxPos.y = vertices[i].y;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vertices[i].z > MaxPos.z)
|
||||||
|
{
|
||||||
|
MaxPos.z = vertices[i].z;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CentreModel.x = (MaxPos.x + MinPos.x) / 2;
|
||||||
|
CentreModel.y = (MaxPos.y + MinPos.y) / 2;
|
||||||
|
CentreModel.z = (MaxPos.z + MinPos.z) / 2;
|
||||||
|
|
||||||
|
for (int i = 0; i < vertices.Length; i++)
|
||||||
|
{
|
||||||
|
vertices[i].x = vertices[i].x - CentreModel.x;
|
||||||
|
vertices[i].y = vertices[i].y - CentreModel.y;
|
||||||
|
vertices[i].z = vertices[i].z - CentreModel.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
scale = 0.0f;
|
||||||
|
// calc scale
|
||||||
|
for (int i = 0; i < vertices.Length; ++i)
|
||||||
|
{
|
||||||
|
// 5% margin
|
||||||
|
scale = Mathf.Max(vertices[i].magnitude * 1.05f, scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
int texSize = 4;
|
||||||
|
Color[] planes = null;
|
||||||
|
|
||||||
|
int stride = 3;
|
||||||
|
if (topology == MeshTopology.Triangles)
|
||||||
|
{
|
||||||
|
stride = 3;
|
||||||
|
}
|
||||||
|
else if (topology == MeshTopology.Quads)
|
||||||
|
{
|
||||||
|
stride = 4;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// no support
|
||||||
|
Debug.LogError("unsupported mesh topology detected : " + topology.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Color> tmpPlanes = new List<Color>();
|
||||||
|
|
||||||
|
int faceCount = indices.Length / stride;
|
||||||
|
|
||||||
|
for (int i = 0; i < faceCount; i++)
|
||||||
|
{
|
||||||
|
int index = i * stride;
|
||||||
|
|
||||||
|
int vertIndex = indices[index];
|
||||||
|
Vector3 primaryPosition = vertices[vertIndex];
|
||||||
|
Vector3 primaryNormal = normals[vertIndex];
|
||||||
|
|
||||||
|
Color packedPlane = PackPlaneIntoColor(primaryPosition, primaryNormal, scale);
|
||||||
|
|
||||||
|
bool duplicated = false;
|
||||||
|
foreach(Color c in tmpPlanes)
|
||||||
|
{
|
||||||
|
if( c == packedPlane )
|
||||||
|
{
|
||||||
|
duplicated = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !duplicated )
|
||||||
|
{
|
||||||
|
tmpPlanes.Add(packedPlane);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
planeCount = tmpPlanes.Count;
|
||||||
|
while (texSize * texSize < planeCount)
|
||||||
|
{
|
||||||
|
texSize *= 2;
|
||||||
|
}
|
||||||
|
planes = new Color[texSize * texSize];
|
||||||
|
for( int i=0; i<tmpPlanes.Count; ++i )
|
||||||
|
{
|
||||||
|
planes[i] = tmpPlanes[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
shapeTexture = new Texture2D(texSize, texSize);
|
||||||
|
shapeTexture.filterMode = FilterMode.Point;
|
||||||
|
}
|
||||||
|
shapeTexture.Reinitialize(texSize, texSize);
|
||||||
|
shapeTexture.SetPixels(planes);
|
||||||
|
shapeTexture.Apply();
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
AssetDatabase.CreateAsset(shapeTexture, "Assets/SuperRealisticDiamondShaders/ShapeTextures/" + "_" + System.DateTime.Now.ToString("yyyy-MM-dd") + "_ " + System.DateTime.Now.Hour + "_ " + System.DateTime.Now.Minute + Random.Range(-99999,99999) + " shapeTexture_.asset"); // save the modified model
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
|
AssetDatabase.Refresh();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Color PackPlaneIntoColor(Vector3 position, Vector3 normal, float in_scale)
|
||||||
|
{
|
||||||
|
Color retval;
|
||||||
|
retval.r = (normal.x + 1.0f) * 0.5f;
|
||||||
|
retval.g = (normal.y + 1.0f) * 0.5f;
|
||||||
|
retval.b = (normal.z + 1.0f) * 0.5f;
|
||||||
|
retval.a = Vector3.Dot(position, normal) / in_scale;
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a7def2437719354419e78fc653c56bdf
|
||||||
|
timeCreated: 1514594610
|
||||||
|
licenseType: Store
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
127
Assets/Render/SpecialMaterials/JingTi/Zuan/DiamondRing.mat
Normal file
127
Assets/Render/SpecialMaterials/JingTi/Zuan/DiamondRing.mat
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!21 &2100000
|
||||||
|
Material:
|
||||||
|
serializedVersion: 8
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: DiamondRing
|
||||||
|
m_Shader: {fileID: 4800000, guid: 6aa8c547a830c6944a78a6934111b781, type: 3}
|
||||||
|
m_ValidKeywords:
|
||||||
|
- _CUBEMAPMODE_CUBEMAP
|
||||||
|
m_InvalidKeywords: []
|
||||||
|
m_LightmapFlags: 4
|
||||||
|
m_EnableInstancingVariants: 0
|
||||||
|
m_DoubleSidedGI: 0
|
||||||
|
m_CustomRenderQueue: -1
|
||||||
|
stringTagMap: {}
|
||||||
|
disabledShaderPasses: []
|
||||||
|
m_SavedProperties:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TexEnvs:
|
||||||
|
- DifuseMask:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- NormalMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- ReflectionCube:
|
||||||
|
m_Texture: {fileID: 8900000, guid: 6db2befc32f8aeb4abb077c571f41678, type: 3}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _BumpMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailAlbedoMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailMask:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _DetailNormalMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _EmissionMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _Environment:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _MainTex:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _MetallicGlossMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _OcclusionMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _ParallaxMap:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _ShapeTex:
|
||||||
|
m_Texture: {fileID: 2800000, guid: c53b139d80b73df4791af324d78105e1, type: 2}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _Specular:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
m_Ints: []
|
||||||
|
m_Floats:
|
||||||
|
- Brightness: 1.3
|
||||||
|
- Contrast: 1.13
|
||||||
|
- Dispersion: 1.409
|
||||||
|
- DispersionB: 0.843
|
||||||
|
- DispersionG: 0.45
|
||||||
|
- DispersionIntensity: 1
|
||||||
|
- DispersionR: 0.133
|
||||||
|
- MipLevel: 0
|
||||||
|
- PostExposure: 1.14
|
||||||
|
- Power: 1.03
|
||||||
|
- Spec: 0.4
|
||||||
|
- TotalInternalReflection: 1
|
||||||
|
- _BaseReflection: 0.3
|
||||||
|
- _BumpScale: 1
|
||||||
|
- _CubeMapMode: 0
|
||||||
|
- _Cutoff: 0.5
|
||||||
|
- _DetailNormalMapScale: 1
|
||||||
|
- _Disaturate: 0.93
|
||||||
|
- _DstBlend: 0
|
||||||
|
- _GlossMapScale: 1
|
||||||
|
- _Glossiness: 0.5
|
||||||
|
- _GlossyReflections: 1
|
||||||
|
- _Max: 1.02
|
||||||
|
- _Metallic: 0
|
||||||
|
- _Min: -0.02
|
||||||
|
- _Mode: 0
|
||||||
|
- _OcclusionStrength: 1
|
||||||
|
- _Parallax: 0.02
|
||||||
|
- _PlaneCount: 6
|
||||||
|
- _RefractiveIndex: 1.48
|
||||||
|
- _Scale: 0.01260042
|
||||||
|
- _SizeX: 16
|
||||||
|
- _SizeY: 16
|
||||||
|
- _SmoothnessTextureChannel: 0
|
||||||
|
- _SpecularHighlights: 1
|
||||||
|
- _SrcBlend: 1
|
||||||
|
- _UVSec: 0
|
||||||
|
- _ZWrite: 1
|
||||||
|
m_Colors:
|
||||||
|
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||||
|
m_BuildTextureStacks: []
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d3989bff6c3c91540b798d228deb3324
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
250
Assets/Render/SpecialMaterials/JingTi/Zuan/JewelShader.shader
Normal file
250
Assets/Render/SpecialMaterials/JingTi/Zuan/JewelShader.shader
Normal file
@ -0,0 +1,250 @@
|
|||||||
|
|
||||||
|
Shader "Diamonds/DiamondShader" {
|
||||||
|
Properties {
|
||||||
|
|
||||||
|
//_Color ("Color", Color) = (1,1,1,0.1)
|
||||||
|
_ShapeTex("ShapeTex", 2D) = "white" {}
|
||||||
|
|
||||||
|
//_Scale("Scale", Float) = 1
|
||||||
|
_SizeX("SizeX", Int) = 16
|
||||||
|
_SizeY("SizeY", Int) = 16
|
||||||
|
_PlaneCount("PlaneCount", Int) = 6
|
||||||
|
//_MaxReflection("MaxReflection", Int) = 3
|
||||||
|
_Environment ("Environment", CUBE) = "white" {}
|
||||||
|
MipLevel("MipLevel", Range(0.0, 10.0)) = 0.0
|
||||||
|
|
||||||
|
_RefractiveIndex("RefractiveIndex", Range(1,5)) = 1.5
|
||||||
|
|
||||||
|
[KeywordEnum( CubeMap, ReflectionProbe)] _CubeMapMode("CubeMapMode", Float) = 0
|
||||||
|
_BaseReflection("BaseReflection", Range(0,1)) = 0.5
|
||||||
|
Dispersion("Dispersion", Range(0,2)) = 1.2
|
||||||
|
[Space(10)]
|
||||||
|
DispersionR("DispersionR", Range(-0.5,1)) = 0.68
|
||||||
|
DispersionG("DispersionG", Range(-0.5,1)) = 0.4
|
||||||
|
DispersionB("DispersionB", Range(-0.5,1)) = 0.146
|
||||||
|
|
||||||
|
//
|
||||||
|
// FresnelDispersionPower("FresnelDispersionPower", Range(-0.5,5)) = 1.5
|
||||||
|
// FresnelDispersionScale("FresnelDispersionScale", Range(-1.5,5)) = 1.5
|
||||||
|
|
||||||
|
[Space(10)]
|
||||||
|
DispersionIntensity("DispersionIntensity", Range(0,10)) = 1
|
||||||
|
|
||||||
|
TotalInternalReflection("TotalInternalReflection", Range(0,2)) = 1
|
||||||
|
Spec("specular",Range(0,10)) = 1
|
||||||
|
// DispersionLimitedAngle("DispersionLimitedAngle",Range(0,2)) = 0
|
||||||
|
// DispersionHueHandler("DispersionHueHandler",Range(0,2)) = 0.5
|
||||||
|
// lightEstimation("lightEstimation", Float) = 0.4
|
||||||
|
|
||||||
|
// FixedlightEstimation("FixedlightEstimation", Float) = 0.8
|
||||||
|
|
||||||
|
[Space(20)]
|
||||||
|
//_Scale("Scale", Float) = 1
|
||||||
|
|
||||||
|
Brightness("Brightness",Range(0,2)) = 1
|
||||||
|
Power("Power",Range(0,2)) = 1
|
||||||
|
Contrast("Contrast",Range(0,2)) = 1
|
||||||
|
_Disaturate("_Disaturate",Range(0,2)) = 1
|
||||||
|
_Min("Min",Range(-1,1)) = 0
|
||||||
|
_Max("Max",Range(0,2)) = 1
|
||||||
|
PostExposure("PostExposure",Float) = 1
|
||||||
|
|
||||||
|
// ID_("INt",Float) = 1
|
||||||
|
|
||||||
|
// CentreIntensity("CentreIntensity",Range(0,1)) = 0
|
||||||
|
|
||||||
|
ReflectionCube("ReflectionCube", CUBE) = "black" {}
|
||||||
|
NormalMap("NormalMap", 2D) = "bump" {}
|
||||||
|
_Specular("SpecularMap", 2D) = "white" {}
|
||||||
|
DifuseMask("ReflectionMask", 2D) = "black" {}
|
||||||
|
}
|
||||||
|
SubShader{
|
||||||
|
|
||||||
|
Tags { "RenderType" = "Jewel" }
|
||||||
|
LOD 200
|
||||||
|
|
||||||
|
Pass
|
||||||
|
{
|
||||||
|
CGPROGRAM
|
||||||
|
// Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it uses non-square matrices
|
||||||
|
#pragma exclude_renderers gles
|
||||||
|
|
||||||
|
|
||||||
|
#pragma multi_compile _CUBEMAPMODE_CUBEMAP _CUBEMAPMODE_REFLECTIONPROBE
|
||||||
|
|
||||||
|
|
||||||
|
#pragma vertex vert
|
||||||
|
#pragma fragment frag
|
||||||
|
#include "UnityCG.cginc"
|
||||||
|
#include "JewelShaderInc.cginc"
|
||||||
|
#include "Lighting.cginc"
|
||||||
|
|
||||||
|
|
||||||
|
sampler2D DifuseMask;
|
||||||
|
uniform float4 DifuseMask_ST;
|
||||||
|
sampler2D _Specular;
|
||||||
|
float4 _Specular_ST;
|
||||||
|
uniform float4 NormalMap_ST;
|
||||||
|
uniform sampler2D NormalMap;
|
||||||
|
float Spec;
|
||||||
|
sampler2D _Pos;
|
||||||
|
float Reflection;
|
||||||
|
float Contrast;
|
||||||
|
float PostExposure;
|
||||||
|
float _Min;
|
||||||
|
float _Max;
|
||||||
|
float _Disaturate;
|
||||||
|
float DispersionHueHandler;
|
||||||
|
// float lightEstimation;
|
||||||
|
float ID_;
|
||||||
|
float FresnelPower;
|
||||||
|
float FresnelScale;
|
||||||
|
float ior_r = 2.408;
|
||||||
|
float ior_g = 2.424;
|
||||||
|
float ior_b = 2.432;
|
||||||
|
float4 _Color;
|
||||||
|
float lighttransmission;
|
||||||
|
|
||||||
|
|
||||||
|
fixed4 frag(v2f i) : SV_Target
|
||||||
|
{
|
||||||
|
float3 cameraLocalPos;
|
||||||
|
|
||||||
|
cameraLocalPos = i.Pos2;
|
||||||
|
float3 pos = i.Pos;
|
||||||
|
|
||||||
|
float3 localRay = normalize(pos - cameraLocalPos) ;
|
||||||
|
|
||||||
|
float3 normal = i.Normal;
|
||||||
|
float4 plane = float4(normal, dot(pos, normal));
|
||||||
|
|
||||||
|
float reflectionRate = 0;
|
||||||
|
float reflectionRate2 = 0;
|
||||||
|
float3 reflectionRay;
|
||||||
|
float3 refractionRay;
|
||||||
|
|
||||||
|
float tmpR = _RefractiveIndex;
|
||||||
|
|
||||||
|
//tmpR = tmpR * 2;
|
||||||
|
float PlaneNull;
|
||||||
|
//折射的颜色
|
||||||
|
//reflectionRate = 1.0;
|
||||||
|
CollideRayWithPlane(pos,0,localRay, plane, 1.0/tmpR, reflectionRate, reflectionRate2, reflectionRay, refractionRay, PlaneNull);
|
||||||
|
float4 refractionColor = GetColorByRay(pos, refractionRay, tmpR, 0, _Color, lighttransmission);
|
||||||
|
refractionColor.w = 1.0;
|
||||||
|
//return float4(refractionColor);
|
||||||
|
|
||||||
|
|
||||||
|
float3 _worldViewDir = UnityWorldSpaceViewDir(i.worldPos);
|
||||||
|
_worldViewDir = normalize(_worldViewDir);
|
||||||
|
|
||||||
|
float fresnelNdotV5 = dot(normal, _worldViewDir);
|
||||||
|
float fresnelNode5 = (1 * pow(1.0 - fresnelNdotV5,1));
|
||||||
|
|
||||||
|
//float3 _worldReflection = reflect(-_worldViewDir, normal);
|
||||||
|
|
||||||
|
//float3 _worldTangent = i.tangent.xyz;
|
||||||
|
float3 _worldNormal = i.WorldNormal.xyz;
|
||||||
|
//float3 _worldBitangent = i.WorldBitangent.xyz;
|
||||||
|
//float3 tanToWorld0 = float3(_worldTangent.x, _worldBitangent.x, _worldNormal.x);
|
||||||
|
//float3 tanToWorld1 = float3(_worldTangent.y, _worldBitangent.y, _worldNormal.y);
|
||||||
|
//float3 tanToWorld2 = float3(_worldTangent.z, _worldBitangent.z, _worldNormal.z);
|
||||||
|
|
||||||
|
//float2 uvNormal = i.uv * NormalMap_ST.xy + NormalMap_ST.zw;
|
||||||
|
|
||||||
|
float3 worldRefl3 = reflect(-_worldViewDir,_worldNormal);// float3(dot(tanToWorld0, UnpackNormal(tex2D(NormalMap, uvNormal))), dot(tanToWorld1, UnpackNormal(tex2D(NormalMap, uvNormal))), dot(tanToWorld2, UnpackNormal(tex2D(NormalMap, uvNormal)))));
|
||||||
|
|
||||||
|
|
||||||
|
float spec_ = tex2D(_Specular, i.uv * _Specular_ST.xy + _Specular_ST.zw) * Spec;
|
||||||
|
//反射的颜色
|
||||||
|
float4 reflectionColor = texCUBE(ReflectionCube, worldRefl3) * spec_ * fresnelNode5;
|
||||||
|
//return float4(reflectionColor);
|
||||||
|
//float Hue = rgb2hsv(refractionColor.rgb).r;
|
||||||
|
|
||||||
|
//float Dis = dot(refractionColor.rgb, float3(0.299, 0.587, 0.114));
|
||||||
|
|
||||||
|
refractionColor = lerp(refractionColor, reflectionColor, tex2D(DifuseMask, i.uv * DifuseMask_ST.xy + DifuseMask_ST.zw));
|
||||||
|
|
||||||
|
float4 Fin = lerp(reflectionColor, refractionColor * (1.0 - reflectionRate), 1 - reflectionColor);
|
||||||
|
|
||||||
|
Fin = refractionColor + reflectionColor;
|
||||||
|
//曝光、饱和度、最大值、最小值、对比度
|
||||||
|
Fin = ToneMap(Fin, PostExposure, _Disaturate, _Max, _Min, Contrast, 1);
|
||||||
|
|
||||||
|
// if (Fin.r > 1) {
|
||||||
|
// Fin.rgb = Fin.rgb * 8;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return Fin;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ENDCG
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Pass
|
||||||
|
{
|
||||||
|
Name "ShadowCaster"
|
||||||
|
Tags { "LightMode" = "ShadowCaster" }
|
||||||
|
|
||||||
|
ZWrite On ZTest LEqual Cull Off
|
||||||
|
|
||||||
|
CGPROGRAM
|
||||||
|
#pragma vertex vert
|
||||||
|
#pragma fragment frag
|
||||||
|
#pragma target 2.0
|
||||||
|
#pragma multi_compile_shadowcaster
|
||||||
|
#include "UnityCG.cginc"
|
||||||
|
|
||||||
|
|
||||||
|
float4 CentrePivotDiamond;
|
||||||
|
float4 CentrePivotDiamond2;
|
||||||
|
float CentreIntensity;
|
||||||
|
float4x4 MatrixWorldToObject;
|
||||||
|
float4x4 MatrixWorldToObject2;
|
||||||
|
float4 CentreModel;
|
||||||
|
|
||||||
|
struct v2f {
|
||||||
|
V2F_SHADOW_CASTER;
|
||||||
|
UNITY_VERTEX_OUTPUT_STEREO
|
||||||
|
};
|
||||||
|
|
||||||
|
v2f vert(appdata_base v)
|
||||||
|
{
|
||||||
|
v2f o;
|
||||||
|
UNITY_SETUP_INSTANCE_ID(v);
|
||||||
|
|
||||||
|
float4 pos = v.vertex;
|
||||||
|
|
||||||
|
pos.xyz = lerp(pos.xyz, (pos.xyz - CentreModel.xyz), CentreIntensity);
|
||||||
|
|
||||||
|
o.pos = UnityObjectToClipPos(pos);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||||
|
TRANSFER_SHADOW_CASTER_NORMALOFFSET(o)
|
||||||
|
o.pos = UnityObjectToClipPos(pos);
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
float4 frag(v2f i) : SV_Target
|
||||||
|
{
|
||||||
|
SHADOW_CASTER_FRAGMENT(i)
|
||||||
|
}
|
||||||
|
ENDCG
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
FallBack "Diffuse"
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6aa8c547a830c6944a78a6934111b781
|
||||||
|
ShaderImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
defaultTextures:
|
||||||
|
- _ShapeTex: {instanceID: 0}
|
||||||
|
- _Environment: {fileID: 8900000, guid: 43857f64b9cb80249bfee47fc411e27d, type: 3}
|
||||||
|
- ReflectionCube: {fileID: 8900000, guid: 5fb5922f716d8d545b0c1dea1fecc2a5, type: 3}
|
||||||
|
- NormalMap: {instanceID: 0}
|
||||||
|
- _Specular: {instanceID: 0}
|
||||||
|
- DifuseMask: {instanceID: 0}
|
||||||
|
nonModifiableTextures: []
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
436
Assets/Render/SpecialMaterials/JingTi/Zuan/JewelShaderInc.cginc
Normal file
436
Assets/Render/SpecialMaterials/JingTi/Zuan/JewelShaderInc.cginc
Normal file
@ -0,0 +1,436 @@
|
|||||||
|
// Upgrade NOTE: replaced 'UNITY_PASS_TEXCUBE(unity_SpecCube1)' with 'UNITY_PASS_TEXCUBE_SAMPLER(unity_SpecCube1,unity_SpecCube0)'
|
||||||
|
|
||||||
|
|
||||||
|
float Test_;
|
||||||
|
|
||||||
|
struct appdata
|
||||||
|
{
|
||||||
|
float4 vertex : POSITION;
|
||||||
|
float3 normal : NORMAL0;
|
||||||
|
float2 uv : TEXCOORD0;
|
||||||
|
float2 uv2 : TEXCOORD1;
|
||||||
|
float2 uv3 : TEXCOORD2;
|
||||||
|
float2 uv4 : TEXCOORD3;
|
||||||
|
float2 uv5 : TEXCOORD4;
|
||||||
|
float4 Color : COLOR;
|
||||||
|
uint id : SV_VertexID;
|
||||||
|
float4 tangent : TANGENT;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
float FresnelDispersionPower;
|
||||||
|
float FresnelDispersionScale;
|
||||||
|
float ColorByDepth;
|
||||||
|
|
||||||
|
float CentreIntensity;
|
||||||
|
float4x4 MatrixWorldToObject;
|
||||||
|
float4x4 MatrixWorldToObject2;
|
||||||
|
float4 CentreModel;
|
||||||
|
float lightEstimation2;
|
||||||
|
float MipLevel;
|
||||||
|
|
||||||
|
samplerCUBE _Environment;
|
||||||
|
half4 _Environment_HDR;
|
||||||
|
float FixedlightEstimation;
|
||||||
|
float ColorIntensity;
|
||||||
|
struct v2f
|
||||||
|
{
|
||||||
|
float2 uv : TEXCOORD0;
|
||||||
|
float2 uv2 : TEXCOORD1;
|
||||||
|
float2 uv3 : TEXCOORD2;
|
||||||
|
float3 WorldBitangent : TEXCOORD3;
|
||||||
|
float3 WorldNormal : TEXCOORD4;
|
||||||
|
float4 vertex : SV_POSITION0;
|
||||||
|
float3 Pos : TEXCOORD5;
|
||||||
|
float3 Pos2 : TEXCOORD6;
|
||||||
|
float3 Normal : NORMAL0;
|
||||||
|
float4 Color : COLOR;
|
||||||
|
uint id : TEXCOORD7;
|
||||||
|
float3 worldPos : TEXCOORD8;
|
||||||
|
float4 tangent : TEXCOORD9;
|
||||||
|
};
|
||||||
|
|
||||||
|
// vertex shader
|
||||||
|
v2f vert (appdata v)
|
||||||
|
{
|
||||||
|
v2f o;
|
||||||
|
UNITY_INITIALIZE_OUTPUT(v2f, o);
|
||||||
|
|
||||||
|
float3 _worldTangent = UnityObjectToWorldDir(v.tangent);
|
||||||
|
o.tangent.xyz = _worldTangent;
|
||||||
|
float3 _worldNormal = UnityObjectToWorldNormal(v.normal);
|
||||||
|
o.WorldNormal.xyz = _worldNormal;
|
||||||
|
float _vertexTangentSign = v.tangent.w * unity_WorldTransformParams.w;
|
||||||
|
float3 _worldBitangent = cross(_worldNormal, _worldTangent) * _vertexTangentSign;
|
||||||
|
o.WorldBitangent.xyz = _worldBitangent;
|
||||||
|
|
||||||
|
float4 pos = v.vertex;
|
||||||
|
|
||||||
|
pos.xyz = (pos.xyz - CentreModel.xyz);
|
||||||
|
|
||||||
|
float3 cameraLocalPos;
|
||||||
|
|
||||||
|
cameraLocalPos = mul(MatrixWorldToObject, float4(_WorldSpaceCameraPos, 1));
|
||||||
|
|
||||||
|
o.Pos2 = cameraLocalPos;
|
||||||
|
|
||||||
|
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||||
|
o.uv = v.uv;
|
||||||
|
o.uv2 = v.uv2;
|
||||||
|
o.uv3 = v.uv3;
|
||||||
|
o.Pos = float4(pos.xyz, 1);
|
||||||
|
o.Normal = v.normal;
|
||||||
|
o.Color = v.Color;
|
||||||
|
o.id = v.id;
|
||||||
|
o.worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float Dispersion;
|
||||||
|
|
||||||
|
float DispersionLimitedAngle;
|
||||||
|
|
||||||
|
float DispersionR;
|
||||||
|
float DispersionG;
|
||||||
|
float DispersionB;
|
||||||
|
float Brightness;
|
||||||
|
float Power;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
float DispersionIntensity;
|
||||||
|
sampler2D _ShapeTex;
|
||||||
|
float _Scale;
|
||||||
|
float TotalInternalReflection;
|
||||||
|
int _SizeX;
|
||||||
|
int _SizeY;
|
||||||
|
int _PlaneCount;
|
||||||
|
int _MaxReflection;
|
||||||
|
|
||||||
|
samplerCUBE ReflectionCube;
|
||||||
|
// samplerCUBE _Environment;
|
||||||
|
// half4 _Environment_HDR;
|
||||||
|
float _RefractiveIndex;
|
||||||
|
float _RefractiveIndex_;
|
||||||
|
float _BaseReflection;
|
||||||
|
#define MAX_REFLECTION (10)
|
||||||
|
|
||||||
|
float random(float2 st)
|
||||||
|
{
|
||||||
|
float r = frac(sin(dot(st.xy,float2(12.9898, 78.233)))* 43758.5453123);
|
||||||
|
return r * clamp(pow(distance(r, 0.6), 2.5) * 100, 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
float CalcReflectionRate(float3 normal, float3 ray, float baseReflection, float borderDot)
|
||||||
|
{
|
||||||
|
|
||||||
|
float normalizedDot = clamp((abs(dot(normal, ray)) - borderDot) / (1.0 - borderDot), 0.0, 1.0);
|
||||||
|
return baseReflection + (1.0-baseReflection)*pow(1.0-normalizedDot, 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
half rgb2hsv(half3 c)
|
||||||
|
{
|
||||||
|
half4 K = half4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
||||||
|
half4 p = lerp(half4(c.bg, K.wz), half4(c.gb, K.xy), step(c.b, c.g));
|
||||||
|
half4 q = lerp(half4(p.xyw, c.r), half4(c.r, p.yzx), step(p.x, c.r));
|
||||||
|
|
||||||
|
float d = q.x - min(q.w, q.y);
|
||||||
|
float e = 1.0e-10;
|
||||||
|
return abs(q.z + (q.w - q.y) / (6.0 * d + e));
|
||||||
|
}
|
||||||
|
|
||||||
|
float Remap(float value, float min1, float max1, float min2, float max2)
|
||||||
|
{
|
||||||
|
return (min2 + (value - min1) * (max2 - min2) / (max1 - min1));
|
||||||
|
}
|
||||||
|
|
||||||
|
float4 GetUnpackedPlaneByIndex(uint index)
|
||||||
|
{
|
||||||
|
int x_index = index % _SizeX;
|
||||||
|
int y_index = index / _SizeX;
|
||||||
|
|
||||||
|
float ustride = 1.0 / _SizeX;
|
||||||
|
float vstride = 1.0 / _SizeY;
|
||||||
|
|
||||||
|
float2 uv = float2((0.5+x_index)*ustride, (0.5+y_index)*vstride);
|
||||||
|
|
||||||
|
float4 packedPlane = tex2D(_ShapeTex, uv);
|
||||||
|
|
||||||
|
#if !defined(UNITY_COLORSPACE_GAMMA)
|
||||||
|
packedPlane.xyz = LinearToGammaSpace(packedPlane.xyz);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
float3 normal = packedPlane.xyz*2 - float3(1,1,1); // смена диапозона
|
||||||
|
|
||||||
|
return float4(normal, packedPlane.w*_Scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float CheckCollideRayWithPlane(float3 rayStart, float3 rayNormalized, float4 normalTriangle) // plane - normal.xyz и normal.w - distance
|
||||||
|
{
|
||||||
|
float dp = dot(rayNormalized, normalTriangle.xyz);
|
||||||
|
if( dp < 0 )
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float distanceNormalized = normalTriangle.w - dot(rayStart.xyz, normalTriangle.xyz);
|
||||||
|
if( distanceNormalized < 0 )
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return distanceNormalized / dp;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CollideRayWithPlane(float3 Pos, float PassCount, float3 rayNormalized, float4 TriangleNormal, float startSideRelativeRefraction, out float reflectionRate, out float reflectionRate2, out float3 reflection, out float3 refraction, out float HorizontalElementSquared)
|
||||||
|
{
|
||||||
|
float3 rayVertical = dot(TriangleNormal.xyz, rayNormalized) * TriangleNormal.xyz;
|
||||||
|
reflection = rayNormalized - rayVertical*2.0;
|
||||||
|
|
||||||
|
|
||||||
|
float3 rayHorizontal = rayNormalized - rayVertical;
|
||||||
|
|
||||||
|
float3 refractHorizontal = rayHorizontal * startSideRelativeRefraction ;
|
||||||
|
|
||||||
|
float horizontalElementSquared = dot(refractHorizontal, refractHorizontal);
|
||||||
|
|
||||||
|
float borderDot = 0;
|
||||||
|
|
||||||
|
|
||||||
|
if( startSideRelativeRefraction > 1.0 )
|
||||||
|
{
|
||||||
|
borderDot = sqrt(1.0-1.0f/(startSideRelativeRefraction*startSideRelativeRefraction));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
borderDot = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
HorizontalElementSquared = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HorizontalElementSquared = horizontalElementSquared /3;
|
||||||
|
if (horizontalElementSquared >= TotalInternalReflection)
|
||||||
|
{
|
||||||
|
HorizontalElementSquared = 0;
|
||||||
|
reflectionRate = 1.0;
|
||||||
|
reflectionRate2 = 1.0;
|
||||||
|
refraction = TriangleNormal.xyz;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
float verticalSizeSquared = 1-horizontalElementSquared;
|
||||||
|
float3 refractVertical = rayVertical * sqrt( verticalSizeSquared / dot(rayVertical, rayVertical));
|
||||||
|
|
||||||
|
|
||||||
|
refraction = refractHorizontal + refractVertical;
|
||||||
|
reflectionRate = CalcReflectionRate(rayNormalized, TriangleNormal.xyz, _BaseReflection * PassCount, borderDot);
|
||||||
|
reflectionRate2 =0;// CalcReflectionRate(rayNormalized, TriangleNormal.xyz, _BaseReflection * PassCount, borderDot);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
float3 CalcColorCoefByDistance(float distance,float4 Color)
|
||||||
|
{
|
||||||
|
return lerp(pow(max(Color.xyz, 0.01), distance * Color.w), Color.rgb, ColorByDepth);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
float4 SampleEnvironment(float3 rayLocal)
|
||||||
|
{
|
||||||
|
float3 rayWorld = mul(unity_ObjectToWorld, float4(rayLocal, 0));
|
||||||
|
|
||||||
|
rayWorld = normalize(rayWorld);
|
||||||
|
|
||||||
|
|
||||||
|
#if _CUBEMAPMODE_CUBEMAP
|
||||||
|
float4 tex = texCUBElod(_Environment, float4(rayWorld,MipLevel));
|
||||||
|
return float4(DecodeHDR(tex, _Environment_HDR), 1);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if _CUBEMAPMODE_REFLECTIONPROBE
|
||||||
|
float4 tex = UNITY_SAMPLE_TEXCUBE_LOD(unity_SpecCube0,rayWorld, MipLevel);
|
||||||
|
return float4(DecodeHDR(tex, unity_SpecCube0_HDR), 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CheckCollideRayWithAllPlanes(float3 rayStart, float3 rayDirection, out float4 hitPlane, out float hitTime)
|
||||||
|
{
|
||||||
|
hitTime=1000000.0;
|
||||||
|
hitPlane=float4(1,0,0,1);
|
||||||
|
//[unroll(20)]
|
||||||
|
for(int i=0; i<_PlaneCount; ++i)
|
||||||
|
{
|
||||||
|
float4 plane = GetUnpackedPlaneByIndex(i);
|
||||||
|
float tmpTime = CheckCollideRayWithPlane(rayStart, rayDirection, plane);
|
||||||
|
|
||||||
|
if(tmpTime >= -0.001 && tmpTime<hitTime)
|
||||||
|
{
|
||||||
|
hitTime = tmpTime;
|
||||||
|
hitPlane = plane;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float4 GetColorByRay(float3 rayStart, float3 rayDirection, float refractiveIndex, int MaxReflection, float4 Color, float lighttransmission)
|
||||||
|
{
|
||||||
|
float3 tmpRayStart = rayStart;
|
||||||
|
float3 tmpRayDirection = rayDirection;
|
||||||
|
float reflectionRates[MAX_REFLECTION];
|
||||||
|
float reflectionRates2[MAX_REFLECTION];
|
||||||
|
float4 refractionColors[MAX_REFLECTION];
|
||||||
|
float4 refractionColors2[MAX_REFLECTION];
|
||||||
|
float4 refractionColors3[MAX_REFLECTION];
|
||||||
|
float4 depthColors[MAX_REFLECTION];
|
||||||
|
|
||||||
|
int loopCount = min(MAX_REFLECTION, _MaxReflection);
|
||||||
|
|
||||||
|
int badRay = 0;
|
||||||
|
|
||||||
|
// [unroll(10)]
|
||||||
|
for( int i = 0; i<loopCount; ++i )
|
||||||
|
{
|
||||||
|
float hitTime=1000000.0;
|
||||||
|
float4 hitPlane=float4(1,0,0,1);
|
||||||
|
CheckCollideRayWithAllPlanes(tmpRayStart, tmpRayDirection, hitPlane, hitTime);
|
||||||
|
|
||||||
|
if (hitTime < 0.0)
|
||||||
|
{
|
||||||
|
badRay = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
float3 rayEnd = tmpRayStart + tmpRayDirection*hitTime;
|
||||||
|
|
||||||
|
float reflectionRate;
|
||||||
|
float reflectionRate2;
|
||||||
|
float3 reflectionRay;
|
||||||
|
float3 refractionRay;
|
||||||
|
float PlaneNull;
|
||||||
|
|
||||||
|
float i_Pass = i;
|
||||||
|
|
||||||
|
if (i_Pass >= 2)
|
||||||
|
{
|
||||||
|
i_Pass = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i_Pass < 2)
|
||||||
|
{
|
||||||
|
i_Pass = 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CollideRayWithPlane(rayStart, i_Pass, tmpRayDirection, hitPlane, refractiveIndex, reflectionRate,reflectionRate2, reflectionRay, refractionRay, PlaneNull);
|
||||||
|
|
||||||
|
reflectionRates[i] = reflectionRate;
|
||||||
|
|
||||||
|
reflectionRates2[i] = reflectionRate2;
|
||||||
|
|
||||||
|
float3 _worldViewDir = UnityWorldSpaceViewDir(rayStart.xyz);
|
||||||
|
_worldViewDir = normalize(_worldViewDir);
|
||||||
|
|
||||||
|
float fresnelNdotV5 = dot(tmpRayStart, _worldViewDir);
|
||||||
|
float fresnelNode5 = (FresnelDispersionScale * pow(1.0 - fresnelNdotV5, FresnelDispersionPower));
|
||||||
|
|
||||||
|
fresnelNode5 = 1;
|
||||||
|
|
||||||
|
DispersionR = DispersionR * Dispersion * fresnelNode5;
|
||||||
|
DispersionG = DispersionG * Dispersion * fresnelNode5;
|
||||||
|
DispersionB = DispersionB * Dispersion * fresnelNode5;
|
||||||
|
|
||||||
|
|
||||||
|
float3 DispersionRay_r = lerp(refractionRay, lerp(rayEnd, refractionRay,2), DispersionR * PlaneNull);
|
||||||
|
|
||||||
|
float3 DispersionRay_g = lerp(refractionRay, lerp(rayEnd, refractionRay, 2), DispersionG * PlaneNull);
|
||||||
|
|
||||||
|
float3 DispersionRay_b = lerp(refractionRay, lerp(rayEnd, refractionRay, 2), DispersionB * PlaneNull);
|
||||||
|
|
||||||
|
refractionColors3[i] = SampleEnvironment(refractionRay);
|
||||||
|
|
||||||
|
refractionColors2[i] = 1;
|
||||||
|
|
||||||
|
refractionColors2[i].r = SampleEnvironment(DispersionRay_r).r;
|
||||||
|
refractionColors2[i].g = SampleEnvironment(DispersionRay_g).g;
|
||||||
|
refractionColors2[i].b = SampleEnvironment(DispersionRay_b).b;
|
||||||
|
|
||||||
|
Color.rgb = lerp(1, Color, ColorIntensity).rgb;
|
||||||
|
|
||||||
|
depthColors[i] = float4(CalcColorCoefByDistance(hitTime, lerp(Color, 1, lerp(0, (refractionColors3[i].r + refractionColors3[i].g + refractionColors3[i].b) / 2, lighttransmission))), 1);
|
||||||
|
|
||||||
|
refractionColors2[i] = clamp(lerp(refractionColors3[i], refractionColors2[i], DispersionIntensity),0,1);
|
||||||
|
|
||||||
|
refractionColors[i] = SampleEnvironment(refractionRay);
|
||||||
|
|
||||||
|
if (i == loopCount - 1)
|
||||||
|
{
|
||||||
|
reflectionRates[i] = 0.0;
|
||||||
|
reflectionRates2[i] = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
tmpRayStart = tmpRayStart + tmpRayDirection * hitTime;
|
||||||
|
tmpRayDirection = reflectionRay;
|
||||||
|
}
|
||||||
|
|
||||||
|
float4 tmpReflectionColor = float4(0, 0, 0, 0);
|
||||||
|
|
||||||
|
for (int j = loopCount - 1; j >= 0; --j)
|
||||||
|
{
|
||||||
|
|
||||||
|
tmpReflectionColor = lerp(refractionColors2[j], tmpReflectionColor, reflectionRates[j]) * depthColors[j];
|
||||||
|
tmpReflectionColor = pow(tmpReflectionColor * Brightness, Power);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (badRay > 0)
|
||||||
|
{
|
||||||
|
return float4(1, 0, 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return tmpReflectionColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float4 CalculateContrast(float contrastValue, float4 colorTarget)
|
||||||
|
{
|
||||||
|
float t = 0.5 * (1.0 - contrastValue);
|
||||||
|
return mul(float4x4(contrastValue, 0, 0, t, 0, contrastValue, 0, t, 0, 0, contrastValue, t, 0, 0, 0, 1), colorTarget);
|
||||||
|
}
|
||||||
|
//曝光、饱和、对比调整颜色
|
||||||
|
float4 ToneMap(float4 MainColor, float brightness, float Disaturate, float _max, float _min, float contrast, float Satur)
|
||||||
|
{
|
||||||
|
fixed4 output = MainColor;
|
||||||
|
output = output * brightness;
|
||||||
|
output = CalculateContrast(contrast, output);
|
||||||
|
|
||||||
|
float4 disatur = dot(output, float3(0.299, 0.587, 0.114)); // Desaturate
|
||||||
|
output = lerp(output, disatur, clamp(pow(((output.x + output.y + output.z) / 3) * Disaturate, 1.3), 0, 1));
|
||||||
|
output.x = clamp(Remap(output.x, 0, 1, _min, lerp(_max, 1, 0.5)), 0, 1.5);
|
||||||
|
output.y = clamp(Remap(output.y, 0, 1, _min, lerp(_max, 1, 0.5)), 0, 1.5);
|
||||||
|
output.z = clamp(Remap(output.z, 0, 1, _min, lerp(_max, 1, 0.5)), 0, 1.5);
|
||||||
|
|
||||||
|
output = pow(output, contrast);
|
||||||
|
|
||||||
|
output = lerp(clamp(output, 0, _max), output, pow(_max, 4));
|
||||||
|
|
||||||
|
output = lerp(smoothstep(output, -0.1, 0.25), output, (1 - distance(1, _max) * 2));
|
||||||
|
|
||||||
|
output = lerp(dot(output, float3(0.299, 0.587, 0.114)), output, Satur);
|
||||||
|
|
||||||
|
output = output * lerp(brightness, 1, 0.75);
|
||||||
|
|
||||||
|
return output;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d4a4d920ed2fb7e44943172caec6ce6f
|
||||||
|
ShaderImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
defaultTextures: []
|
||||||
|
nonModifiableTextures: []
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Loading…
x
Reference in New Issue
Block a user