Join our Discord and discuss LaForge with us and the ProductionCrate community! https://discord.gg/E2RDdYNj9Q
Adding Effects to your Project
To get started, add a LaForge effect to your layer in After Effects. Then activate the panel by clicking “Start Panel”.
Once the panel is loaded, you will see all the presets at your disposal! These are all plugins that we built during the development of LaForge.
Select a preset, and add it to your layer by clicking “Apply preset”. You’ve just loaded in your first LaForge plugin!
You can change your preset by repeating the same action, LaForge will override the effect’s selected preset.
LaForge – Advanced
The code editor is the backbone of LaForge. Using this, you can create your very own programmable effects. We will be taking our time to develop a cohesive, user-friendly and knowledge packed guide on how to do this, but for those with enough motivation, here’s some useful information.
All Forge Shaders are processed using compute shaders. You can define the workgroup size of the shader in the options. Each workgroup has a number of iterations which is limited to 1024 on most of the GPUs, (calculated by multiplying the x * y * z sizes). Do not go over this limit. Workgroups are dispatched randomly, so don’t expect items to render in order.
If you want the results of each invocation to work with each other, (in analysis mode), use atomic operations. For more information, you can read:
https://www.khronos.org/opengl/wiki/Compute_Shader
Effect Mode
In Effect Mode you can create an Effect Shader. Shaders return an array of pixels. A hidden part does the job. The main function is this mode is
mainRender (in vec2 fragCoord, vec4 outColor);
An effect can use stepBuffers to use multiple buffers in one effect. See the fidelityFx preset as an example. LaForge does not yet support recursive passes (these buffers render at frame -1), but it is planned for the future.
Analysis Mode
An Analysis shader returns a 1d (float) or 2d (point) or 3d value (color). It can access the same parameters as a standard effect except for stepBuffers.
Camera and lights
Camera And lights are available in After Effects only. If a preset use one of these parameters, Premiere Pro will lock access to the shader
If you want to create 3D ray tracing or ray marching, LaForge has two functions to help you load the camera:
forge_getCamOrigin() -> Returns a vec3 with the camera position
forge_getCamRayDirection() -> Returns a vec3 with the camera ray direction.
Sometimes you may have to invert the Y coordinate of the camera, especially if your shader’s up direction is Y+ (AE’s upward direction is Y-).
Vec3 rd = forge_getCamRayDirection();
Vec3 ro = forge_getCamOrigin();
rd.y = -rd.y;
ro.y = -ro.y;
Some Shaders may have a different scale value of the camera data. You can take a look at the fractal or aurora presets for real implementations.
NAME | Name can be modified | type | options | description |
forgeUv | no | vec2 | no | the uv coordinate with a pixel correction from vk to host app (between 0 and 1 on the screen) |
fragCoord | no | vec2 | no | the pixels coordonate. |
resolution | yes | vec2 | no | the resolution of output shader |
time | yes | float | no | Current time in seconds. In host App it’s reference to the layer time, not the composition time |
framerate | yes | float | no | Frame rate of the source |
timeDelta | yes | float | no | Time elapsed between two frame render. Can vary on the preview in the panel. In host app it’s 1/FrameRate |
timeFrame | yes | int | no | Current time in frame |
downscale | yes | vec2 | no | The current downscale from the layer in the host application |
appId | yes | int | no | Returns 0 if the host App is AE and 1 if it’s Premiere |
camData | no | cameraDataStruct | no | [AE ONLY] Camera Data informations. See below for the cameraDataStruct |
forgeNumLights | no | int | no | [AE ONLY] The number of lights in current composition |
lightsData[50] | no | Array of lightDataStruct | no | [AE ONLY] array of lightsData infos in the current composition. Limited to 50 |
shaderResult | no | Int int[2] int[3] | no | Used in Analysis. Depending on analysis result type choosen. |
forgeStepBuffer{index} | no | sampler2D | no | returns sampler from previous stepBuffers {index} must be inferior to the current buffer index. For ex: forgeStepBuffer4 can’t load forgeStepBuffer5 |
texture{index} | yes | sampler2D | no | {index} is between 0 and 4 returns sampler from the texture indexed |
forgeTexturesInfos[5] | no | texturesInfosStruct | no | Returns infos on each textures. forgeTexturesInfos[0] returns info of the source layer of the shader. forgeTexturesInfos[1]-> texture1 etc. see bellow the struct infos |
forgeStepBuffersInfos[9] | no | texturesInfosStruct | no | Returns ifnos in each stepBuffers of the project. |
ddl_{index} | yes | int | Items name | {index} is from 0 to 9 Return the selection of the dropdownlist. When creating a shader, you can set name for each param of the drop down list. The size cannot be reduced for now because of an issue in Premiere |
slider_{index} | yes | float | Minimum value Maximum value Divide result by 100 | {index} is from 0 to 19 Returns the floating value of the corresponding slider. |
slider_int_{index} | yes | int | Minimum value Maximum value | {index} is from 0 to 19 Returns the integer value of the corresponding slider. |
point_{index} | yes | vec2 | no | {index} is from 0 to 9 Returns normalized pixel Coordonate, between 0 and 1, of the corresponding point. |
rotation_{index} | yes | float | no | {index} is from 0 to 9 returns the corresponding rotation value from users (angle param in AE). Values are in degrees |
color_{index} | yes | vec3 | no | {index} is from 0 to 9 Returns the color value of thecorresponding param in normalized space (0-1) |
checkbox_{index} | yes | bool | no | {index} is from 0 to 9 Returns the bool of the corresponding param |