In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article shows you how the cross-platform engine Shader compilation process analysis is, the content is concise and easy to understand, can definitely brighten your eyes, through the detailed introduction of this article, I hope you can get something.
Background
The following mainly records some of the material systems in the engine and the thoughts on Shader compilation.
Both Unity and Unreal are cross-platform game engines, which include the material description language (Shading Language) and the renderer. On the Shader language, both Unity and Unreal choose HLSL, which is widely used, which inevitably requires the implementation of cross-platform Shader compilation scheme.
Differences in Shader compilation
First, take a look at the shader compilation process of UE4.22:
First of all, Epic Games is a game engine company with a long history. UE4 has implemented the HLSL front end of SM5 Level (using Flex/Bison tools), and combined with MesaIR and open source Glslang library to achieve a set of multi-API compatible, multi-device compatible language translator.
Let's take a look at Unity3D's Shader compilation process:
Unity is a small, exquisite kernel engine, at the editor level to achieve D3DCompiler.dll cross-platform (refer to Wine's PELoader), and then through DXBC translation to multi-platform Shader language, but also can support some device features, because D3DCompiler.dll is an X86 instruction, so its compilation scheme does not support HLSL Compute Shader compilation on mobile devices.
Now in 2019, Microsoft has opened up DirectXShaderCompiler,Google based on the LLVM/Clang ecology and contributed the SPIRV generator, NVIDIA has also provided the translation of RTX SPIRV on this project, and DXR/RTX is about to begin to promote, how to renovate the cross-platform Shader compilation scheme?
At present, the open source programs that support HLSL compilation mainly include Microsoft's DXC and Khronos's Glslang, DXC HLSL is the official maintenance of Microsoft and Google, and Glslang HLSL is mainly maintained by Google.
The difference between Unity and UE4 material system of NGFX Scheme
Unity mainly uses ShaderLab as the material description language. ShaderLab can describe RenderPass and RenderPipelineState, which is useful for future rendering extensions, such as Prebake PipelineState Object; and UE4 using visual node expressions to describe materials, both of which have their own advantages and disadvantages. UE4's material system is more suitable for art use, but it is difficult to control the arrangement and combination explosion, which slows down the iterative progress of the project; the arrangement and combination of Unity's ShaderLab is better controlled (manually), which also brings faster iteration speed.
The basic Shader modification of UE4 can also easily lead to a large number of material recompilations. Of course, you can also use Custom Shader Plugin or custom Shader nodes to achieve the corresponding functions.
After Unity 2017 take 8, officials have also provided a nodal material editor similar to UE4.
Thoughts on Shader language
At present, the mainstream real-time rendering Shader text language is mainly HLSL,GLSL,Metal SL, which are all developed based on C-like language and can not support modular Shader compilation very well (the support of modularization of programming language can improve the compilation efficiency to some extent). Therefore, NVIDIA of CG language was invented, and Slang language based on HLSL syntax was invented on our own Falcor renderer to better support modularization and hardware feature extension.
Metal Shading Language is based on Metal SL compiler 14, and the Binary Shader generated by the Metal compiler is actually LLVM BitCode. Although the Metal SL compiler is closed, there are also people on the Internet who have implemented an open source Metal SL compiler (Floor) on the basis of LLVM. The current Metal API does not provide Shader export of Binary, so you have to use MacOS's Metal offline compiler to generate Binary Code (for Shader Cache to speed up loading), so Floor may be a project worth paying attention to.
The above is what the cross-platform engine Shader compilation process analysis is like, have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.