.FRAG File Extension
What is an FRAG file?
A FRAG file contains fragment shader properties in the GL Shading Language (GLSL). It stores a graphics function used to shade a fragment, which represents a pixel in a 3D graphic, with RGB (with Alpha) color, shadows, and other effects data. FRAG files may also be saved as .FSH files.
GLSL is a high-level shading language with syntax similar to the C programming language. It is utilized by Open Graphics Library (OpenGL), an application programming interface (API) that renders 2D and 3D graphics featured in applications across different platforms. Various applications utilize OpenGL for rendering graphics, including Minecraft, Adobe After Effects, Blender, and Avogadro.
What are shaders?
Shaders give depth to 3D graphics through the alteration of their appearance, which includes defining the levels of color, light, darkness, hue, saturation, and contrast of the graphic. For example, adjusting the angle of light on a surface and the proximity of the light are two examples of how shading can modify the appearance of a graphic.
The shaders run on a computer's graphics processing unit (GPU), which reduces the workload of the computer's central processing unit (CPU). By relieving the CPU of the task of rendering graphics, the CPU can focus its resources on executing application code.
There are two prominent types of GLSL shaders:
- Vertex - Manipulates a vertex, which is the point of a triangle 3D model mesh where two lines meet; determines the coordinates of a vertex and on a large scale, the placement of graphics on the screen; called once per vertex
- Fragment - Also known as a texture shader; shades a fragment, which is a pixel in a rasterized triangle that makes up a 3D image; used to process color, shadows, and other effects
How do I open an FRAG file?
You can open FRAG files with the tools included with OpenGL SDK (multiplatform). You can also open and edit FRAG files with source code editors, such as Microsoft Visual Studio Code (multiplatform), and plain text editors, such as Microsoft Notepad (bundled with Windows), Apple TextEdit (bundled with macOS), or gedit (Linux).
NOTE: Plain text editors do not provide helpful editing capabilities like syntax highlighting with source code editors.