ded39be57e
Added a loop to the skin shader that will sample from wrinkle masks, multiply them by a weight, combine them, and use them instead of vertex colors for wrinkle map blending Added an array of masks, an array of weights, and a wrinkle mask count to the DefaultObjectSrg. -Will create a follow up task to handle this a better way. Removed motion vector (for now) from skin.materialtype since we're not using them, and removed depthtransparent since skin doesn't support transparency Added an interface to the MeshFeatureProcessor to get the object srg Wrapped srg->Compile in if(srg->IsQueuedForCompile()) to prevent compiling twice --This doesn't stop a race condition if both happen at the same time, but that is at least far less likely. It will need a better solution later. Added a function to the MorphTargetExporter that will check to see if a texture that matches the blend shape name exists in a particular folder, and adds a reference to that image to the MorphTargetMetaAsset --Only supports .tif, and doesn't automatically re-process the .fbx if the folder is updated. These can be improved in later iterations Added a null check in MaterialTypeSourceData.cpp to fix a crash I ran into Added a for loop in two places to look for the first submesh that has a morph target, instead of just using the first to check if a lod has morph targets or not. --I have a better fix for this, but it involves more areas of the code, so I'm saving that for another change. Modified AtomActorInstance to look for any morph targets that have a wrinkle mask reference Then each frame, for any morph targets with non-zero weights that also have wrinkle masks, it updates the mask array, weights, and count on the object srg.
78 lines
3.2 KiB
C++
78 lines
3.2 KiB
C++
/*
|
|
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
|
* its licensors.
|
|
*
|
|
* For complete copyright and license terms please see the LICENSE at the root of this
|
|
* distribution (the "License"). All use of this software is governed by the License,
|
|
* or, if provided, by the license below or the license accompanying this file. Do not
|
|
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
*
|
|
*/
|
|
|
|
#include <AzCore/RTTI/ReflectContext.h>
|
|
#include <AzCore/Serialization/SerializeContext.h>
|
|
#include <Atom/RPI.Reflect/Model/MorphTargetMetaAsset.h>
|
|
|
|
namespace AZ::RPI
|
|
{
|
|
void MorphTargetMetaAsset::MorphTarget::Reflect(ReflectContext* context)
|
|
{
|
|
if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
|
|
{
|
|
serializeContext->Class<MorphTargetMetaAsset::MorphTarget>()
|
|
->Version(1)
|
|
->Field("meshNodeName", &MorphTargetMetaAsset::MorphTarget::m_meshNodeName)
|
|
->Field("morphTargetName", &MorphTargetMetaAsset::MorphTarget::m_morphTargetName)
|
|
->Field("startIndex", &MorphTargetMetaAsset::MorphTarget::m_startIndex)
|
|
->Field("numVertices", &MorphTargetMetaAsset::MorphTarget::m_numVertices)
|
|
->Field("minPositionDelta", &MorphTargetMetaAsset::MorphTarget::m_minPositionDelta)
|
|
->Field("maxPositionDelta", &MorphTargetMetaAsset::MorphTarget::m_maxPositionDelta)
|
|
->Field("wrinkleMask", &MorphTargetMetaAsset::MorphTarget::m_wrinkleMask)
|
|
->Field("hasColorDeltas", &MorphTargetMetaAsset::MorphTarget::m_hasColorDeltas)
|
|
;
|
|
}
|
|
}
|
|
|
|
void MorphTargetMetaAsset::Reflect(ReflectContext* context)
|
|
{
|
|
MorphTarget::Reflect(context);
|
|
|
|
if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
|
|
{
|
|
serializeContext->Class<MorphTargetMetaAsset>()
|
|
->Version(1)
|
|
->Field("morphTargets", &MorphTargetMetaAsset::m_morphTargets)
|
|
;
|
|
}
|
|
}
|
|
|
|
AZ::Data::AssetId MorphTargetMetaAsset::ConstructAssetId(const AZ::Data::AssetId& modelAssetId, const AZStd::string& modelAssetName)
|
|
{
|
|
if (modelAssetName.empty())
|
|
{
|
|
AZ_Error("SkinMetaAsset", false, "Cannot construct asset id for morph target meta asset. Model asset name is empty.");
|
|
return {};
|
|
}
|
|
|
|
// The sub id of any model related assets starts with the same prefix for first 8 bits and uses the name hash for the last 24 bits.
|
|
uint32_t productSubId = MorphTargetMetaAsset::s_assetIdPrefix | AZ::Crc32(modelAssetName) & 0xffffff;
|
|
return {modelAssetId.m_guid, productSubId};
|
|
}
|
|
|
|
void MorphTargetMetaAsset::SetReady()
|
|
{
|
|
m_status = Data::AssetData::AssetStatus::Ready;
|
|
}
|
|
|
|
void MorphTargetMetaAsset::AddMorphTarget(const MorphTarget& morphTarget)
|
|
{
|
|
m_morphTargets.emplace_back(morphTarget);
|
|
}
|
|
|
|
const AZStd::vector<MorphTargetMetaAsset::MorphTarget>& MorphTargetMetaAsset::GetMorphTargets() const
|
|
{
|
|
return m_morphTargets;
|
|
}
|
|
} // namespace AZ::RPI
|