UE4 分别使用蓝图、C++实现动态材质效果

温馨提醒:纹理资源已上传

一、在材质内设置自发光

1.淡出效果

2.材质纹理设置

3.设置颜色参数,和位置

4.整体节点如下:

二、蓝图调用如下;

C++代码:

/// <summary>
/// 播放材质效果
/// </summary>
void AMain::PlayMaterialEffect(FLinearColor LinearColor){
    if(USkeletalMeshComponent* m = this->GetMesh())
    {
        FVector color = UKismetMathLibrary::Conv_LinearColorToVector(LinearColor);
        m->SetVectorParameterValueOnMaterials(FName(TEXT("EffectColor")), color);
        m->SetScalarParameterValueOnMaterials(FName(TEXT("StartTime")), UGameplayStatics::GetTimeSeconds(GetWorld()));
    }
}

猜你喜欢

转载自blog.csdn.net/qq_34970171/article/details/109634872