可可西

nVidia的物理系统

PhysX

PhysX(wiki en  中文physx wiki   physx wiki2)是nVidia公司一款跨平台实时物理引擎,可使用硬件(GPU、PPU: Physics Processing Unit, 物理处理器)加速

支持刚体(rigid bodies)、软体(soft bodies)、流体(fluids)、面料(cloths)、力场(force fields)等

目前已在github上开源,有3个开源项目:

PhysX3.3(私有库):其中集成了Apex1.3.4

PhysX3.4公有库:其中集成了Apex1.4,UE4.22集成的是该版本  源代码路径:Engine\Source\ThirdParty\PhysX3   运行时库:Engine\Binaries\ThirdParty\PhysX3   

                                     注:UE4集成的PhysX具体版本号在Engine\Source\ThirdParty\PhysX3\PhysX_3.4\release_notes.html

                                     ApexDestruction:Engine\Plugins\Runtime\ApexDestruction

                                     NvCloth:Engine\Source\ThirdParty\PhysX3\NvCloth

                                     Blast:Engine\Plugins\Experimental\BlastPlugin\Source\ThirdParty

PhysX(公有库):最新版本为4.1

 

UE4可在Build.cs中通过以下设置来控制是否使用PhysX及其相关组件

Target.bCompilePhysX

Target.bCompileAPEX

Target.bCompileNvCloth

 

== 以PhysX3为例,说明不同版本dll的区别==

PhysX3DEBUG_x64.dll  // Debug版本

PhysX3CHECKED_x64.dll   // 宏断言版本

PhysX3PROFILE_x64.dll  // 带性能数据收集功能版本

PhysX3_x64.dll    // Release版本

 

具体宏详见:

/** PhysX3\PxShared\include\foundation\PxPreprocessor.h */
/*
define anything not defined through the command line to 0
*/
#ifndef PX_DEBUG
#define PX_DEBUG 0
#endif
#ifndef PX_CHECKED
#define PX_CHECKED 0
#endif
#ifndef PX_PROFILE
#define PX_PROFILE 0
#endif

 

获取nVidia Gameworks私有github库方法,大致步骤如下:

1. 注册NVIDIA Developer开发者账号(不是有NVIDIA账号就能直接登录的,必须是开发者账号)

2.同意最终用户许可协议(EULA),并在最后把自己的GitHub用户名输入。

3. 在一段时间后,会收到github上NvidiaGameWorksAdmin拉你入NVIDIAGameWorks组的邮件。

4. 加入NVIDIAGameWorks后,会收到NVIDIA GameWorks用github邮箱发的邮件,告诉你已经把你拉入GameWorks_EULA_Access Team,并被赋予“Pull”权限。

5. 访问https://github.com/NVIDIAGameWorks,这个时候就能看见NvCloth、Blast、Flex、Flow等私有库。

 

在UE3中使用PhysX(udn  en  中文

① UE3中Pawn行走时的碰撞检测、重力、武器射击、流体(FluidSurfaceActor)的模拟是自己实现的

② 人物死亡,调用SetPawnRBChannels(TRUE)开启布娃娃系统(ragdoll),并且将SetPhysics(PHYS_RigidBody),则会使用Pawn的PhysicsAsset数据进行PhysX物理模拟

③ 载具使用是PhysX物理模拟  (udn 设置载具   载具系统技术指南

④ 从RigidBodyBase派生的Actor(如:RB_ConstraintActor、RB_PrismaticActor)开启模拟后,会进行PhysX物理模拟

⑤ 破坏(FracturedStaticMesh)、软体会使用PhysX进行物理模拟

 

在UE4中使用PhysX(en  中文

 

Apex

Apexphysx wiki)在PhysX之上开发一套跨平台SDK,用于制作和运行复杂的物理数据(如带破坏模型、面料等)

Apex1.3.4(随PhysX3.3)和Apex1.4(随PhysX3.4)已开源,具体文档详见:NVIDIA(R) APEX(TM) SDK Documentation

1.4版本之后,nVidia放弃了Apex,并发布了一些新开源项目NvCloth、Blast、Flow(私有库)来替换Apex中各个组件

Apex的发布记录:NVIDIA(R) APEX(TM) SDK Release Notes

Apex的架构如下:

注1:Authoring为制作物理资源的组件集合,Run-time为运行物理资源的组件集合

注2:绿色部分为nVidia提供的物理组件工具集

Apex包括如下组件模块:

APEX Clothing(面料) --> NvClothdocs   私有库 github
APEX Destruction(破碎与破坏,Fracture and Destruction) --> Blastapi docs    authoring docs  私有库 github)    ue的Blast插件代码(私有库):https://github.com/NvPhysX/UnrealEngine/tree/4.20.3-Blast_1.1.4
APEX Particles(粒子) --> Flowdocs  私有库  github)  ue的Flow插件代码(私有库):https://github.com/NvPhysX/UnrealEngine/tree/NvFlow-4.19
APEX Turbulence(湍流)
APEX ForceField(力场)
APEX Vegetation (植被 开发已暂停)

 

在UE3中使用Apex

APEX Framework(udn en  中文

布料:APEX Clothing in UE3(udn  en  中文) 

破坏:APEX Destruction in UE3(udn  en  中文

 

在UE4中使用Apex (en  中文

 

FleX

FleXphysx wiki)是GPU加速基于粒子模型(paticle)的物理模拟库,其源码也在Github上开源(私有库)

支持刚体(rigid bodies)、变形体(deformable bodies)、软体(soft bodies)、流体(fluids)、面料(cloths)、气体(gases)等

FleX Documentation

FleX UE4 Plugin Documentation     ue4的FleX插件代码(私有库):https://github.com/NvPhysX/UnrealEngine/tree/FleX-4.19.2

相关youtube视频:

Introduction on how to use Nvidia Flex in UE 4

Flex tutorial 1 Rigids, cloth and softbodies

Flex tutorial 2 Fluids

Flex tutorial 3 - containers

Flex tutorial 4 - How to change container values ingame

Flex tutorial 5 - Overlap events with Flex

 

PhysX资料和相关软件

nVidia Gameworks documentation simulation中列出了所有物理相关的SDK组件

GameWorks PhysX Overview中介绍了最新的PhysX及基于PhysX的组件 

 

nVidia Gameworks Download Center中提供了PhysX相关的软件下载(需要登录nVidia开发者账号),如下为PhysX SDK3.4.0的下载内容:

3D Studio Max DCC plug-in for PhysX:PhysX的3Ds Max插件

Maya DCC plug-in for PhysX :PhysX的Maya插件

注:① DCC为Digital Content Creation简称  ② DCC plug-in for PhysX

PhysX Visual Debugger(PVD):PhysX的可视化调试软件。通过与被调试的PhysX程序建立连接,实时地将其物理元素可视化到PVD中

PhysX Lab:为APEX Destruction(破坏)和APEX Particles(粒子)制作数据的工具

 

参考

nVidia Developer站内搜索

nVidia Gameworks youtube频道

NVIDIA GameWorks and UE4 

NvPhysX/UnrealEngine  github 

百度百科 PhysX 

 

posted on 2019-05-06 22:16  可可西  阅读(2839)  评论(0编辑  收藏  举报

导航