UE4 To Support Framebuffer Fetch For OpenGL ES3.1

本文介绍了UE4如何扩展支持OpenGL ES3.1的帧缓冲区获取功能,通过自定义OpenGL着色器编译器,实现对像素着色器中直接读取帧缓冲区的能力。详细讨论了移动设备上GPU架构、OpenGL ES的EXT_shader_framebuffer_fetch扩展,以及UE4的着色器编译和缓存机制。通过修改源代码,实现了在碎片着色器中使用帧缓冲区数据的优化技巧。
摘要由CSDN通过智能技术生成
1. IntroduceAs we all know, most of mobile devices are base on tile-based GPU architecture. For these kinds of GPU, There's no extra performance to fetch frame buffer directly in pixel shader. Correspondingly, OpenGL ES add an extension 'EXT_shader_framebuffer_fetch'. Apple present a very detail description and sample code to introduce this feature.https://developer.apple.com/library/content/documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/BestPracticesforShaders/BestPracticesforShaders.html #version 300 es #extension GL_EXT_shader_framebuffer_fetch : require layout(location = 0) inout lowp vec4 destColor; void main() { lowp float luminance = dot(vec3(0.3, 0.59, 0.11), destColor.rgb); destColor.rgb = vec3(luminance); }2. UE4 Shader CompilerUE4 Almost store all of shader related document under 'Graphics Programming'.1) Shader, Material And Shader CacheIn generally, UE4 has two types of shader: global shader and Material. Global shaders are shaders defined low level and be directly used on engine level. For example, shadow filtering, post processing. Only one shader of any given global shader type exists in memory.Materials are defined by a set of states that control how material is rendered(blend mode, two sided, etc) and a set of material inputs that control how the material interacts with the various rendering passes(BaseColor, Roughness, Normal, etc).More details in Shader Development.As we all know, OpenGL/OpenGL ES use GLSL to programming GPU. The shader should be compiled at runtime before using it instead of HLSL using compiled binary shader. So, UE4 support cache mechanism which will reduce shader hitching in-
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值