<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.1" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Order your graphics draw calls around!</title>
	<link>http://realtimecollisiondetection.net/blog/?p=86</link>
	<description>Coding wisdom and rants of Christer Ericson</description>
	<pubDate>Fri, 10 Sep 2010 21:57:07 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>

	<item>
		<title>By: christer</title>
		<link>http://realtimecollisiondetection.net/blog/?p=86#comment-3317</link>
		<author>christer</author>
		<pubDate>Tue, 10 Aug 2010 03:35:22 +0000</pubDate>
		<guid>http://realtimecollisiondetection.net/blog/?p=86#comment-3317</guid>
		<description>"Typically we want to sort opaque geometry and normal, additive, and subtractive translucent geometry into separate groups." can be parsed as either

{ opaque } and { normal, additive, and subtractive translucent }

or as

{ opaque }, { normal translucent }, { additive translucent }, and { subtractive translucent }

to be the separate groups. These two alternatives will give different results, obviously.

Visually, the former is seen as correct (as long as you sort the translucent group correctly), but for games in particular we have traditionally compromised on correctness and done the latter, to cut down on state changes (to make rendering faster).

The example above though is just that though: an example. You can adjust the mapping such that you have depth be more significant than translucency if that works better for your application. You can even split it, so there's some depth bits both above and below the translucency type. And that's the beauty of sort-based draw call ordering!</description>
		<content:encoded><![CDATA[<p>&#8220;Typically we want to sort opaque geometry and normal, additive, and subtractive translucent geometry into separate groups.&#8221; can be parsed as either</p>
<p>{ opaque } and { normal, additive, and subtractive translucent }</p>
<p>or as</p>
<p>{ opaque }, { normal translucent }, { additive translucent }, and { subtractive translucent }</p>
<p>to be the separate groups. These two alternatives will give different results, obviously.</p>
<p>Visually, the former is seen as correct (as long as you sort the translucent group correctly), but for games in particular we have traditionally compromised on correctness and done the latter, to cut down on state changes (to make rendering faster).</p>
<p>The example above though is just that though: an example. You can adjust the mapping such that you have depth be more significant than translucency if that works better for your application. You can even split it, so there&#8217;s some depth bits both above and below the translucency type. And that&#8217;s the beauty of sort-based draw call ordering!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lesni.bleble</title>
		<link>http://realtimecollisiondetection.net/blog/?p=86#comment-3316</link>
		<author>lesni.bleble</author>
		<pubDate>Mon, 09 Aug 2010 21:38:02 +0000</pubDate>
		<guid>http://realtimecollisiondetection.net/blog/?p=86#comment-3316</guid>
		<description>If I understood: all opaque objects are rendered at first, then all(!) objects with normal translucency (sorted back-to-front) and then all objects with add translucency (back-to-front too), because translucency is at more significant bits then depth?  Is blending still correct in final composition?</description>
		<content:encoded><![CDATA[<p>If I understood: all opaque objects are rendered at first, then all(!) objects with normal translucency (sorted back-to-front) and then all objects with add translucency (back-to-front too), because translucency is at more significant bits then depth?  Is blending still correct in final composition?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bakura</title>
		<link>http://realtimecollisiondetection.net/blog/?p=86#comment-3003</link>
		<author>bakura</author>
		<pubDate>Sun, 27 Sep 2009 14:59:50 +0000</pubDate>
		<guid>http://realtimecollisiondetection.net/blog/?p=86#comment-3003</guid>
		<description>I really like the idea. From what I understand, it allows to completely deffers the rendering at the end of the frame. For instance, iterating over all the passes but no directly make draw calls but only create render and state commands, and store them into a render queue. Then, when the iteration of the render passes is over, we can sort the commands of the render queue and call each commands. I've thought of adding a render pass parameter in the key, so that inter-dependance between passes is also handled. And when all the commands are iterated, we can now prepare the next frame by generating new commands. Sounds good.

I'm gonna take an example, please correct me if I'm wrong. You want to generate one shadow map per each light. You could create some commands that update the current light matrix, then render commands for the whole geometry, then another command that would update the light matrix,and again render commands... (but a lot of render commands would be duplicated :(.

However I have many problems still to solve (how to correctly update uniform variables...) but does it sound like a good idea ? Or generating many render and state commands like this sound too complicated ?</description>
		<content:encoded><![CDATA[<p>I really like the idea. From what I understand, it allows to completely deffers the rendering at the end of the frame. For instance, iterating over all the passes but no directly make draw calls but only create render and state commands, and store them into a render queue. Then, when the iteration of the render passes is over, we can sort the commands of the render queue and call each commands. I&#8217;ve thought of adding a render pass parameter in the key, so that inter-dependance between passes is also handled. And when all the commands are iterated, we can now prepare the next frame by generating new commands. Sounds good.</p>
<p>I&#8217;m gonna take an example, please correct me if I&#8217;m wrong. You want to generate one shadow map per each light. You could create some commands that update the current light matrix, then render commands for the whole geometry, then another command that would update the light matrix,and again render commands&#8230; (but a lot of render commands would be duplicated :(.</p>
<p>However I have many problems still to solve (how to correctly update uniform variables&#8230;) but does it sound like a good idea ? Or generating many render and state commands like this sound too complicated ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Threaded Renderer &#171; luminance</title>
		<link>http://realtimecollisiondetection.net/blog/?p=86#comment-2979</link>
		<author>Threaded Renderer &#171; luminance</author>
		<pubDate>Tue, 25 Aug 2009 07:54:00 +0000</pubDate>
		<guid>http://realtimecollisiondetection.net/blog/?p=86#comment-2979</guid>
		<description>[...] basic approach is primarily inspired by Christer Ericson&#8217;s post about the approach he uses for ordering draw calls. Some other useful sources of information were Tom Forsyth&#8217;s post about the cost of [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] basic approach is primarily inspired by Christer Ericson&#8217;s post about the approach he uses for ordering draw calls. Some other useful sources of information were Tom Forsyth&#8217;s post about the cost of [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: christer</title>
		<link>http://realtimecollisiondetection.net/blog/?p=86#comment-2922</link>
		<author>christer</author>
		<pubDate>Sat, 18 Jul 2009 18:42:15 +0000</pubDate>
		<guid>http://realtimecollisiondetection.net/blog/?p=86#comment-2922</guid>
		<description>Dietepiet, read again; we &lt;b&gt;did&lt;/b&gt; sort on the PS2, only we used bucket sorting. It is within the buckets we didn't sort on the PS2. Not sorting within buckets was not a big deal on the PS2.

I doubt very much that there are any benefits to do incremental sorting. First, the code would become much more complex, which makes it hard to maintain and increases the likelihood for bugs. Second, the sorting just isn't a bottleneck so why spend time on a more complicated solution if you don't have to.</description>
		<content:encoded><![CDATA[<p>Dietepiet, read again; we <b>did</b> sort on the PS2, only we used bucket sorting. It is within the buckets we didn&#8217;t sort on the PS2. Not sorting within buckets was not a big deal on the PS2.</p>
<p>I doubt very much that there are any benefits to do incremental sorting. First, the code would become much more complex, which makes it hard to maintain and increases the likelihood for bugs. Second, the sorting just isn&#8217;t a bottleneck so why spend time on a more complicated solution if you don&#8217;t have to.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dietepiet</title>
		<link>http://realtimecollisiondetection.net/blog/?p=86#comment-2920</link>
		<author>Dietepiet</author>
		<pubDate>Sat, 18 Jul 2009 08:58:35 +0000</pubDate>
		<guid>http://realtimecollisiondetection.net/blog/?p=86#comment-2920</guid>
		<description>Hi,

You said that on a PS2 you did no sorting at all while on the PS3 you did full sorting. Now I was wondering, if instead of re-inserting each render call each frame I only inserting them when they become visible and removing them when they become invisible. Then, each frame, the render queue will be pretty much the same as last frame. So instead of a full quick sort, I may use a very simple sort and only perform a few iterations to keep the queue more or less sorted.
Of course this is harder as you have to keep track of all render calls over multiple frames. Do you think this gives a significant saving on a current PC?</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>You said that on a PS2 you did no sorting at all while on the PS3 you did full sorting. Now I was wondering, if instead of re-inserting each render call each frame I only inserting them when they become visible and removing them when they become invisible. Then, each frame, the render queue will be pretty much the same as last frame. So instead of a full quick sort, I may use a very simple sort and only perform a few iterations to keep the queue more or less sorted.<br />
Of course this is harder as you have to keep track of all render calls over multiple frames. Do you think this gives a significant saving on a current PC?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: christer</title>
		<link>http://realtimecollisiondetection.net/blog/?p=86#comment-2791</link>
		<author>christer</author>
		<pubDate>Tue, 16 Jun 2009 04:04:39 +0000</pubDate>
		<guid>http://realtimecollisiondetection.net/blog/?p=86#comment-2791</guid>
		<description>slaaitjuh, hardware instancing (or any other case where you need to effectively invalidate depth sorting, when depth is part of the sort key) is handled by assigning those draw calls a "unique depth". Whether this is actually a unique depth in the depth field or done by inserting a separate bit above the depth field to turn the depth field into a "unique identifier" field, or some such, that's up to you.

For your second question, recall I said "array of (key, value) pairs". The value is a pointer to your draw call or similar where you have the material/state information available. Shader parameter changes you keep track of by doing a "diff" of the material/state information as you go from one array entry to the next.</description>
		<content:encoded><![CDATA[<p>slaaitjuh, hardware instancing (or any other case where you need to effectively invalidate depth sorting, when depth is part of the sort key) is handled by assigning those draw calls a &#8220;unique depth&#8221;. Whether this is actually a unique depth in the depth field or done by inserting a separate bit above the depth field to turn the depth field into a &#8220;unique identifier&#8221; field, or some such, that&#8217;s up to you.</p>
<p>For your second question, recall I said &#8220;array of (key, value) pairs&#8221;. The value is a pointer to your draw call or similar where you have the material/state information available. Shader parameter changes you keep track of by doing a &#8220;diff&#8221; of the material/state information as you go from one array entry to the next.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: slaaitjuh</title>
		<link>http://realtimecollisiondetection.net/blog/?p=86#comment-2790</link>
		<author>slaaitjuh</author>
		<pubDate>Mon, 15 Jun 2009 16:29:09 +0000</pubDate>
		<guid>http://realtimecollisiondetection.net/blog/?p=86#comment-2790</guid>
		<description>Oh, and second question, how do you deal with shader parameter changes? For example, if you have a shared view / projection matrix and you want to render shadow maps (different view / project) or some security camera...

how do you trackback the material parameters?</description>
		<content:encoded><![CDATA[<p>Oh, and second question, how do you deal with shader parameter changes? For example, if you have a shared view / projection matrix and you want to render shadow maps (different view / project) or some security camera&#8230;</p>
<p>how do you trackback the material parameters?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: slaaitjuh</title>
		<link>http://realtimecollisiondetection.net/blog/?p=86#comment-2789</link>
		<author>slaaitjuh</author>
		<pubDate>Mon, 15 Jun 2009 15:10:55 +0000</pubDate>
		<guid>http://realtimecollisiondetection.net/blog/?p=86#comment-2789</guid>
		<description>Hi,

I was just wondering how you would imagining something like Hardware Instancing in this system, since you are not dealing with depth anymore at that point... (well you are, but instances are not per definition in the same depth area)

nice article btw, looking into it. Looking at implementing it for XNA!</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I was just wondering how you would imagining something like Hardware Instancing in this system, since you are not dealing with depth anymore at that point&#8230; (well you are, but instances are not per definition in the same depth area)</p>
<p>nice article btw, looking into it. Looking at implementing it for XNA!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kenpex</title>
		<link>http://realtimecollisiondetection.net/blog/?p=86#comment-2540</link>
		<author>kenpex</author>
		<pubDate>Fri, 05 Dec 2008 07:29:01 +0000</pubDate>
		<guid>http://realtimecollisiondetection.net/blog/?p=86#comment-2540</guid>
		<description>As you know that's also the way Lost Planet renders things: http://meshula.net/wordpress/?p=112</description>
		<content:encoded><![CDATA[<p>As you know that&#8217;s also the way Lost Planet renders things: <a href="http://meshula.net/wordpress/?p=112" rel="nofollow">http://meshula.net/wordpress/?p=112</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>
