1998Q1/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: Re: [MUD&#45;Dev] The impact of the web on muds -->
<!--X-From-R13: [vebfyni Evybivp <fvybivpNmrfbv.sre.ue> -->
<!--X-Date: Tue, 27 Jan 1998 12:27:03 +0000 -->
<!--X-Message-Id: 7ehg6qjdtj.fsf#petra,zesoi.fer.hr -->
<!--X-Content-Type: text/plain -->
<!--X-Reference: 9801261513.8rg6@ami&#45;cg.GraySage.Edmonton.AB.CA -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, Re: [MUD-Dev] The impact of the web on muds</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:silovic#zesoi,fer.hr">
</head>
<body background="/backgrounds/paperback.gif" bgcolor="#ffffff"
      text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000">

  <font size="+4" color="#804040">
    <strong><em>MUD-Dev<br>mailing list archive</em></strong>
  </font>
      
<br>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
<br clear=all><hr>
<!--X-Body-Begin-->
<!--X-User-Header-->
<!--X-User-Header-End-->
<!--X-TopPNI-->

Date:&nbsp;
[&nbsp;<a href="msg00328.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00330.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00321.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00330.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00329">Author</A>
&nbsp;|&nbsp;<A HREF="#00329">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00329">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>Re: [MUD-Dev] The impact of the web on muds</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: <A HREF="mailto:mud-dev#null,net">mud-dev#null,net</A></LI>
<LI><em>Subject</em>: Re: [MUD-Dev] The impact of the web on muds</LI>
<LI><em>From</em>: Miroslav Silovic &lt;<A HREF="mailto:silovic#zesoi,fer.hr">silovic#zesoi,fer.hr</A>&gt;</LI>
<LI><em>Date</em>: 27 Jan 1998 13:34:16 +0100</LI>
<LI><em>Cc</em>: <A HREF="mailto:silovic#petra,zesoi.fer.hr">silovic#petra,zesoi.fer.hr</A></LI>
<LI><em>Reply-To</em>: <A HREF="mailto:silovic#srce,hr">silovic#srce,hr</A></LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>
cg#ami-cg,GraySage.Edmonton.AB.CA (Chris Gray) writes:

&gt; :Heh, maybe we should work on optimizing a ray-tracer. :)
&gt; 
&gt; Hasn't that already happened in some games? I'm pretty out of touch in
&gt; the rendering field, but I thought most polygon engines essentially did
&gt; ray-tracing of one ray for each polygon they draw, so as to get the
&gt; proper colour/texture for that polygon.

In fact none of them does raytracing.

Doom engine traces a ray in a 2d grid (basically the walls) to get the
point on the vertical wall, then draws the entire column. So it traces
320 rays per frame.

Depth buffer engines (Mesa is one, I think) don't trace rays at all,
they simply clip and fill the polygons, and interpolate Z coordinate,
then they use array of one cell per pixel to store Z coordinates (so,
they compare the Z coordinate, and it it's closer to the eye than the
latest, they plot the pixel). You can find the code for this in my
raytracer (<A  HREF="ftp://ftp.roguetrader.com/pub/miro/sart">ftp://ftp.roguetrader.com/pub/miro/sart</A>)

Finally, painter algorithm engines draw polygons in a sorted order,
starting from the furthest to the nearest. This is nice because if
you're using nontextured polygons, you can use X server to paint the
polygons with color (otherwise you still need texturing code, because
X server's textures aren't perspectively transformed). The sorting
itself is done using BSP tree structure. BSP is a binary tree with the
following properties:

	1) each node contains a single polygon

	2) left descendants of each node are on the same side of the
	   plane of that polygon. Same goes for the right descendants

You can construct BSP tree like this:

Pick a random polygon. Now split all other polygons into left and
right classes. Some polygons will have to be split by the plane of the
chosen polygon (you can find polygon splitting code in my raytracer,
it's used for clipping in zbuffering code). Now recursively process
left and right subtree if nonempty. The process will terminate because
total number of the splitting planes in the left and right subtree is
lower by one.

To render BSP tree, start with root. Find out which side of the plane
for that node contains the viewpoint. Now first render (recursively)
the subtree on the opposite side of the plane, then draw the polygon
within the node itself, then finally render the near side.

You can reduce the number of subdivided polygons (or perform other
optimizations) by selecting /several/ random polygons, subdivide by
each and see which one is the best. However, constructing absolutely
optimal BSP tree is NP-complete problem.

Rendering complexity is linear in the number of nodes, while
construction complexity is linear on average, quadratic in the worst
case.

There is another sorting algorythm, called Newel, Newel, and Sancha
(if memory serves me), but it's completely obsoleted by BSP trees.

You will find out that while my raytracer uses BSP trees to accelerate
raytracing, it uses completely different kind (and pretty useless for
polygon sorting). Proper raytracing (i.e. one ray per pixel, the way
POV or Radiance or my own raytracer (with zbuffering off) do) is much
too slow for any soft of game graphics except precalculated images or
animations.


As for the texturing, when you're doing realtime animation,
perspective transformation of the texture is generally rather slow
operation (mostly because most CPUs use LARGE number of cycles for
division). The usual answer is to calculate perspective transformation
for every 8-16 pixels and linearly interpolate between them.

Finally, lighting, the way Quake does it, is another issue. You can't
store all the lighting as extra textures because that'd a) kill all
the available memory (since lighting isn't repetitive the way textures
usualy are), and b) would be too big for hardware rendering (as most
cheap rendering cards can store only about 4 MB of textures). Instead,
you can triangulate the scene into sufficiently small triangles
(search through the web for adaptive radiosity algorithms and read
some articles on the topic) and store only the lighting for the
vertices.  Then use bilinear interpolation to get the lighting info on
the rest of the triangle and overlay the result over the textures.

-- 
I refuse to use .sig

</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<!--X-Follow-Ups-End-->
<!--X-References-->
<UL><LI><STRONG>References</STRONG>:
<UL>
<LI><STRONG><A NAME="00321" HREF="msg00321.html">Re: [MUD-Dev] The impact of the web on muds</A></STRONG>
<UL><LI><EM>From:</EM> cg#ami-cg,GraySage.Edmonton.AB.CA (Chris Gray)</LI></UL></LI>
</UL></LI></UL>
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00328.html">Re: [MUD-Dev] 3D graphics (Was: The impact of the web on muds)</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00330.html">Re: [MUD-Dev] The impact of the web on muds</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00321.html">Re: [MUD-Dev] The impact of the web on muds</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00330.html">Re: [MUD-Dev] The impact of the web on muds</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00329"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00329"><STRONG>Thread</STRONG></A></LI>
</UL>
</LI>
</UL>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
<ul><li>Thread context:
<BLOCKQUOTE><UL>
<LI><STRONG>Re: [MUD-Dev] The impact of the web on muds</STRONG>, <EM>(continued)</EM>
<ul compact>
<LI><strong><A NAME="00315" HREF="msg00315.html">Re: [MUD-Dev] The impact of the web on muds</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Sun 25 Jan 1998, 18:55 GMT
<UL>
<LI><strong><A NAME="00317" HREF="msg00317.html">Re: [MUD-Dev] The impact of the web on muds</A></strong>, 
Michael Hohensee <a href="mailto:michael#sparta,mainstream.net">michael#sparta,mainstream.net</a>, Sun 25 Jan 1998, 22:43 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00316" HREF="msg00316.html">Re: [MUD-Dev] The impact of the web on muds</A></strong>, 
Mike Sellers <a href="mailto:mike#online-alchemy,com">mike#online-alchemy,com</a>, Sun 25 Jan 1998, 20:05 GMT
</LI>
<LI><strong><A NAME="00321" HREF="msg00321.html">Re: [MUD-Dev] The impact of the web on muds</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Mon 26 Jan 1998, 15:49 GMT
<UL>
<LI><strong><A NAME="00329" HREF="msg00329.html">Re: [MUD-Dev] The impact of the web on muds</A></strong>, 
Miroslav Silovic <a href="mailto:silovic#zesoi,fer.hr">silovic#zesoi,fer.hr</a>, Tue 27 Jan 1998, 12:27 GMT
</LI>
<LI><strong><A NAME="00330" HREF="msg00330.html">Re: [MUD-Dev] The impact of the web on muds</A></strong>, 
Michael Hohensee <a href="mailto:michael#sparta,mainstream.net">michael#sparta,mainstream.net</a>, Tue 27 Jan 1998, 13:15 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00322" HREF="msg00322.html">Re: [MUD-Dev] The impact of the web on muds</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Mon 26 Jan 1998, 15:49 GMT
</LI>
</ul>
</LI>
<LI><strong><A NAME="00004" HREF="msg00004.html">Re: [MUD-Dev] Re: (no subject)</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Thu 01 Jan 1998, 23:19 GMT
<UL>
<LI><strong><A NAME="00108" HREF="msg00108.html">Re: [MUD-Dev] Re: (no subject)</A></strong>, 
Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Thu 08 Jan 1998, 06:14 GMT
</LI>
</UL>
</LI>
</UL></BLOCKQUOTE>

</ul>
<hr>
<center>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
</center>
<hr>
</body>
</html>