Modulate 2x Blend in blitzmax?
BlitzMax Forums/BlitzMax Programming/Modulate 2x Blend in blitzmax?
| ||
Hiya, I don't know how to achieve this but I want to draw 2D lightmaps over my game screen. In 3D packages /Quake3 the term is known as modulate 2x. Which means a pixel of 128,128,128 will make no change to the image, while a pixel thats higher than that will brighten (over exposure) the pixels like addblend, while pixels lower than 128 will achieve a kind of shadeblend. I tried for a week to get this working in blitzmax to no avail. I know it is possible but I have given up and I humbly seek your help please! Here is a link to the old blend mode things I spoke to mark about for the beta testing for Blitz3D: http://www.blitzbasic.com/Community/posts.php?topic=27774 however i don't know what kind of magic Mark did! I would like to know how to achieve this effect in Blitzmax if at all possible. Thanks! |
| ||
It's going to be driver-specific. Do you need/want it for OpenGL, DX7, DX9 or some combination thereof? |
| ||
OpenGL would be great if possible please :) Would like mac owners to be able to use it. edit: if it was both we could be more compatible but if no choice then opengl would be great! |
| ||
Hmm. Isn't that kind of the same thing as two multiplies combined? Like, being able to multiply by 0..2 instead of 0..1? |
| ||
I am not sure. I would prefer if I could do this on a single texture unit if possible though via multiple passes since its only pre rendered anyway and the code would probably be a lot simpler. When i combined both, I saw it lost too much pixel information so it probably needs to retain that information somehow. Maybe something like putting the lightmap down first, then blending the image on top then putting a shademap on top of that (3 passes) not entirely sure. |
| ||
Its not very hard. I was going to share the code but.. well I couldnt find it since its been so long since i last used it. But try the ATI opengl tool where you put together your own effects and it tells you the gl code to do it. |
| ||
seems to be as simple as glBlendFunc(GL_DST_COLOR,GL_SRC_COLOR). You can call this directly in your BMax code. |
| ||
Are you after something like http://www.blitzbasic.com/Community/posts.php?topic=88944#1010386? |
| ||
Thats pretty impressive :) but no, i just wanted a 2D lightmap layer over my level. seems to be working ok with that single line of code :) |
| ||
gl_FragColor = color0 * color1 * 2.0; The way we used to do this was to crank the monitor gamma way up. There's also a fixed function blend mode to do it. |
| ||
This is probably a bit late for you, but I have now added MOD2XBLEND to Max2D using my Odd2D module. It should work with OpenGL, Direct3D7 and Direct3D9. The module link is in my sig, and the discussion thread can be found here. Have fun. |
| ||
Better late than never oddball, and always welcome :) nice module btw... |