Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Blend Mode in Metal

These are the two the blend-mode i used in OpenGL what is the conversion to the metal in IOS

glEnable(GL_BLEND);

glBlendFuncSeparate(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA,GL_ONE,GL_ONE_MINUS_SRC_ALPHA);

glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE, GL_SRC_ALPHA, GL_ONE);
like image 440
Ruban4Axis Avatar asked Jul 18 '18 09:07

Ruban4Axis


People also ask

What is the use of blend mode?

A blending mode is an effect you can add to a layer to change how the colors blend with colors on lower layers. You can change the look of your illustration simply by changing the blending modes.

What is the meaning of blend mode?

Blend modes (alternatively blending modes or mixing modes) in digital image editing and computer graphics are used to determine how two layers are blended with each other.

What are some types of blend modes?

The 19 original Blending Modes are: Normal, Dissolve, Darken, Multiply, Color Burn, Darker Color, Lighten, Screen, Color Dodge, Lighter Color, Overlay, Soft Light, Hard Light, Difference, Exclusion, Hue, Saturation, Color, and Luminosity.


1 Answers

You configure blending on your render pipeline descriptor. I believe the equivalent configurations for your GL code are:

// glEnable(GL_BLEND)
renderPipelineDescriptor.colorAttachments[0].isBlendingEnabled = true

// glBlendFuncSeparate(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA,GL_ONE,GL_ONE_MINUS_SRC_ALPHA)
renderPipelineDescriptor.colorAttachments[0].sourceRGBBlendFactor = .sourceAlpha
renderPipelineDescriptor.colorAttachments[0].destinationRGBBlendFactor = .oneMinusSourceAlpha
renderPipelineDescriptor.colorAttachments[0].sourceAlphaBlendFactor = .one
renderPipelineDescriptor.colorAttachments[0].destinationAlphaBlendFactor = .oneMinusSourceAlpha

// glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE, GL_SRC_ALPHA, GL_ONE)
renderPipelineDescriptor.colorAttachments[0].sourceRGBBlendFactor = .sourceAlpha
renderPipelineDescriptor.colorAttachments[0].destinationRGBBlendFactor = .one
renderPipelineDescriptor.colorAttachments[0].sourceAlphaBlendFactor = .sourceAlpha
renderPipelineDescriptor.colorAttachments[0].destinationAlphaBlendFactor = .one
like image 57
warrenm Avatar answered Sep 17 '22 05:09

warrenm