<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Getting the blending right</title>
		<link>http://www.allegro.cc/forums/view/618813</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Fri, 21 Apr 2023 00:03:11 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hello, I&#39;m trying to achieve the blending in the attached image (which I&#39;ve crudely circled in red). Basically have a texture background, and then a white gradient (with alpha), and draw the white gradient over the texture, making it brighter in parts.</p><p>I&#39;ve tried loads of combinations by can&#39;t get the setting right. From the image it seems like I need to set the blender to use the destination colour for the source, and the source alpha for the destination, but I&#39;m a bit stumped!</p><p>Any pointers?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dizzy Egg)</author>
		<pubDate>Thu, 20 Apr 2023 22:21:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Sorry Dizzy, that&#39;s way above my level of expertise.  Out of curiosity, what kind of results are you getting?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (AceBlkwell)</author>
		<pubDate>Thu, 20 Apr 2023 23:04:20 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Hello Dizzy! xD <img src="http://www.allegro.cc/forums/smileys/cheesy.gif" alt=":D" /> <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p>Show code!</p><p>This will work to darken the scene.
</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/al_set_blender"><span class="a">al_set_blender</span></a><span class="k2">(</span>ALLEGRO_SRC_MINUS_DEST , ALLEGRO_DEST_COLOR , ALLEGRO_SRC_ALPHA<span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

This will work to brighten the scene (gamma);
</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/al_set_blender"><span class="a">al_set_blender</span></a><span class="k2">(</span>ALLEGRO_ADD , ALLEGRO_SRC_ALPHA , ALLEGRO_DEST_COLOR<span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
I think....<br />.<br />.<br />.</p><p>Allegro blend operations are a little strange, but it&#39;s shown best in the manual at liballeg. <a href="https://liballeg.org/a5docs/trunk/graphics.html#al_set_blender8">https://liballeg.org/a5docs/trunk/graphics.html#al_set_blender8</a>-)</p><p>I think it&#39;s better to start at full gamma / color / opacity, and then blend shadowmaps on  top. They&#39;re just inverse light maps colored gray and multiplied together.</p><p>But if you&#39;re looking to </p><p><img src="http://www.allegro.cc/forums/smileys/cool.gif" alt="8-)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Thu, 20 Apr 2023 23:42:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ahh, it was:</p><p>al_set_blender(ALLEGRO_ADD, ALLEGRO_DEST_COLOR, ALLEGRO_ZERO);</p><p>That gives the desired result of multiplying the original color by the white gradient.</p><p>Doesn&#39;t look very pretty though, may look at shadowmaps!! </p><p>(I have a light shader but was trying to get some nice lighting going in the style of this <a href="https://www.youtube.com/watch?v=fsE1ddOas7A">https://www.youtube.com/watch?v=fsE1ddOas7A</a> at about 4:52 in the video, the lovely lights!!)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Dizzy Egg)</author>
		<pubDate>Fri, 21 Apr 2023 00:03:11 +0000</pubDate>
	</item>
</rss>
