UE4 iOS Metal precompile shaders

1649 篇文章 11 订阅
1623 篇文章 22 订阅


0

How do you precompile shaders on a mac for metal? I'm looking at this link:

https://wiki.unrealengine.com/Metal_Rendering_API "If you cook with Windows, the shaders will not be precompiled because there is no shader compiler program for Windows. It will compile the shaders at runtime if this is the case (it uses the offline/online flag for looking up the shader in the DerivedDataCache, so both modes live together correctly)."

I'm on a mac now with a blueprint only project. And will this fix the the materials having to compile the first time they are shown on an iOS game? This video shows what I'm referring to:https://www.dropbox.com/s/g5w13hnqcb6nw28/ios-shader.mov?dl=0

Product Version:  UE 4.9
Tags: ios shaders metal
more ▼

asked Sep 24 '15 at 2:14 PM

rckt26 gravatar image

rckt26 
114  3  6  12

AndrewHurley gravatar image  AndrewHurley ♦♦  STAFF  Sep 30 '15 at 12:14 AM

Hey rckt26,

The shaders are already precompiled after you packaged and launch the project onto your device. Be sure you have set up your project correctly for your metallic materials to render as expected. One way to make sure you are using the correct shader model is to use the 'Feature Level Switch' node within your Material Graph.

I just tested this on an iPad Air we have here and the project loaded up fine without the need to compile shaders for the Metal material I had applied to objects in my scene.

If you have further questions please let me know.

Cheers,

Andrew Hurley

rckt26 gravatar image  rckt26  Nov 02 '15 at 10:28 AM

I'm not sure what I'm doing wrong. I've packaged it with shipping configuration and added the 'Feature Level Switch' to most of the materials but it still does the same thing. Pretty much all of my materials are unlit and just a simple texture.

I had deleted the previous video so here is another: https://www.dropbox.com/s/vvnwzus8dlqxkp9/iphone-1.mov?dl=0

AndrewHurley gravatar image  AndrewHurley ♦♦  STAFF  Nov 03 '15 at 12:11 AM

After watching your video, I am not seeing any compile shaders issues. It seems to just need to load the textures into memory which is that popping that you are seeing.

rckt26 gravatar image  rckt26  Nov 03 '15 at 1:59 AM

How do I load all the textures into memory before they are used because everytime a new material is applied the game stutters.


1 answer: sort voted first 
1

In what context are you changing or applying materials at runtime, and how are you doing so?

You can use the never stream option, but your mobile device has a texture pool limit and some of those textures will be blurry, Keep in mind mobile devices have texture size limits that need to be adhered to in order for your mobile project to load correctly.

Texture Guidelines for Mobile

https://docs.unrealengine.com/latest/INT/Platforms/Mobile/Textures/index.html

Materials for Mobile

https://docs.unrealengine.com/latest/INT/Platforms/Mobile/Materials/index.html

Both of the above links can also provide some more insight on how to optimize your textures and materials for your mobile projects.

Thanks,

Andrew Hurley

more ▼

answered Nov 03 '15 at 4:40 AM

AndrewHurley gravatar image

AndrewHurley ♦♦ STAFF 
16.8k  288  7  167

rckt26 gravatar image  rckt26  Nov 03 '15 at 1:55 PM

Thanks, the never stream option seems to work. I haven't seen any blurry textures yet but I still have some stuttering issues that seem to be related to textures but I'm not sure. Could you take a look at the video and take a guess?

https://www.dropbox.com/s/awkpcjdm4c2ulgg/iphone-2.mov?dl=0

As you can see the first time the camera moves over the fps drops and then any time after it doesn't have a problem.

AndrewHurley gravatar image  AndrewHurley ♦♦  STAFF  Nov 05 '15 at 12:03 AM

It seems to just be a load time issue like it just needed to be loaded for the first time. The stuttering didn't seem to occur on your second return to the game and back to the menu.

rckt26 gravatar image  rckt26  Nov 05 '15 at 2:03 PM

Let me know if I need to start a new question since it seems like it may not be related to my original question.

I don't think it is a load time issue because I can leave it on the menu for a few min and then press New Puzzle and it still will stutter the first time.

And here is a little more info: The frame rate drop occurs only the first time the new puzzle is pressed if the app has been closed and hasn't been in the background for a while or if the iphone/ipad has been restarted. I can close the app completely and then reopen it and it doesn't occur again. The draw count goes from ~100 to over 300 and triangle count goes from 26000 to 62000. It's like something hasn't been allocated or initialized until it comes into view that first time but I don't know how to narrow it down or fix it even if I did narrow it down.

AndrewHurley gravatar image  AndrewHurley ♦♦  STAFF  Nov 06 '15 at 1:30 AM +

Yeah, if you don't mind could you create a new answerhub post and provide the details of the specific issue you are explaining?

I appreciate your patience and if you would like, you can provide me with the link to your new issue in your response to this comment, and I can continue to help you investigate.

Cheers,

Andrew Hurley

rckt26 gravatar image  rckt26  Nov 06 '15 at 12:44 PM  Newest
1
0

How do you precompile shaders on a mac for metal? I'm looking at this link:

https://wiki.unrealengine.com/Metal_Rendering_API "If you cook with Windows, the shaders will not be precompiled because there is no shader compiler program for Windows. It will compile the shaders at runtime if this is the case (it uses the offline/online flag for looking up the shader in the DerivedDataCache, so both modes live together correctly)."

I'm on a mac now with a blueprint only project. And will this fix the the materials having to compile the first time they are shown on an iOS game? This video shows what I'm referring to:https://www.dropbox.com/s/g5w13hnqcb6nw28/ios-shader.mov?dl=0

Product Version:  UE 4.9
Tags: ios shaders metal
more ▼

asked Sep 24 '15 at 2:14 PM

rckt26 gravatar image

rckt26 
114  3  6  12

AndrewHurley gravatar image  AndrewHurley ♦♦  STAFF  Sep 30 '15 at 12:14 AM

Hey rckt26,

The shaders are already precompiled after you packaged and launch the project onto your device. Be sure you have set up your project correctly for your metallic materials to render as expected. One way to make sure you are using the correct shader model is to use the 'Feature Level Switch' node within your Material Graph.

I just tested this on an iPad Air we have here and the project loaded up fine without the need to compile shaders for the Metal material I had applied to objects in my scene.

If you have further questions please let me know.

Cheers,

Andrew Hurley

rckt26 gravatar image  rckt26  Nov 02 '15 at 10:28 AM

I'm not sure what I'm doing wrong. I've packaged it with shipping configuration and added the 'Feature Level Switch' to most of the materials but it still does the same thing. Pretty much all of my materials are unlit and just a simple texture.

I had deleted the previous video so here is another: https://www.dropbox.com/s/vvnwzus8dlqxkp9/iphone-1.mov?dl=0

AndrewHurley gravatar image  AndrewHurley ♦♦  STAFF  Nov 03 '15 at 12:11 AM

After watching your video, I am not seeing any compile shaders issues. It seems to just need to load the textures into memory which is that popping that you are seeing.

rckt26 gravatar image  rckt26  Nov 03 '15 at 1:59 AM

How do I load all the textures into memory before they are used because everytime a new material is applied the game stutters.


1 answer: sort voted first 
1

In what context are you changing or applying materials at runtime, and how are you doing so?

You can use the never stream option, but your mobile device has a texture pool limit and some of those textures will be blurry, Keep in mind mobile devices have texture size limits that need to be adhered to in order for your mobile project to load correctly.

Texture Guidelines for Mobile

https://docs.unrealengine.com/latest/INT/Platforms/Mobile/Textures/index.html

Materials for Mobile

https://docs.unrealengine.com/latest/INT/Platforms/Mobile/Materials/index.html

Both of the above links can also provide some more insight on how to optimize your textures and materials for your mobile projects.

Thanks,

Andrew Hurley

more ▼

answered Nov 03 '15 at 4:40 AM

AndrewHurley gravatar image

AndrewHurley ♦♦ STAFF 
16.8k  288  7  167

rckt26 gravatar image  rckt26  Nov 03 '15 at 1:55 PM

Thanks, the never stream option seems to work. I haven't seen any blurry textures yet but I still have some stuttering issues that seem to be related to textures but I'm not sure. Could you take a look at the video and take a guess?

https://www.dropbox.com/s/awkpcjdm4c2ulgg/iphone-2.mov?dl=0

As you can see the first time the camera moves over the fps drops and then any time after it doesn't have a problem.

AndrewHurley gravatar image  AndrewHurley ♦♦  STAFF  Nov 05 '15 at 12:03 AM

It seems to just be a load time issue like it just needed to be loaded for the first time. The stuttering didn't seem to occur on your second return to the game and back to the menu.

rckt26 gravatar image  rckt26  Nov 05 '15 at 2:03 PM

Let me know if I need to start a new question since it seems like it may not be related to my original question.

I don't think it is a load time issue because I can leave it on the menu for a few min and then press New Puzzle and it still will stutter the first time.

And here is a little more info: The frame rate drop occurs only the first time the new puzzle is pressed if the app has been closed and hasn't been in the background for a while or if the iphone/ipad has been restarted. I can close the app completely and then reopen it and it doesn't occur again. The draw count goes from ~100 to over 300 and triangle count goes from 26000 to 62000. It's like something hasn't been allocated or initialized until it comes into view that first time but I don't know how to narrow it down or fix it even if I did narrow it down.

AndrewHurley gravatar image  AndrewHurley ♦♦  STAFF  Nov 06 '15 at 1:30 AM +

Yeah, if you don't mind could you create a new answerhub post and provide the details of the specific issue you are explaining?

I appreciate your patience and if you would like, you can provide me with the link to your new issue in your response to this comment, and I can continue to help you investigate.

Cheers,

Andrew Hurley

rckt26 gravatar image  rckt26  Nov 06 '15 at 12:44 PM  Newest
1
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值