This hosting is not for free. You might want to consider disabling AdBlock or other extensions hiding ads. I'd appreciate that! Even if you don't do that, this web is fully functional so don't worry.

Privacy Terms

Layers, Nodes, Code Programming - Blending Mode in Video/Photo Editor

This article is a simple explanation of sometimes confusing terminology which is often used in Blender and many other video or photo editors. Certain operations in computers can be defined by programming a code in a specific programming language such as Python, C++ or Java. They can also be represented visually by connecting nodes (Node-based programming) representing operations such as in Compositor or Material Editor in Blender, Visual Scripting in Graph Editor in Unity, or in Blueprint Editor in Unreal Engine. And when talking about video or image editing, there are also layers which can be used to combine imagery together. Below is a simple example of producing exactly the same thing in Blender but in different ways. The task is simple: take two different pictures and compose them over each other with additive blending mode, which means that the pixels are simply added together.

The first image used in the blending mode example of Fushimi Inari in Japan.
The first image used in the blending mode example of Fushimi Inari in Japan.
The second image used in the blending mode example of Tori Gate at Itsukushima in Japan.
The second image used in the blending mode example of Tori Gate at Itsukushima in Japan.
Layers in VSE in Blender are used to add two images together with additive blending mode. This is the most straightforward way.
Layers in VSE in Blender are used to add two images together with additive blending mode. This is the most straightforward way.
Nodes in Compositor in Blender are used to add two images together with additive blending mode using Mix Node.
Nodes in Compositor in Blender are used to add two images together with additive blending mode using Mix Node.
Nodes in Compositor in Blender are used to add two images together with additive blending mode. The Mix Node is not used here to demonstrate how it works internally on a lower level. The RGB channels are added one by one.
Nodes in Compositor in Blender are used to add two images together with additive blending mode. The Mix Node is not used here to demonstrate how it works internally on a lower level. The RGB channels are added one by one.
Python code in Script Editor Blender is used to add two images together with additive blending mode. The script iterates over all pixels of both images, adds them together and stores them in the result.
Python code in Script Editor Blender is used to add two images together with additive blending mode. The script iterates over all pixels of both images, adds them together and stores them in the result.

First, it is necessary to load the images to Blender, for example, int the Compositor or Image Editor and to create the resulting image of the same size. The code was run in the Script Editor. Here is the used Python script:

import bpy

firstImage = bpy.data.images.get("japanFushimi.jpg").pixels[:]
secondImage = bpy.data.images.get("japanTori.jpg").pixels[:]
resultImage = bpy.data.images.get("Untitled")
# We copy the pixels because the access will be faster
resultPixels = list(resultImage.pixels)

# Every pixel consists of four values Red, Green, Blue, and Alpha (Transparency)
rgbaSize = 4
# Here we assume that all three images are of the same size
width = resultImage.size[0] * rgbaSize
height = resultImage.size[1]

for y in range(1,height):
    for x in range (1,width):
        # The image is linear array so we transform the XY to 1D coordinate
        index = width * y + x
        # This is the main addition operation for each pixel
        resultPixels[index] = firstImage[index] + secondImage[index]
   
# Putting back the edited pixels in the resulting image     
resultImage.pixels[:] = resultPixels
resultImage.update()

The goal of this article is to demonstrate what are blending modes, what is the difference between layer or tracks and nodes or graphs, what is the difference between nodes and code programming and how are all these features supported in Blender. This article is a simple practical demonstration of these things.

Published:

Keywords: Blender, cinematography, computer science, image composition
#blender #gameengine #nodes #videoediting #imageediting

You might also be interested in these articles:

Most Useful Japanese Phrases for a Tourist

3D Voronoi Shattering on GPU

If You Meet the Buddha, Kill Him, Because God Is Dead - Our Illusions

Where to Get Free Music for YouTube Videos?

V-log,Chroma Subsampling 4:2:2,10-bit:Modern Video Standards Explained

Comments

Write a new comment:

All the comments are reviewed before publishing! Meaningless posts are automatically refused.

Be the first legendary hero and write a message that will last for ages!