Matt Hoffman
카테고리: Unreal Engine
Unreal Engine 4 Rendering Part 1: Introduction
- RenderDoc의 역할은? Lets you break down a frame draw call by draw call and inspect GPU data
- Engine\Config\ConsoleVariables.ini 에서 r.ShaderDevelopmentMode=1의 역할은? Make Unreal prompt you for a shader recompile when the default material fails to compile
- Engine\Config\BaseEngine.ini 에서 어떤 것을 할 수 있는가? bAllowAsynchronousShaderCompiling, It can be useful to turn these off if you are trying to debug a section of the C++ shader pipeline
- [출처]
Unreal Engine 4 Rendering Part 2: Shaders and Vertex Data
- Vertex Factories의 역할은? Use a Vertex Factory to control what data gets uploaded to the GPU for the vertex shader
- 모든 Shader는 무엇을 상속받는가? The base class that all shaders in Unreal derive from is FShader
- 언리얼에서 두가지 main shader는? FGlobalShader and FMaterialShader
- FShader는 FShaderResource와 쌍을 이루며 어떤 역할을 하는가? Keeps track of the resource on the GPU associated with that particular shader
- FShaderResource가 여러 FShader 에게 공유될 수 있는 조건은? If the compiled output from the FShader matches an already existing one
- Global Shader의 특징은? Only one instance
- FMaterialShader와 FMeshMaterialShader의 특징은? Allow multiple instances, each one associated with its own copy of the GPU resource
- FMaterialShader의 가장 큰 특징은? Add a SetParameters function which allows the C++ code of your shader to change the values of bound HLSL parameters
- SetParameters function은 언제 호출 되는가? Before rendering something with that shader
- FMeshMaterialShader의 역할은? This adds the ability for us to set parameters in our shader before we draw each mesh
- FMeshMaterialShader의 SetMesh 함수는 어떤 역할을 하는가? Allowing you to modify the parameters on the GPU to suit that specific mesh for example TDepthOnlyVS, TBasePassVS, TBasePassPS
- FShader와 HLSL을 연결해주는 매크로는? IMPLEMENT_MATERIAL_SHADER_TYPE(TemplatePrefix, ShaderClass, SourceFilename, FunctionName, Frequency), 예시로 좋은 것은 DepthRendering.cpp
- 언리얼이 Particular permutation of a shader를 생성하는 조건은? If the Shader, Material and Vertex Factory all agree that that particular permutation should be cached
- In the case of a shader requiring SM5 support는 어떤 경우인가? Do not want to cache a shader
- ShouldCache function에 대해 설명하면? A static function that can be implemented in an FShader, FMaterial or FVertexFactory class
- ModifyCompilationEnvironment, SetupMaterialEnvironment 함수는 어떤 함수인가? These functions are called before the shader is compiled and lets you modify the HLSL preprocessor defines
- Vertex Factory의 역할은? Encapsulates a vertex data source and can be linked to a Vertex shader, lets you upload only the data you actually need to the vertex buffer
- FLocalVertexFactory와 FGPUBaseSkinVertexFactory의 공통점은? It provides a simple way to transform explicit vertex attributes from local to world space
- How does Unreal know which vertex factory to use for a mesh? Through the FPrimitiveSceneProxy class
- FPrimitiveSceneProxy를 정의하면? Render thread version of a UPrimitiveComponent
- 언리얼이 갖고 있는 두개의 thread와 특징을 설명하면? Game thread and a render thread, they shouldn’t touch data that belongs to the other thread
- UPrimitiveComponent에 대해 설명하면? Unreal uses UPrimitiveComponent for the Game thread and it decides which FPrimitiveSceneProxy class it creates by overriding the CreateSceneProxy() function
- FPrimitiveSceneProxy의 역할은? Query the game thread to get data from the game thread onto the render thread so it can be processed and placed on the GPU
- FCableSceneProxy가 builds a new mesh를 한 이후에 일어나는 일은? Associated with the FLocalVertexFactory from earlier
- UImagePlateFrustrumComponent의 특징은? There is no shader or vertex factory associated with it, it just uses the GPU callbacks to call some immediate-mode style rendering functions
- Basepass의 vertex function에 대해 설명하면? There’s only one vertex function for the basepass that has to handle all the different types of incoming data
- IMPLEMENT_VERTEX_FACTORY_TYPE 매크로의 역할은? This macro lets us bind the C++ representation of a vertex factory to a specific HLSL file
- Vertex shader에 제공되는 데이터가 변경되는 기준은? Depending on which header gets included, the data being provided to the vertex shader changes
- [출처]
Unreal Engine 4 Rendering Part 3: Drawing Policies
- Drawing policy는 무엇을 결정하는가? which shader variations are used to draw something, but it doesn’t pick what it draws or when it’s drawn
- Drawing policy는 생성자 안에서 무엇을 요구 하는가? it asks the material to find it a shader of a specific type for a specific vertex factory
- 위의 질문에 대한 답변의 원리에 대해 설명하면? Unreal handles trying to compile all possible permutations of material/shader/vertex factory, so it should be able to find this
- Material이 tessellation을 활성화 시켰다면 어떻게 되는가? drawing policy looks for a hull and domain shader
- How Unreal knows about all the possible implementations? couple of nested macros
- 정점 Shader를 등록하는 방법은? calling IMPLEMENT_BASEPASS_VERTEXSHADER_TYPE
- IMPLEMENT_BASEPASS_LIGHTMAPPED_SHADER_TYPE 매크로에 대해 설명하면? Takes the LightMapPolicyType, LightMapPolicyName and calls IMPLEMENT_BASEPASS_VERTEXSHADER_TYPE and IMPLEMENT_BASEPASS_PIXELSHADER_TYPE
- Drawing Policy Factories의 역할은? They examine the state of the material or vertex factory and then can create the correct drawing policy
- FDepthDrawingPolicyFactory 클래스에서 AddStaticMesh 함수가 하는 역할은? The Policy Factory looks at settings about the material and asset that is to be drawn and determines the appropriate Drawing Policy to create
- 위의 과정 이후에 어떤일이 발생 하는가? Unreal puts that drawing policy into a list inside of the FScene which is about to be drawn
- FDepthDrawingPolicyFactory가 mesh batch를 draw 할 때 특징은? instead of adding it to a list it instead sets up the state for the GPU via the RHI layer and then calls another drawing policy to actually draw the mesh
- Drawing Policies, or Drawing Policy Factories의 특징은? there was no shared base class
- AddToDrawLists가 호출되면 무슨일이 발생하는가? it examines the asset and project settings to decide what to do with it
- FStaticMesh is marked to be added to draw lists 이후에 어떤일이 발생하는가? it creates a wide variety of Drawing Policy Factories, who then create Drawing Policies and add them to the correct list
- FDeferredShadingRenderer::Render 함수의 역할은? kicks off the whole process and controls the order of the render operations
- [출처]
댓글남기기