浏览代码
Merge pull request #207 from Unity-Technologies/Branch_WindV1
Merge pull request #207 from Unity-Technologies/Branch_WindV1
Added first version of vertex wind and a corresponding test scene./fptl_cleanup
GitHub
8 年前
当前提交
5ae8a937
共有 34 个文件被更改,包括 3684 次插入 和 8 次删除
-
3Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/Editor/LayeredLitUI.cs
-
9Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLit.shader
-
9Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLitTessellation.shader
-
51Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Editor/BaseLitUI.cs
-
9Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.shader
-
6Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitProperties.hlsl
-
9Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitTessellation.shader
-
5Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Unlit/Editor/BaseUnlitUI.cs
-
5Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Unlit/Editor/UnlitUI.cs
-
36Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/VertMesh.hlsl
-
9Assets/ScriptableRenderPipeline/HDRenderPipeline/Wind.meta
-
111Assets/ScriptableRenderPipeline/ShaderLibrary/Wind.hlsl
-
9Assets/ScriptableRenderPipeline/ShaderLibrary/Wind.hlsl.meta
-
9Assets/TestScenes/HDTest/WindTest.meta
-
1001Assets/TestScenes/HDTest/WindTest.unity
-
8Assets/TestScenes/HDTest/WindTest.unity.meta
-
610Assets/ScriptableRenderPipeline/HDRenderPipeline/Wind/3DNoise.psd
-
88Assets/ScriptableRenderPipeline/HDRenderPipeline/Wind/3DNoise.psd.meta
-
88Assets/ScriptableRenderPipeline/HDRenderPipeline/Wind/GustNoise.psd.meta
-
101Assets/ScriptableRenderPipeline/HDRenderPipeline/Wind/ShaderWindSettings.cs
-
12Assets/ScriptableRenderPipeline/HDRenderPipeline/Wind/ShaderWindSettings.cs.meta
-
20Assets/TestScenes/HDTest/WindTest/CommonSettings_WindTest.asset
-
9Assets/TestScenes/HDTest/WindTest/CommonSettings_WindTest.asset.meta
-
20Assets/TestScenes/HDTest/WindTest/HDRISkySettings_WindTest.asset
-
9Assets/TestScenes/HDTest/WindTest/HDRISkySettings_WindTest.asset.meta
-
172Assets/TestScenes/HDTest/WindTest/Lit_Leaf_Wind.mat
-
9Assets/TestScenes/HDTest/WindTest/Lit_Leaf_Wind.mat.meta
-
172Assets/TestScenes/HDTest/WindTest/Lit_Trunk_Wind.mat
-
9Assets/TestScenes/HDTest/WindTest/Lit_Trunk_Wind.mat.meta
-
1001Assets/TestScenes/HDTest/WindTest/TreeVxColorSetup.FBX
-
83Assets/TestScenes/HDTest/WindTest/TreeVxColorSetup.FBX.meta
|
|||
fileFormatVersion: 2 |
|||
guid: b2d13ac8e0566e54d8626ea678c3cc5c |
|||
folderAsset: yes |
|||
timeCreated: 1490889129 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
// Globals |
|||
TEXTURE2D(WIND_SETTINGS_TexNoise); |
|||
SAMPLER2D(sampler_WIND_SETTINGS_TexNoise); |
|||
TEXTURE2D(WIND_SETTINGS_TexGust); |
|||
SAMPLER2D(sampler_WIND_SETTINGS_TexGust); |
|||
|
|||
float4 WIND_SETTINGS_WorldDirectionAndSpeed; |
|||
float WIND_SETTINGS_FlexNoiseScale; |
|||
float WIND_SETTINGS_ShiverNoiseScale; |
|||
float WIND_SETTINGS_Turbulence; |
|||
float WIND_SETTINGS_GustSpeed; |
|||
float WIND_SETTINGS_GustScale; |
|||
float WIND_SETTINGS_GustWorldScale; |
|||
|
|||
float AttenuateTrunk(float x, float s) |
|||
{ |
|||
float r = (x / s); |
|||
return pow(r,1/s); |
|||
} |
|||
|
|||
|
|||
float3 Rotate(float3 pivot, float3 position, float3 rotationAxis, float angle) |
|||
{ |
|||
rotationAxis = normalize(rotationAxis); |
|||
float3 cpa = pivot + rotationAxis * dot(rotationAxis, position - pivot); |
|||
return cpa + ((position - cpa) * cos(angle) + cross(rotationAxis, (position - cpa)) * sin(angle)); |
|||
} |
|||
|
|||
struct WindData |
|||
{ |
|||
float3 Direction; |
|||
float Strength; |
|||
float3 ShiverStrength; |
|||
}; |
|||
|
|||
|
|||
float3 texNoise(float3 worldPos, float LOD) |
|||
{ |
|||
return SAMPLE_TEXTURE2D_LOD(WIND_SETTINGS_TexNoise, sampler_WIND_SETTINGS_TexNoise, worldPos.xz, LOD).xyz -0.5; |
|||
} |
|||
|
|||
float texGust(float3 worldPos, float LOD) |
|||
{ |
|||
return SAMPLE_TEXTURE2D_LOD(WIND_SETTINGS_TexGust, sampler_WIND_SETTINGS_TexGust, worldPos.xz, LOD).x; |
|||
} |
|||
|
|||
|
|||
WindData GetAnalyticalWind(float3 WorldPosition, float3 PivotPosition, float drag, float shiverDrag, float initialBend, float4 time) |
|||
{ |
|||
WindData result; |
|||
float3 normalizedDir = normalize(WIND_SETTINGS_WorldDirectionAndSpeed.xyz); |
|||
|
|||
float3 worldOffset = normalizedDir * WIND_SETTINGS_WorldDirectionAndSpeed.w * time.y; |
|||
float3 gustWorldOffset = normalizedDir * WIND_SETTINGS_GustSpeed * time.y; |
|||
|
|||
// Trunk noise is base wind + gusts + noise |
|||
|
|||
float3 trunk = float3(0,0,0); |
|||
|
|||
if(WIND_SETTINGS_WorldDirectionAndSpeed.w > 0.0f || WIND_SETTINGS_Turbulence > 0.0f) |
|||
{ |
|||
trunk = texNoise((PivotPosition - worldOffset)*WIND_SETTINGS_FlexNoiseScale,3); |
|||
} |
|||
|
|||
float gust = 0.0f; |
|||
|
|||
if(WIND_SETTINGS_GustSpeed > 0.0f) |
|||
{ |
|||
gust = texGust((PivotPosition - gustWorldOffset)*WIND_SETTINGS_GustWorldScale,3); |
|||
gust = pow(gust, 2) * WIND_SETTINGS_GustScale; |
|||
} |
|||
|
|||
float3 trunkNoise = |
|||
( |
|||
(normalizedDir * WIND_SETTINGS_WorldDirectionAndSpeed.w) |
|||
+ (gust * normalizedDir * WIND_SETTINGS_GustSpeed) |
|||
+ (trunk * WIND_SETTINGS_Turbulence) |
|||
) * drag; |
|||
|
|||
// Shiver Noise |
|||
float3 shiverNoise = texNoise((WorldPosition - worldOffset)*WIND_SETTINGS_ShiverNoiseScale,0) * shiverDrag * WIND_SETTINGS_Turbulence; |
|||
|
|||
float3 dir = trunkNoise; |
|||
float flex = length(trunkNoise) + initialBend; |
|||
float shiver = length(shiverNoise); |
|||
|
|||
result.Direction = dir; |
|||
result.Strength = flex; |
|||
result.ShiverStrength = shiver; |
|||
|
|||
return result; |
|||
} |
|||
|
|||
|
|||
|
|||
void ApplyWind(inout float3 worldPos, inout float3 worldNormal, float3 rootWP, float stiffness, float drag, float shiverDrag, float initialBend, float shiverMask, float4 time) |
|||
{ |
|||
WindData wind = GetAnalyticalWind(worldPos, rootWP, drag, shiverDrag, initialBend, time); |
|||
|
|||
if(wind.Strength > 0.0f) |
|||
{ |
|||
float att = AttenuateTrunk(distance(worldPos, rootWP), stiffness); |
|||
float3 rotAxis = cross(float3(0, 1, 0), wind.Direction); |
|||
|
|||
worldPos = Rotate(rootWP, worldPos, rotAxis, (wind.Strength) * 0.001 * att); |
|||
worldPos += wind.ShiverStrength * worldNormal * shiverMask; |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: 897dbac389e91c44ca027c77c82f4370 |
|||
timeCreated: 1490883742 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 0d8ee11a8d245984d9d20a1918ba0207 |
|||
folderAsset: yes |
|||
timeCreated: 1490879592 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
1001
Assets/TestScenes/HDTest/WindTest.unity
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 1497b92d367b1304c9b0ebb600d996d3 |
|||
timeCreated: 1490879629 |
|||
licenseType: Pro |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
8BPS M 8BIM% 8BIM$ 7�<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?> |
|||
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.6-c138 79.159824, 2016/09/14-01:09:01 "> |
|||
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> |
|||
<rdf:Description rdf:about="" |
|||
xmlns:xmp="http://ns.adobe.com/xap/1.0/" |
|||
xmlns:dc="http://purl.org/dc/elements/1.1/" |
|||
xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/" |
|||
xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#" |
|||
xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/"> |
|||
<xmp:CreatorTool>Adobe Photoshop CC 2017 (Windows)</xmp:CreatorTool> |
|||
<xmp:CreateDate>2017-03-29T10:26:04+02:00</xmp:CreateDate> |
|||
<xmp:MetadataDate>2017-03-29T10:45:22+02:00</xmp:MetadataDate> |
|||
<xmp:ModifyDate>2017-03-29T10:45:22+02:00</xmp:ModifyDate> |
|||
<dc:format>application/vnd.adobe.photoshop</dc:format> |
|||
<xmpMM:InstanceID>xmp.iid:62fdb28d-db2d-a842-974d-32399f2be92d</xmpMM:InstanceID> |
|||
<xmpMM:DocumentID>xmp.did:84481483-4ba5-8b4d-8ed3-aa1f69d35c61</xmpMM:DocumentID> |
|||
<xmpMM:OriginalDocumentID>xmp.did:84481483-4ba5-8b4d-8ed3-aa1f69d35c61</xmpMM:OriginalDocumentID> |
|||
<xmpMM:History> |
|||
<rdf:Seq> |
|||
<rdf:li rdf:parseType="Resource"> |
|||
<stEvt:action>created</stEvt:action> |
|||
<stEvt:instanceID>xmp.iid:84481483-4ba5-8b4d-8ed3-aa1f69d35c61</stEvt:instanceID> |
|||
<stEvt:when>2017-03-29T10:26:04+02:00</stEvt:when> |
|||
<stEvt:softwareAgent>Adobe Photoshop CC 2017 (Windows)</stEvt:softwareAgent> |
|||
</rdf:li> |
|||
<rdf:li rdf:parseType="Resource"> |
|||
<stEvt:action>saved</stEvt:action> |
|||
<stEvt:instanceID>xmp.iid:62fdb28d-db2d-a842-974d-32399f2be92d</stEvt:instanceID> |
|||
<stEvt:when>2017-03-29T10:45:22+02:00</stEvt:when> |
|||
<stEvt:softwareAgent>Adobe Photoshop CC 2017 (Windows)</stEvt:softwareAgent> |
|||
<stEvt:changed>/</stEvt:changed> |
|||
</rdf:li> |
|||
</rdf:Seq> |
|||
</xmpMM:History> |
|||
<photoshop:ColorMode>3</photoshop:ColorMode> |
|||
</rdf:Description> |
|||
</rdf:RDF> |
|||
</x:xmpmeta> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
<?xpacket end="w"?>8BIM: printOutput PstSbool Inteenum Inte Clrm printSixteenBitbool printerNameTEXT C a n o n i R - A D V C 2 2 2 0 / 2 2 3 0 P C L 6 printProofSetupObjc P r o o f S e t u p |
|||
proofSetup Bltnenum builtinProof proofCMYK 8BIM; - printOutputOptions Cptnbool Clbrbool RgsMbool CrnCbool CntCbool Lblsbool Ngtvbool EmlDbool Intrbool BckgObjc RGBC Rd doub@o� Grn doub@o� Bl doub@o� BrdTUntF#Rlt Bld UntF#Rlt RsltUntF#Pxl@R |
|||
vectorDatabool PgPsenum PgPs PgPC LeftUntF#Rlt Top UntF#Rlt Scl UntF#Prc@Y cropWhenPrintingbool cropRectBottomlong cropRectLeftlong
cropRectRightlong cropRectToplong 8BIM� H H 8BIM& |