I have figure out the math with use legacy checked. but I don't know what is the math ps use with use legacy unchecked.
1 Answer
If you are using OpenGL and if you are referring to Photoshop's layer blend functions. This may be a complete answer for you
https://mouaif.wordpress.com/2009/01/05/photoshop-math-with-glsl-shaders/
I found that link from this one
https://stackoverflow.com/questions/818230/photoshop-blending-mode-to-opengl-es-without-shaders?rq=3
The rest here is not EXACTLY an answer to your question, because I do not fully understand your question. Do please add more information about how you need to apply this math for more practical answers.
While I don't know what the exact equations are, the blend options in Photoshop have been available for a very long time. My guess is that each layer (legacy) blend mode represents a fairly simple mathematical equation.
Given what photoshop is and who adobe is and how advanced their functionality has always been I would not be at all surprised if they were writing custom GFX card code way back when. However with the shear amount of GFX card code that was written for very specific hardware for specific engines like DirectX and OpenGL historically(and currently), chances are that they leveraged capabilities that have been directly available in these engines for a long time.
My guess is that you can simulate all of the layer blend modes with something like OpenGL's "blendEquation" and "blendFunc", which amounts to modifying how the values between two layers are added together. https://learnopengl.com/Advanced-OpenGL/Blending#Blending
- $\begingroup$ thanks to your answer, but I want to know what is the math of brightness and contrast adjustmentlayer the modern way not the legacy way, for I already know what the legacy way do. $\endgroup$Celebrimbor– Celebrimbor2025-01-15 07:12:48 +00:00Commented Jan 15 at 7:12
- $\begingroup$ I have run some test to photoshop, and the brigntness seems more like nolinearly,but I cant find the right formula. well thanks any way. $\endgroup$Celebrimbor– Celebrimbor2025-01-15 07:23:03 +00:00Commented Jan 15 at 7:23
- $\begingroup$ IF it is not linear or simple quadratic, I would assume it is modulated based on your color space settings and the curve associated with even changes in saturation per color. This is only a guess. PS offers overt color space settings so you might see if it changes with those. If you are unfamiliar here is an article that dives into color spaces. scratchapixel.com/lessons/digital-imaging/colors/… $\endgroup$Jody Sowald– Jody Sowald2025-01-17 21:54:36 +00:00Commented Jan 17 at 21:54