<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Elite Treacle Devlog &#187; Source Engine</title>
	<atom:link href="http://elitetreacle.com/devlog/category/source-engine/feed/" rel="self" type="application/rss+xml" />
	<link>http://elitetreacle.com/devlog</link>
	<description>Source Engine and other kinds of crap</description>
	<lastBuildDate>Wed, 20 Jan 2016 00:31:43 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.41</generator>
	<item>
		<title>The Problem With Water</title>
		<link>http://elitetreacle.com/devlog/the-problem-with-water/</link>
		<comments>http://elitetreacle.com/devlog/the-problem-with-water/#comments</comments>
		<pubDate>Wed, 20 Jan 2016 00:21:46 +0000</pubDate>
		<dc:creator><![CDATA[SpAM_CAN]]></dc:creator>
				<category><![CDATA[Outside Influence]]></category>
		<category><![CDATA[Source Engine]]></category>

		<guid isPermaLink="false">http://elitetreacle.com/devlog/?p=29</guid>
		<description><![CDATA[As stated in the previous post, we&#8217;ve recently moved over to the Portal 2 branch of the Source Engine. With it comes a pretty big feature: dynamic water reflections. Now, you may be thinking &#8220;but Sam, hasn&#8217;t Source had dynamic water reflections since Half-Life 2?&#8221;. The answer is yes, it has. The issue is how [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>As stated in the previous post, we&#8217;ve recently moved over to the Portal 2 branch of the Source Engine. With it comes a pretty big feature: dynamic water reflections. Now, you may be thinking &#8220;but Sam, hasn&#8217;t Source had dynamic water reflections since Half-Life 2?&#8221;. The answer is yes, it has. The issue is how it deals with rendering said reflection.</p>
<p><span id="more-29"></span></p>
<p>Source makes use of a BSP system for deciding which parts of a level should be rendered. The game is given a &#8220;potential visibility set&#8221; by the map compiler, and this is used to decide what to render and what not to. It&#8217;s also used by various parts of the engine when it comes to allocating rendertargets, such as those used by the dynamic water reflections. Herein lies the problem; Valve originally designed Source to work f  or Half-Life 2, and Half-Life 2 had no need for levels with more than one height of water in an area at once (in rare exceptions, they used a cheaper water that had no reflection). As such, they never built the engine to allow for multiple heights of water at once (much the same as the engine was never built to allow for more than one monitor scene being rendered at a time). Most mappers didn&#8217;t see this as a problem, or worked around it, so everything was fine. And then there was Portal.</p>
<p>Portal has unique challenges when it comes to rendering the scene. When the game decides which water surfaces should or should not be rendered, it doesn&#8217;t take in to account other cameras in the scene &#8211; typically, func_monitors simply don&#8217;t render water, but portals never had this sort of protection added to them. Instead, the game freaks out and will try to render intermittently between the three camera locations &#8211; the player, the blue, and the orange portals. Being a fairly small project, the team were unable to rewrite the dynamic water rendering system to allow for multiple camera angles in time for release, and so went with simple lightmapped textures with scrolling normal maps instead (which actually worked better for puzzle cues, allowing light to hit the surface is great for directing the eye toward something).</p>
<p>For Outside Influence, I always wanted to get that dynamic reflection look, but keep the lightmaps that were so good for directing the eye of the player in levels. I spent a long, long while tinkering, and tried many different methods of achieving this. A 2012 test map (bizarrely called &#8220;product.bsp&#8221;) shows off some of the methods I&#8217;d used throughout early development, but most of them hinge upon layering of multiple textures, such as a translucent lightmapped texture above a dynamic reflection. This &#8220;layering&#8221; technique was used frequently, as modders were unable to add custom shaders to Portal due to the closed-source DLLs. I thought that if I hid the dynamic reflections under enough guff, no one would notice the glitching.</p>

<a href='http://elitetreacle.com/devlog/the-problem-with-water/2016-01-19_00004/'><img width="150" height="150" src="http://elitetreacle.com/devlog/wp-content/uploads/2016/01/2016-01-19_00004-150x150.jpg" class="attachment-thumbnail" alt="Reflection, then translucent texture, then refraction (left) - Lightmapped texture, then refraction (right)" /></a>
<a href='http://elitetreacle.com/devlog/the-problem-with-water/2016-01-19_00002/'><img width="150" height="150" src="http://elitetreacle.com/devlog/wp-content/uploads/2016/01/2016-01-19_00002-150x150.jpg" class="attachment-thumbnail" alt="Dynamic Reflection and a translucent texture (left) - Basic lightmapped surface (right)" /></a>
<a href='http://elitetreacle.com/devlog/the-problem-with-water/2016-01-19_00001/'><img width="150" height="150" src="http://elitetreacle.com/devlog/wp-content/uploads/2016/01/2016-01-19_00001-150x150.jpg" class="attachment-thumbnail" alt="Refraction layer above lightmapped texture (left) - Same, but with a cubemap applied (right)" /></a>

<p>Naturally, the problems with reflections in Portal kept raising their head. These attempts never looked good, and I don&#8217;t know how I managed to delude myself into thinking that they did. In 2013 the next, and eventually final, iteration of the water technique, one must look toward the GoldSrc engine era of games. I was replaying Half-Life Blue Shift when I noticed the very snazzy looking laboratory with a reflective floor. Curious, I took a peek underneath to discover the entire room and all visible models had been replicated below a translucent textured surface, flipped to appear as a reflection. This was genius &#8211; why write a complicated rendering method for something that&#8217;ll only be seen once or twice? Just flip the whole room! <div id="attachment_38" style="width: 310px" class="wp-caption alignnone"><a href="http://elitetreacle.com/devlog/wp-content/uploads/2016/01/2016-01-20_00006.jpg"><img class="size-medium wp-image-38" src="http://elitetreacle.com/devlog/wp-content/uploads/2016/01/2016-01-20_00006-300x169.jpg" alt="The GoldSrc way." width="300" height="169" /></a><p class="wp-caption-text">The GoldSrc way.</p></div></p>
<p>I thought that, given the usually boxy nature of Portal tests, this method might work out for me. I repurposed my translucent lightmapped surface, created a refractive water material to go underneath it, and viola! Pretty convincing looking reflections in Portal, with no rendering issues! There were other issues though &#8211; most notable being that you could no longer build rooms anywhere close to underneath water any more, but it was a good compromise. I refined it a few times, tweaking normal maps, tints and particle effects (even adding a series of ripples scattered across the surface of the water). The result is what was seen in the Outside Influence Greenlight trailer, and a previously unreleased video, linked below. Of course, it didn&#8217;t reflect physics props, turrets or any non-fixed gameplay element, but I&#8217;m still proud of the result given the limitations.</p>
<p><iframe width="720" height="405" src="https://www.youtube.com/embed/jYMBVQmrLzE?feature=oembed" frameborder="0" allowfullscreen></iframe></p>
<p>All this work is sorta moot now that I&#8217;m working with Portal 2 &#8211; water is as easy as creating the brush and slapping the material on it (and creating a custom flowmap, if one wants the pretty flowing effects), but I thought I&#8217;d share some insight into some of the weird crap I tried to pull off in the Portal engine at one time or another (and trust me, there&#8217;s plenty more weird experiments that I&#8217;ll go into sometime).</p>
<p>I hope to show off some stuff more pertinent to the current, and hopefully final, version of the game soon. Until then, take care!</p>
]]></content:encoded>
			<wfw:commentRss>http://elitetreacle.com/devlog/the-problem-with-water/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Sentiment</title>
		<link>http://elitetreacle.com/devlog/sentiment/</link>
		<comments>http://elitetreacle.com/devlog/sentiment/#comments</comments>
		<pubDate>Thu, 12 Feb 2015 02:05:49 +0000</pubDate>
		<dc:creator><![CDATA[SpAM_CAN]]></dc:creator>
				<category><![CDATA[Outside Influence]]></category>
		<category><![CDATA[Source Engine]]></category>

		<guid isPermaLink="false">http://elitetreacle.com/devlog/?p=10</guid>
		<description><![CDATA[I don&#8217;t know about you, but I&#8217;m a sentimental fucker. I feel a twang when I send off PC hardware to get replaced. So it won&#8217;t come as a surprise to know that I feel the same way about game development. I&#8217;m getting better, but I find it hard to let go of certain things. [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>I don&#8217;t know about you, but I&#8217;m a sentimental fucker. I feel a twang when I send off PC hardware to get replaced. So it won&#8217;t come as a surprise to know that I feel the same way about game development. I&#8217;m getting better, but I find it hard to let go of certain things. This really isn&#8217;t good in long-term creative projects, especially game development. Lately I&#8217;ve gotten ruthless and started replacing maps created back in 2012 (when the current version of the game was started &#8211; I plan on a post about the history of the development sometime soon), and changing design attitudes to fit better with what I love about the original Portal.</p>
<p><span id="more-10"></span></p>
<p>I&#8217;m an outspoken critic of Portal 2 &#8211; I genuinely feel that the sequel lost what was so special about Aperture Science. Portal features an attention to detail unmatched by any other game, even other games by Valve. Individual panels are textured slightly differently to give the impression of age, tiles are stained here and there, and everything is laid out to give the player the best view of the puzzle before beginning. Portal 2 went for the scale approach, making Aperture seem vast, but in the process lost the strange, impersonal intimacy that the original game featured. Portal&#8217;s Aperture was clinical to the core. Not wanting to be a hypocrite, I&#8217;ve gone over my maps making sure they follow some of the design cues from the original better.</p>
<p>Some of my older puzzles are&#8230; well, they&#8217;re not good. And I know they&#8217;re not good. Some of them are fine, and need only minor tweaks (which have been made), but some are just terrible, relying on weird tricks with the portals that just don&#8217;t make real sense. It&#8217;s good that I&#8217;m finally recognizing this and taking steps to solve the issue, but part of me hurts to change these maps. One particular test involving turrets has a room that is virtually unchanged from the very first version of the game from way back in 2009 &#8211; it had remained for over 5 years.</p>
<p>It&#8217;s not the only thing in the game left over from this stage either. Pieces of geometry have been copied from version to version and are finally being replaced (such as my strange, oversized Relaxation Vaults, which can be seen in Portal: Skyline), as well as my half-sized test chamber signs. These signs made sense at the time, and honestly still kinda fit the hub structure of the game&#8230; but they don&#8217;t feel quite right to me. They&#8217;re too efficient &#8211; and Aperture isn&#8217;t efficient in the slightest. There&#8217;s no reason to change something that even Portal 2 didn&#8217;t mess with (besides a font change). Afterwards, I turned my attention to another sign. A single texture that dictated the design style of the rest of the game from that point on.</p>
<p><a href="http://elitetreacle.com/devlog/wp-content/uploads/2015/02/First-Texture.png"><img class="alignnone size-medium wp-image-13" src="http://elitetreacle.com/devlog/wp-content/uploads/2015/02/First-Texture-300x129.png" alt="First Texture" width="300" height="129" /></a></p>
<p>This is the first texture created for Portal: Destination Hostile, way back in 2009. It was tweaked in 2011 to remove some artifacting involving the alpha channel, but otherwise is unchanged since it&#8217;s creation. The rest of the signage followed this theme &#8211; text, with a line underneath, followed by &#8220;APERTURE LABORATORIES&#8221;. Looking at it now, this texture is terrible &#8211; the line is misaligned, as is the text. But even still, it&#8217;s something that I genuinely regret changing. It&#8217;s like an old friend, greeting me every time I open testchmb_dh_01.vmf, and you shouldn&#8217;t get rid of a faithful old friend like that.</p>
<p><a href="http://elitetreacle.com/devlog/wp-content/uploads/2015/02/2015-02-12_00001.jpg"><img class="  wp-image-15 alignnone" src="http://elitetreacle.com/devlog/wp-content/uploads/2015/02/2015-02-12_00001-300x169.jpg" alt="Use in V1" width="249" height="140" /></a> <a href="http://elitetreacle.com/devlog/wp-content/uploads/2015/02/testchmb_dh_010004-watermarked.jpg"><img class="  wp-image-14 alignnone" src="http://elitetreacle.com/devlog/wp-content/uploads/2015/02/testchmb_dh_010004-watermarked-300x225.jpg" alt="Use in V2" width="186" height="140" /> </a><a href="http://elitetreacle.com/devlog/wp-content/uploads/2015/02/2015-02-12_00002.jpg"><img class="alignnone  wp-image-16" src="http://elitetreacle.com/devlog/wp-content/uploads/2015/02/2015-02-12_00002-300x169.jpg" alt="Use in V3" width="248" height="140" /></a></p>
<p>From left to right, these are the three uses of this texture throughout the three distinct versions of the game (that I call V1, V2, and V3, with V3.5 being the current version &#8211; but more on that in another post). Part of me feels like I&#8217;m kicking a puppy or something by removing it. I don&#8217;t feel like that about other parts of the game &#8211; the Portal 2 style refraction lights were easy to replace with the texture lights I use now, and the replacement of dialogue is so common that it&#8217;s par for the course. But this has never changed.</p>
<p>Yes, it&#8217;s something I need to get over. Sentimentality stands between me and the path of progress &#8211; and unlike Mr. Dent I&#8217;ve not quite gone off the idea just yet. So, in memory of decals/hub01_sign.vtf, say hello to his newborn son.</p>
<p><a href="http://elitetreacle.com/devlog/wp-content/uploads/2015/02/Replacement.png"><img class="alignnone size-medium wp-image-12" src="http://elitetreacle.com/devlog/wp-content/uploads/2015/02/Replacement-300x158.png" alt="Replacement" width="300" height="158" /></a></p>
<p>Funny how much better things can be when you finally let go to something, isn&#8217;t it?</p>
<p>Of course, it&#8217;s not being removed entirely. You&#8217;ll still be able to see ol&#8217; hub01_sign.vtf in the bonus chapter <em>&#8220;Camera Obscura&#8221;, </em>which I will talk about another time.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://elitetreacle.com/devlog/sentiment/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
