
Shaders using FMaterialShaderType are pass specific shaders which need access to some of the material's attributes, and therefore must be compiled for each material, but do not need to access any mesh attributes. This is called in the pixel shader and converts vertex factory specific interpolants (FVertexFactoryInterpolants) to the FMaterialPixelParameters structure which is used by the pass pixel shaders. Transforms the FVertexFactoryInput to FVertexFactoryInterpolants, which will be interpolated by the graphics hardware before getting passed into the pixel shader. For GPU skinned meshes, the position is skinned first and then transformed to world space. For Static Meshes this merely transforms the local space positions from the vertex buffer into world space using the LocalToWorld matrix. This is called from the vertex shader to get the world space vertex position. Vertex factory data to be passed from the vertex shader to the pixel shader.

A common example is the TangentToLocal matrix, which had to be computed from unpacked vertex inputs. Used to store cached intermediate data that will be used in multiple vertex factory functions. These must match the vertex declaration in the C++ side FVertexFactory. Some important components of the vertex factory shader code are:ĭefines what the vertex factory needs as input to the vertex shader. Vertex factories consist of mainly vertex shader code, but some pixel shader code as well. The vertex factory shader code is an implicit interface which is used by the various pass shaders to abstract mesh type differences. For example, FGPUSkinVertexFactory stores the bone matrices needed for skinning, as well as references to the various vertex buffers that the GPU skin vertex factory shader code needs as input.

A FVertexFactoryType represents a unique mesh type, and a FVertexFactory instance stores the per-instance data to support that unique mesh type. Materials have to support being applied to different mesh types, and this is accomplished with vertex factories. Materials are defined by a set of states that control how the 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). Only one shader of any given global shader type exists in memory. Examples would be shadow filtering, or post processing. Global shaders are shaders which operate on fixed geometry (like a full screen quad) and do not need to interface with materials.

move node) and using the 'Apply' in the material editor.

If you want to iterate on a material, you can trigger recompile of the material by making a small change to the material (e.g. If you change a file that is included in many shaders (such as, f), this can take a while.
