ue4烘焙失败

ue4中经常会遇到烘焙失败的问题,有的显而易见,有的则不那么容易被发现。这里记录一下工作中遇到的烘焙失败问题,希望在以后遇到类似的问题能作为参考。

首先看下ue4官方文档对烘焙的解释

内容烘焙

虚幻引擎将内容资源存储为在其内部应用的特殊格式,比如贴图数据存储为PNG格式, 或者音频存储为WAV格式。但是,针对不同平台,这些内容需要转换成各种格式, 这是因为该平台使用专有的格式,不支持虚幻引擎使用的存储资源的格式, 或者是因为存在一种更加节约内存或提高性能的格式。将内容从内部格式转换为针对特定平台的格式 的过程,称为烘焙 。 

一般解决烘焙问题的思路如下,先确定是哪个地图烘焙失败,在DefaultEditor.ini中包含所有地图列表,可以通过增删地图列表来逐步定位出问题的地图。然后列表中可以只放出问题的地图,这样可以加快烘焙速度,也可以缩小可能导致烘焙失败的范围。

最后要解决烘焙失败原因,就是通过分析烘焙log,以下是一次烘焙失败ue4 editor Output Log窗口输出的日志(由于日志较长,这里只截取了部分输出)

MainFrameActions: Cooking (Windows): UE4Editor-Cmd: [2016.11.29-01.48.59:473][  0]LogLinker:Warning: Can't find file '/Game/GunWorks/GW_Guns/AAR/upper_receivers/upper_receiver_01/AAR_Upper_Receiver'
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: [2016.11.29-01.48.59:473][  0]LogUObjectGlobals:Warning: Failed to load '/Game/GunWorks/GW_Guns/AAR/upper_receivers/upper_receiver_01/AAR_Upper_Receiver': Can't find file '/Game/GunWorks/GW_Guns/AAR/upper_receivers/upper_receiver_01/AAR_Upper_Receiver'
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: [2016.11.29-01.48.59:474][  0]LogLinker:Warning: Can't find file '/Game/GunWorks/GW_Guns/AAR/upper_receivers/upper_receiver_01/AAR_Upper_Receiver'
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: [2016.11.29-01.48.59:474][  0]LogUObjectGlobals:Warning: Failed to load '/Game/GunWorks/GW_Guns/AAR/upper_receivers/upper_receiver_01/AAR_Upper_Receiver': Can't find file '/Game/GunWorks/GW_Guns/AAR/upper_receivers/upper_receiver_01/AAR_Upper_Receiver'
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: [2016.11.29-01.48.59:474][  0]LogUObjectGlobals:Warning: Failed to find object 'Object /Game/GunWorks/GW_Guns/AAR/upper_receivers/upper_receiver_01/AAR_Upper_Receiver.AAR_Upper_Receiver'
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: [2016.11.29-01.48.59:475][  0]LogRedirectors:Warning: String Asset Reference '/Game/GunWorks/GW_Guns/AAR/upper_receivers/upper_receiver_01/AAR_Upper_Receiver.AAR_Upper_Receiver' was not found! (Referencer '/Game/GunWorks/Materials/GW/GunWorks_M.GunWorks_M:PreviewMesh')
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: [2016.11.29-01.48.59:476][  0]LogLinker:Warning: Can't find file '/Game/Environment/Meshes/TEMP_01'
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: [2016.11.29-01.48.59:476][  0]LogUObjectGlobals:Warning: Failed to load '/Game/Environment/Meshes/TEMP_01': Can't find file '/Game/Environment/Meshes/TEMP_01'
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: [2016.11.29-01.48.59:476][  0]LogLinker:Warning: Can't find file '/Game/Environment/Meshes/TEMP_01'
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: [2016.11.29-01.48.59:476][  0]LogUObjectGlobals:Warning: Failed to load '/Game/Environment/Meshes/TEMP_01': Can't find file '/Game/Environment/Meshes/TEMP_01'
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: [2016.11.29-01.48.59:477][  0]LogUObjectGlobals:Warning: Failed to find object 'Object /Game/Environment/Meshes/TEMP_01.TEMP_01'
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: [2016.11.29-01.48.59:477][  0]LogRedirectors:Warning: String Asset Reference '/Game/Environment/Meshes/TEMP_01.TEMP_01' was not found! (Referencer '/Game/SideScrollerKit/Materials/M_Glass_wall_beam.M_Glass_wall_beam:PreviewMesh')
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: [2016.11.29-01.48.59:785][  0]LogShaders:Warning:     CompilingMasterWeaponShader: Platform=PCD3D_SM4, Usage=LightingModel=MSM_DefaultLit, BlendMode=BLEND_Opaque, SpecialEngine=0, TwoSided=0, TSNormal=1, InjectEmissiveIntoLPV=0, Masked=0, Distorted=0, BlockGI=0, Usage={bUsedWithSkeletalMesh,bUsedWithVxgiVo
xelization}
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: [2016.11.29-01.48.59:841][  0]LogShaders:Warning:         116 Shaders among 3 VertexFactories
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: [2016.11.29-01.48.59:917][  0]LogShaders:Warning:     CompilingMasterWeaponShader: Platform=PCD3D_SM4, Usage=LightingModel=MSM_DefaultLit, BlendMode=BLEND_Opaque, SpecialEngine=0, TwoSided=0, TSNormal=1, InjectEmissiveIntoLPV=0, Masked=0, Distorted=0, BlockGI=0, Usage={bUsedWithSkeletalMesh,bUsedWithVxgiVo
xelization}, StaticSwitch'Debug AO'=False, StaticSwitch'White Paint Pattern'=False, StaticSwitch'Two Color Pattern'=False, StaticSwitch'Light Metal Pattern'=False, StaticSwitch'Plasma on Channel Two'=False, StaticSwitch'Plasma on Channel One'=False, StaticSwitch'Plasma on Channel Three'=False, StaticSwitch'Panini Projection'=True, StaticMask'Plasma Channel O
ne'=R, StaticMask'Plasma Channel Two'=G, StaticMask'Plasma Channel Three'=G
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: [2016.11.29-01.48.59:975][  0]LogShaders:Warning:         116 Shaders among 3 VertexFactories
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: [2016.11.29-01.49.00:000][  0]LogShaders:Warning:     CompilingM_ShockProto_Screen: Platform=PCD3D_SM4, Usage=LightingModel=MSM_Unlit, BlendMode=BLEND_Additive, SpecialEngine=0, TwoSided=0, TSNormal=1, InjectEmissiveIntoLPV=0, Masked=0, Distorted=0, BlockGI=0, Usage={bUsedWithSkeletalMesh,bUsedWithStaticLi
ghting,bUsedWithVxgiVoxelization}, StaticSwitch'Panini Projection'=True
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: [2016.11.29-01.49.00:043][  0]LogShaders:Warning:         72 Shaders among 3 VertexFactories
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: [2016.11.29-01.49.00:061][  0]LogShaders:Warning:     CompilingM_Shock_Flair_Multi_Color_2: Platform=PCD3D_SM4, Usage=LightingModel=MSM_Unlit, BlendMode=BLEND_Additive, SpecialEngine=0, TwoSided=1, TSNormal=1, InjectEmissiveIntoLPV=0, Masked=0, Distorted=0, BlockGI=0, Usage={bUsedWithSkeletalMesh,bUsedWith
ParticleSprites,bUsedWithBeamTrails,bUsedWithStaticLighting,bUsedWithVxgiVoxelization}, StaticSwitch'Panini Projection'=True
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: [2016.11.29-01.49.54:427][  0]LogOutputDevice:Error: 
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: begin: stack for UAT
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: [2016.11.29-01.49.54:429][  0]LogWindows:Error: === Critical error: ===
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: 
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: Fatal error!
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: 
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: 
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: 
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x00000000
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: 
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: 
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: 
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: UE4Editor-Engine.dll!UMaterialInstance::HasOverridenBaseProperties() [e:\work\viba\unrealengine-vxgi-4.12\engine\source\runtime\engine\private\materials\materialinstance.cpp:2848]
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: 
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: UE4Editor-Engine.dll!UMaterialInstance::InitStaticPermutation() [e:\work\viba\unrealengine-vxgi-4.12\engine\source\runtime\engine\private\materials\materialinstance.cpp:1489]
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: 
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: UE4Editor-Engine.dll!UMaterialInstance::PostLoad() [e:\work\viba\unrealengine-vxgi-4.12\engine\source\runtime\engine\private\materials\materialinstance.cpp:2084]
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: 
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: UE4Editor-CoreUObject.dll!UObject::ConditionalPostLoad() [e:\work\viba\unrealengine-vxgi-4.12\engine\source\runtime\coreuobject\private\uobject\obj.cpp:748]
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: 
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: UE4Editor-CoreUObject.dll!EndLoad() [e:\work\viba\unrealengine-vxgi-4.12\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:1452]
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: 
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: UE4Editor-CoreUObject.dll!LoadPackageInternal() [e:\work\viba\unrealengine-vxgi-4.12\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:1171]
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: 
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: UE4Editor-CoreUObject.dll!LoadPackageInternal() [e:\work\viba\unrealengine-vxgi-4.12\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:1286]
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: 
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: UE4Editor-CoreUObject.dll!ResolveName() [e:\work\viba\unrealengine-vxgi-4.12\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:696]
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: 
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: UE4Editor-CoreUObject.dll!StaticLoadObjectInternal() [e:\work\viba\unrealengine-vxgi-4.12\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:783]
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: 
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: UE4Editor-CoreUObject.dll!StaticLoadObject() [e:\work\viba\unrealengine-vxgi-4.12\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:853]
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: 
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: UE4Editor-CoreUObject.dll!FRedirectCollector::ResolveStringAssetReference() [e:\work\viba\unrealengine-vxgi-4.12\engine\source\runtime\coreuobject\private\misc\redirectcollector.cpp:118]
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: 
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: UE4Editor-UnrealEd.dll!UCookOnTheFlyServer::TickCookOnTheSide() [e:\work\viba\unrealengine-vxgi-4.12\engine\source\editor\unrealed\private\cookontheflyserver.cpp:1650]
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: 
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: UE4Editor-UnrealEd.dll!UCookCommandlet::NewCook() [e:\work\viba\unrealengine-vxgi-4.12\engine\source\editor\unrealed\private\commandlets\cookcommandlet.cpp:1375]
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: 
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: UE4Editor-UnrealEd.dll!UCookCommandlet::Main() [e:\work\viba\unrealengine-vxgi-4.12\engine\source\editor\unrealed\private\commandlets\cookcommandlet.cpp:679]
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: 
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: UE4Editor-Cmd.exe!FEngineLoop::PreInit() [e:\work\viba\unrealengine-vxgi-4.12\engine\source\runtime\launch\private\launchengineloop.cpp:1780]
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: 
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: UE4Editor-Cmd.exe!GuardedMain() [e:\work\viba\unrealengine-vxgi-4.12\engine\source\runtime\launch\private\launch.cpp:114]
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: 
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: UE4Editor-Cmd.exe!GuardedMainWrapper() [e:\work\viba\unrealengine-vxgi-4.12\engine\source\runtime\launch\private\windows\launchwindows.cpp:126]
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: 
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: UE4Editor-Cmd.exe!WinMain() [e:\work\viba\unrealengine-vxgi-4.12\engine\source\runtime\launch\private\windows\launchwindows.cpp:200]
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: 
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: UE4Editor-Cmd.exe!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:255]
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: 
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: kernel32.dll
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: 
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: ntdll.dll
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: 
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: ntdll.dll
MainFrameActions: Cooking (Windows): UE4Editor-Cmd: 

这里优先查看error,根据红色标出的部分,很快就知道是由于空指针导致的烘焙失败,再往下有具体烘焙失败的调用堆栈(有时候没有堆栈输出,可以尝试直接从代码启动editor,然后烘焙)

通过堆栈分析,发下以下代码是导致最终烘焙失败的原因:

ue4烘焙失败_第1张图片

2848行,空指针,很明显,Parent是空指针导致的,也就是说,是由于MaterialInstance的Parent是NULL导致的烘焙失败

然后我们从后往前排查输出日志(主要是看有error、warning和fail的),发现材质文件MasterWeaponShader一打开,editor直接闪退,很明显是这个文件导致的烘焙失败,然后查找引用这个文件的地方,发现这些文件项目中并没有用到,于是删除相关文件,再次烘焙,就成功了。

ps:好的习惯是重视烘焙和打包中的warning,尽可能消除这些warning,这样不仅能提高烘焙和打包速度,还能尽快的定位问题。

还有一种比较笨但比较实用的方式是从地图中不断删除物体后进行烘焙,这样可以不断缩小范围(因为只有被地图引用到的资源才会被烘焙)


你可能感兴趣的:(ue4)