sunmaggot Posted August 25, 2017 Share Posted August 25, 2017 (edited) I read wiki about blend functions and it says that overlay is combination of screen and multiply. However when I try to produce overlay effect with screen and multiply, I can't do it because the screen blending makes something white. Here is the result: The base layer is shallow water. The top layer is cloud rendered with white colour and invisible colour. Overlay result: Screen + multiply with screen on top of multiply. I also tried to change the order of screen and multiply layers but it won't work. I want to know how can I produce overlay blending with screen and multiply? Or is overlay a very unique blending that there is no combination that can produce same result? Edited August 25, 2017 by sunmaggot Typo Quote 道生一,一生二,二生三,三生萬物。 non-existence made one, one made two, two made three, three made matters. 道可道,非常道;名可名,非常名。 well-defined principles are not eternal principles, names that can be named are not eternal names. Link to comment Share on other sites More sharing options...
Pixey Posted August 25, 2017 Share Posted August 25, 2017 (edited) We do have an 'Overlay' Blending Mode option in the Layer Properties window . (But - I have have misunderstood the question.) P.S. Changing blend modes is tricky and often you get a funny result if you try to change both layers. Perhaps reading this will help: https://www.getpaint.net/doc/latest/BlendModes.html Edited August 25, 2017 by Pixey added more info Quote How I made Jennifer & Halle in Paint.net My Gallery | My Deviant Art "Rescuing one animal may not change the world, but for that animal their world is changed forever!" anon. Link to comment Share on other sites More sharing options...
sunmaggot Posted August 25, 2017 Author Share Posted August 25, 2017 Thank you for the feedback. In fact the reason I asked about this is because overlay blending will check every pixel to decide whether it will do screen or multiply. This will add some complications to my project, so if there exists a way of blending that doesn't check every pixel, it will make the problem much easier. Anyway, I found a way to produce similar result but not as good, but it does not need to check every pixel. Quote 道生一,一生二,二生三,三生萬物。 non-existence made one, one made two, two made three, three made matters. 道可道,非常道;名可名,非常名。 well-defined principles are not eternal principles, names that can be named are not eternal names. Link to comment Share on other sites More sharing options...
MJW Posted August 26, 2017 Share Posted August 26, 2017 8 hours ago, sunmaggot said: This will add some complications to my project, so if there exists a way of blending that doesn't check every pixel, it will make the problem much easier. Blend modes, almost by definition, are pixel-by-pixel operations. Each pixel is affected only by pixels in other layers with the same coordinates. Perhaps if you explain what you want to achieve, someone can suggest a way to achieve it. Quote Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted August 26, 2017 Share Posted August 26, 2017 As far as I understand it, Overlay is the only Blend mode which uses two different formulas to return a result. But not at the same time. If the upper layer component value is less than 128, the returned value is twice that of Multiply. Thus where darker colors are present in the upper layer, Overlay acts like Multiply doubled which greatly darkens the already dark colors. If the upper layer component value is greater or equal to 128, the returned result is twice that of the Screen blend. This makes light portions of the image significantly brighter. This being the case, you won't get the same result by combining Multiply and Screen. Quote ebook: Mastering Paint.NET | resources: Plugin Index | Stereogram Tut | proud supporter of Codelab plugins: EER's Plugin Pack | Planetoid | StickMan | WhichSymbol+ | Dr Scott's Markup Renderer | CSV Filetype | dwarf horde plugins: Plugin Browser | ShapeMaker Link to comment Share on other sites More sharing options...
sunmaggot Posted August 26, 2017 Author Share Posted August 26, 2017 @MJW The thing I want to make is some uneven light shining on my map of my game. The overlay blending effect seems very good but it requires me to make a shader that checks every pixel, just like what @Ego Eram Reputo said. Now my solution is using: GL_DST_COLOR + GL_ONE Quote 道生一,一生二,二生三,三生萬物。 non-existence made one, one made two, two made three, three made matters. 道可道,非常道;名可名,非常名。 well-defined principles are not eternal principles, names that can be named are not eternal names. Link to comment Share on other sites More sharing options...
MJW Posted August 26, 2017 Share Posted August 26, 2017 1 hour ago, sunmaggot said: Now my solution is using: GL_DST_COLOR + GL_ONE I'm not sure that means. If, as I would haphazardly guess, GL_ONE is is "full on" (i.e, 255) that would just overflow and get clamped, setting the color to white (which I assume means my guess is off the mark). Since I'm not sure what you mean, I shouldn't speculate, but I will anyway. I'd think that if you want uneven light, you could use something like GL_DST_COLOR * (1 + UNEVEN_LIGHT_AMOUNT)., or equivalently GL_DST_COLOR + GL_DST_COLOR * UNEVEN_LIGHT_AMOUNT, assuming that could be done with your shader. That's physically sort of how extra light works: the light gets multiplied by the surface color (which I'm assuming is proportional to the color of the lighted surface, without the extra light). I'm not sure why Overlay Mode would be well-suited to imitating light. Light seems to me to be more like Multiply and Add blend modes. Quote Link to comment Share on other sites More sharing options...
sunmaggot Posted August 26, 2017 Author Share Posted August 26, 2017 @MJW it is the blend function used in LibGDX. Quote 道生一,一生二,二生三,三生萬物。 non-existence made one, one made two, two made three, three made matters. 道可道,非常道;名可名,非常名。 well-defined principles are not eternal principles, names that can be named are not eternal names. Link to comment Share on other sites More sharing options...
TrevorOutlaw Posted August 26, 2017 Share Posted August 26, 2017 Question for the OP...have you tried the BlendModes plugin? Quote Paint.NET Gallery | Remove Foreground Object Tutorial | Dispersion Effect Tutorial Link to comment Share on other sites More sharing options...
MJW Posted August 26, 2017 Share Posted August 26, 2017 5 hours ago, TrevorOutlaw said: Question for the OP...have you tried the BlendModes plugin? I don't think sunmaggot's question is actually about PDN. it sounds like it's really about a game programming language called LibGDX. I think he just wanted to use some of the graphics concepts from PDN. (I'm not quite sure why he expected his response that he now uses "GL_DST_COLOR + GL_ONE" would be meaningful to anyone here.) EDIT: BTW, the rather poorly written Wikipedia article fails to mention that LibGDX seems to be based on OpenGL -- a pretty fundamental fact! I've never written in OpenGL, but it's a widely used graphics programming language, originally developed by Silicon Graphics. Quote Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted August 26, 2017 Share Posted August 26, 2017 I thought you might be interested in looking at Texture Shader. https://forums.getpaint.net/topic/31964-texture-shader/?do=findComment&comment=529652 How about posting your map? 1 Quote ebook: Mastering Paint.NET | resources: Plugin Index | Stereogram Tut | proud supporter of Codelab plugins: EER's Plugin Pack | Planetoid | StickMan | WhichSymbol+ | Dr Scott's Markup Renderer | CSV Filetype | dwarf horde plugins: Plugin Browser | ShapeMaker Link to comment Share on other sites More sharing options...
MJW Posted August 26, 2017 Share Posted August 26, 2017 Ego Eram Reputo, I think game developers might be able to use my height-map plugins, especially the Texture Merger and Texture Smoother. Maybe I'll engage in a little shameless self promotion, and suggest their use them on some game-developer websites where height maps are being discussed. Quote Link to comment Share on other sites More sharing options...
TrevorOutlaw Posted August 26, 2017 Share Posted August 26, 2017 5 hours ago, MJW said: I don't think sunmaggot's question is actually about PDN. it sounds like it's really about a game programming language called LibGDX. I think he just wanted to use some of the graphics concepts from PDN. (I'm not quite sure why he expected his response that he now uses "GL_DST_COLOR + GL_ONE" would be meaningful to anyone here.) EDIT: BTW, the rather poorly written Wikipedia article fails to mention that LibGDX seems to be based on OpenGL -- a pretty fundamental fact! I've never written in OpenGL, but it's a widely used graphics programming language, originally developed by Silicon Graphics. It still sounds like the OP was complaining about how PDN computes the overlay mode, which was why I suggested the BlendModes plug-in to see if the OP could find the different blending mode that would work for the OP. Quote Paint.NET Gallery | Remove Foreground Object Tutorial | Dispersion Effect Tutorial Link to comment Share on other sites More sharing options...
MJW Posted August 27, 2017 Share Posted August 27, 2017 I don't think sunmaggot was complaining about how PDN computes the Overlay mode.I think he was trying to understand why he couldn't reproduce the same effect by combining Multiply and Screen blending functions. The answer was that they aren't both applied; one or the other is applied. Quote Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted August 27, 2017 Share Posted August 27, 2017 Yup, and it's a per-pixel operation. I'm not sure why sunmaggot wants to do it some other way. Quote ebook: Mastering Paint.NET | resources: Plugin Index | Stereogram Tut | proud supporter of Codelab plugins: EER's Plugin Pack | Planetoid | StickMan | WhichSymbol+ | Dr Scott's Markup Renderer | CSV Filetype | dwarf horde plugins: Plugin Browser | ShapeMaker Link to comment Share on other sites More sharing options...
sunmaggot Posted August 27, 2017 Author Share Posted August 27, 2017 (edited) To clarify, I am not complaining, but I want to see if there is a way to do overlay blending without checking every pixel. This is why I attempt to get overlay blending by screen and multiply. It seems overlay is unique blending and is not easy to produce similar effect. Edited August 27, 2017 by sunmaggot Quote 道生一,一生二,二生三,三生萬物。 non-existence made one, one made two, two made three, three made matters. 道可道,非常道;名可名,非常名。 well-defined principles are not eternal principles, names that can be named are not eternal names. Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted August 27, 2017 Share Posted August 27, 2017 9 hours ago, sunmaggot said: I want to see if there is a way to do overlay blending without checking every pixel There isn't. That's how it works. Every pixel in one layer is compared with the same pixel location on the second layer. Perhaps there is something I'm missing? Can you explain exactly what you're trying to achieve and why the Overlay blend mode won't do the job? Quote ebook: Mastering Paint.NET | resources: Plugin Index | Stereogram Tut | proud supporter of Codelab plugins: EER's Plugin Pack | Planetoid | StickMan | WhichSymbol+ | Dr Scott's Markup Renderer | CSV Filetype | dwarf horde plugins: Plugin Browser | ShapeMaker Link to comment Share on other sites More sharing options...
sunmaggot Posted August 28, 2017 Author Share Posted August 28, 2017 In LibGDX, the default blend function provided in spritebatch class can only perform simple blending modification such as changing the formula of blending. If I want to make overlay blending, I have to write a shader program because of how overlay works. This is why I am looking for a simple algorithm that can produce similar effect. After hours of searching, I ended up finding a website that can let me try the blending. http://www.andersriggelsen.dk/glblendfunc.php The following chart shows what I am talking about. By modifying blend function, some modifications can be done. https://goo.gl/images/q3vkpM I use GL_DST_COLOR (source) , GL_ONE (destination) for my blending now and it seems that it can do what I want. This skips shader programming. The reason I didn't bring up these things before is because I feel like this is not about the original problem anymore. But it makes things confusing, so now I am posting these. Quote 道生一,一生二,二生三,三生萬物。 non-existence made one, one made two, two made three, three made matters. 道可道,非常道;名可名,非常名。 well-defined principles are not eternal principles, names that can be named are not eternal names. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.