7. Understanding Key Concepts¶
float3,float4These are vector types used to store multiple floating-point numbers. For example,
float3is commonly used for RGB color values (red, green, blue) or 3D coordinates (x, y, z).float4can store RGBA color (red, green, blue, alpha) or 4D vectors.tex2D(sampler, texcoord)This is a crucial function for reading data from textures. It takes two main arguments:
sampler: Specifies how to read the texture (e.g.,ReShade::BackBufferfor the game’s original image).texcoord: Afloat2value representing the normalized 2D coordinates on the texture, ranging from (0,0) (top-left) to (1,1) (bottom-right).
SV_Position,TexCoord,SV_TargetThese are called semantics, which are special keywords that tell the graphics card what kind of data a variable represents and how it should be used in the rendering pipeline. They act as a bridge between different shader stages.
SV_Position: Used to represent the screen-space position of a vertex (in a vertex shader) or a pixel (in a pixel shader).TexCoord: Represents texture coordinates, indicating which part of a texture to sample.SV_Target: Designates the output color of a pixel shader, which will be written to the render target (e.g., your screen).
uniformAs discussed, the
uniformkeyword declares a variable whose value is constant across an entire shader pass but can be set externally. The< ui_type = "combo"; ui_items = "..." >syntax is an annotation. These annotations are specific to ReShade FX and provide instructions to the ReShade UI on how to display and allow the user to interact with that uniform variable (e.g., as a slider, a dropdown combo box, or a checkbox).