Netcode Bootstrap
This commit is contained in:
+66
@@ -0,0 +1,66 @@
|
||||
#ifndef BONE_RENDERER_GPU_HLSL_
|
||||
#define BONE_RENDERER_GPU_HLSL_
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
||||
#ifdef IS_HDRP
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightDefinition.cs.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesGlobal.cs.hlsl"
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "Packages/com.rukhanka.animation/Rukhanka.DebugDrawer/Resources/RukhankaBoneRenderer.hlsl"
|
||||
#include "Packages/com.rukhanka.animation/Rukhanka.Runtime/GPUAnimationEngine/Resources/GPUStructures.hlsl"
|
||||
|
||||
StructuredBuffer<BoneTransform> rigSpaceBoneTransforms;
|
||||
|
||||
struct RigVisInfo
|
||||
{
|
||||
float3 pos;
|
||||
float scale;
|
||||
float4 rot;
|
||||
};
|
||||
|
||||
StructuredBuffer<RigVisInfo> rigVisualizationData;
|
||||
float4 boneColor;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
VertexToPixel VSGPUAnimator(VertexInput i)
|
||||
{
|
||||
VertexToPixel o = (VertexToPixel)0;
|
||||
|
||||
AnimatedBoneWorkload boneWorkload = animatedBoneWorkload[i.instanceID];
|
||||
AnimationJob animationJob = animationJobs[boneWorkload.animationJobIndex];
|
||||
RigDefinition rigDef = RigDefinition::ReadFromRawBuffer(rigDefinitions, animationJob.rigDefinitionIndex);
|
||||
RigBone rigBone = RigBone::ReadFromRawBuffer(rigBones, rigDef.rigBonesRange.x + boneWorkload.boneIndexInRig);
|
||||
int parentBoneIndex = rigBone.parentBoneIndex;
|
||||
|
||||
if (parentBoneIndex < rigDef.rootBoneIndex)
|
||||
return o;
|
||||
|
||||
BoneData bd;
|
||||
RigVisInfo rvi = rigVisualizationData[boneWorkload.animationJobIndex];
|
||||
|
||||
int boneId = animationJob.animatedBoneIndexOffset + boneWorkload.boneIndexInRig;
|
||||
bd.pos0 = rigSpaceBoneTransforms[boneId].pos;
|
||||
if (parentBoneIndex >= 0)
|
||||
bd.pos1 = rigSpaceBoneTransforms[animationJob.animatedBoneIndexOffset + parentBoneIndex].pos;
|
||||
|
||||
float3 worldPos = ComputeVertexWorldPos(bd, i.pos, i.vertexID);
|
||||
|
||||
BoneTransform entityPose;
|
||||
entityPose.pos = rvi.pos;
|
||||
entityPose.scale = rvi.scale;
|
||||
entityPose.rot.value = rvi.rot;
|
||||
|
||||
worldPos = BoneTransform::TransformPoint(entityPose, worldPos);
|
||||
|
||||
worldPos = GetCameraRelativePositionWS(worldPos);
|
||||
o.pos = mul(unity_MatrixVP, float4(worldPos, 1));
|
||||
|
||||
o.color = boneColor;
|
||||
return o;
|
||||
}
|
||||
|
||||
#endif
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 27c1027c96c0de44cb7d0cd95c1edd82
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 298480
|
||||
packageName: Rukhanka Animation System 2
|
||||
packageVersion: 2.9.0
|
||||
assetPath: Packages/com.rukhanka.animation/Rukhanka.Runtime/DebugAndVisualization/Resources/BoneRendererGPU.hlsl
|
||||
uploadId: 897522
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
Shader "BoneRendererGPU"
|
||||
{
|
||||
SubShader
|
||||
{
|
||||
PackageRequirements
|
||||
{
|
||||
"com.unity.render-pipelines.high-definition": "1.0.0"
|
||||
}
|
||||
Tags
|
||||
{
|
||||
"RenderPipeline" = "HDRenderPipeline"
|
||||
"RenderType" = "HDUnlitShader"
|
||||
"Queue" = "Transparent+0"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "ForwardOnly"
|
||||
Tags
|
||||
{
|
||||
"LightMode" = "ForwardOnly"
|
||||
}
|
||||
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
ZTest off
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma target 5.0
|
||||
|
||||
#pragma vertex VSGPUAnimator
|
||||
#pragma fragment PS
|
||||
#define IS_HDRP
|
||||
|
||||
#include "BoneRendererGPU.hlsl"
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SubShader
|
||||
{
|
||||
PackageRequirements
|
||||
{
|
||||
"com.unity.render-pipelines.universal": "1.0.0"
|
||||
}
|
||||
Tags
|
||||
{
|
||||
"RenderPipeline"="UniversalPipeline"
|
||||
"Queue" = "Transparent+0"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"LightMode" = "UniversalForward"
|
||||
}
|
||||
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
ZTest off
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma target 5.0
|
||||
|
||||
#pragma vertex VSGPUAnimator
|
||||
#pragma fragment PS
|
||||
|
||||
#include "BoneRendererGPU.hlsl"
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 53e554c5c17b29f4ebb95370af0ddd20
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 298480
|
||||
packageName: Rukhanka Animation System 2
|
||||
packageVersion: 2.9.0
|
||||
assetPath: Packages/com.rukhanka.animation/Rukhanka.Runtime/DebugAndVisualization/Resources/BoneRendererGPU.shader
|
||||
uploadId: 897522
|
||||
Reference in New Issue
Block a user