force use of pandoc version >= 3.1.12.2
The `bin/pandoc-wrapper.sh` tool will verify that the ssytem has a recent enough version of `pandoc(1)`. We explain why we insist on `pandoc(1)`. version >= 3.1.12.2 in comments where the $PANDOC_MIN_VERSION is set. Added `--wrap=preserve` as a default argument to `pandoc(1)`. While this change will impact every HTML file generated, we believe this will improve the ability of someone to look at the generated HTML and correlate with the original markdown. Changed `bin/pandoc-wrapper.sh` VERSION from "1.4.2 2024-03-17" to "1.4.3 2024-03-18". Performed `make www` to achieve all of the above and to generate HTML using the new `--wrap=preserve` `pandoc(1)` mode.
This commit is contained in:
1 parent
9eb7a54e9f
commit
b0b212acb1
402 files changed
+37061
-55132
No files matched your search
+166
-236
@@ -130,8 +130,8 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Qiming_HOU">Qiming HOU</a><br>
|
||||
Location: <a href="../../location.html#CN">CN</a> - <em>People’s
|
||||
Republic of China</em> (<em>China</em>) <br><br></li>
|
||||
Location: <a href="../../location.html#CN">CN</a> - <em>People’s Republic of China</em> (<em>China</em>)
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -144,166 +144,138 @@ Republic of China</em> (<em>China</em>) <br><br></li>
|
||||
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
|
||||
<p>The current status of this entry is:</p>
|
||||
<pre><code>STATUS: INABIAF - please **DO NOT** fix</code></pre>
|
||||
<p>For more detailed information see <a
|
||||
href="../../bugs.html#2013_hou">2013 hou bugs</a>.</p>
|
||||
<p>For more detailed information see <a href="../../bugs.html#2013_hou">2013 hou bugs</a>.</p>
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./hou</span> <span class="pp">[</span><span class="ss">scene</span><span class="pp">-</span><span class="ss">file</span><span class="pp">-</span><span class="ss">name</span><span class="pp">]</span> <span class="pp">[</span><span class="ss">options</span><span class="pp">]</span></span></code></pre></div>
|
||||
<p>Follow the instructions in <code>stdout</code>, preferably with an
|
||||
auto-refreshing PPM image viewer ready. Refresh the image every time the
|
||||
output refreshes, all effects should be more or less recognizable when
|
||||
you see 16.</p>
|
||||
<p>Follow the instructions in <code>stdout</code>, preferably with an auto-refreshing PPM
|
||||
image viewer ready. Refresh the image every time the output refreshes, all
|
||||
effects should be more or less recognizable when you see 16.</p>
|
||||
<h2 id="try">Try:</h2>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span></code></pre></div>
|
||||
<p>Try opening the file noted by the program then let the program run a
|
||||
while and every so often reopen the file, to see how it changes. The
|
||||
author suggests that you leave the program running overnight to see what
|
||||
happens. If however you do not have all night :-) then the following
|
||||
JPEG files should show you what happens with some of the invocations
|
||||
above:</p>
|
||||
<p>Try opening the file noted by the program then let the program run a while and
|
||||
every so often reopen the file, to see how it changes. The author suggests that
|
||||
you leave the program running overnight to see what happens. If however you do
|
||||
not have all night :-) then the following JPEG files should show you what
|
||||
happens with some of the invocations above:</p>
|
||||
<figure>
|
||||
<img src="luna.jpg" alt="./hou BIG - Luna" />
|
||||
<figcaption aria-hidden="true">./hou BIG - Luna</figcaption>
|
||||
</figure>
|
||||
<figure>
|
||||
<img src="old_default.jpg"
|
||||
alt="./hou old_default.scene - Old default" />
|
||||
<figcaption aria-hidden="true">./hou old_default.scene - Old
|
||||
default</figcaption>
|
||||
<img src="old_default.jpg" alt="./hou old_default.scene - Old default" />
|
||||
<figcaption aria-hidden="true">./hou old_default.scene - Old default</figcaption>
|
||||
</figure>
|
||||
<figure>
|
||||
<img src="otherroom.jpg" alt="./hou otherroom.scene - Other room" />
|
||||
<figcaption aria-hidden="true">./hou otherroom.scene - Other
|
||||
room</figcaption>
|
||||
<figcaption aria-hidden="true">./hou otherroom.scene - Other room</figcaption>
|
||||
</figure>
|
||||
<p>This program does not terminate by itself: you must kill
|
||||
<code>hou</code> (but not Qiming Hou :-) ) in order to end the
|
||||
program.</p>
|
||||
<p>This program does not terminate by itself: you must kill <code>hou</code> (but not Qiming
|
||||
Hou :-) ) in order to end the program.</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>You could consider that this program violates the source code size
|
||||
limit. This is because the first compilation of this program is really
|
||||
just a decompressor to generate the real source code of the program.</p>
|
||||
<p>This program will loop infinitely while progressively refining a <a
|
||||
href="https://en.wikipedia.org/wiki/Ray_tracing_(graphics)">raytraced</a>
|
||||
image.</p>
|
||||
<p>NOTE: the author refers to <a href="a.c">a.c</a>, placed in a gzipped
|
||||
file <code>a.c.gz</code>. We do not include it but it can be generated
|
||||
like:</p>
|
||||
limit. This is because the first compilation of this program is
|
||||
really just a decompressor to generate the real source code of the
|
||||
program.</p>
|
||||
<p>This program will loop infinitely while progressively refining a
|
||||
<a href="https://en.wikipedia.org/wiki/Ray_tracing_(graphics)">raytraced</a> image.</p>
|
||||
<p>NOTE: the author refers to <a href="a.c">a.c</a>, placed in a gzipped file <code>a.c.gz</code>. We do not
|
||||
include it but it can be generated like:</p>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">cc</span> <span class="at">-Wall</span> hou.c <span class="at">-o</span> hou <span class="at">-lm</span></span>
|
||||
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./hou</span> <span class="op">></span> a.c</span></code></pre></div>
|
||||
<p>but there is no need to do this as the Makefile takes care of it
|
||||
without even needing to create a temporary file.</p>
|
||||
<p>but there is no need to do this as the Makefile takes care of it without even
|
||||
needing to create a temporary file.</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<h3 id="using-hou">Using hou</h3>
|
||||
<p>This program is a programmable rendering engine with a built-in
|
||||
default scene. The standard command line is:</p>
|
||||
<p>This program is a programmable rendering engine with a built-in default scene.
|
||||
The standard command line is:</p>
|
||||
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./hou</span> <span class="pp">[</span><span class="ss">scene</span><span class="pp">-</span><span class="ss">file</span><span class="pp">-</span><span class="ss">name</span><span class="pp">]</span> <span class="pp">[</span><span class="ss">options</span><span class="pp">]</span></span></code></pre></div>
|
||||
<p>As <code>hou</code> runs, it writes a progressively refining image to
|
||||
a ppm file specified in the scene. The initialization may take a while,
|
||||
but once it’s done, a rough preview should be available in seconds.
|
||||
Leave <code>hou</code> running for the night, and you get a high quality
|
||||
result like the attached <code>*.jpg</code> files. Kill <code>hou</code>
|
||||
manually after you’re satisfied with the image quality.</p>
|
||||
<p>To save time and energy for the judges, rendered images for all
|
||||
provided scenes are provided as attached files.</p>
|
||||
<p>As <code>hou</code> runs, it writes a progressively refining image to a ppm file specified
|
||||
in the scene. The initialization may take a while, but once it’s done, a rough
|
||||
preview should be available in seconds. Leave <code>hou</code> running for the night, and you
|
||||
get a high quality result like the attached <code>*.jpg</code> files. Kill <code>hou</code> manually
|
||||
after you’re satisfied with the image quality.</p>
|
||||
<p>To save time and energy for the judges, rendered images for all provided scenes
|
||||
are provided as attached files.</p>
|
||||
<h3 id="features">Features</h3>
|
||||
<ul>
|
||||
<li>Fully programmable: Almost every stage of the renderer is
|
||||
programmable with a shader, i.e., a short script that does something
|
||||
rendering-related. In particular, each scene consists of one or more
|
||||
geometry shaders, a camera shader, and one or more material shaders.
|
||||
Shaders are written in an interpreted language that supports basic
|
||||
arithmetic, a few math functions, variables and procedural calls in the
|
||||
CPS (Continuation Passing Style).</li>
|
||||
<li>Fast preview: This renderer isn’t just a naive path tracer, it
|
||||
actually uses a modern global illumination algorithm which is robust
|
||||
against challenging scene configurations. You can mostly place light
|
||||
sources and specify surface properties as you please without worrying
|
||||
too much about the convergence speed; you always get a nice fast preview
|
||||
within one or two minutes. As proof, there is a comparison:
|
||||
<code>./hou otherroom.scene</code> gives a rough idea about the overall
|
||||
illumination at 16 samples per pixel (i.e., when the program prints 16),
|
||||
whereas the naive approach <code>./hou otherroom.scene NAIVE</code> only
|
||||
produces a mess of white dots.</li>
|
||||
<li>Rich visual effects: The algorithm samples all light path types so
|
||||
most physically based effects can be produced. The default scene
|
||||
demonstrates quite a few of them: reflection, area light, soft shadows,
|
||||
color bleeding, caustics, and depth-of-field blur. Of course, one can
|
||||
also get programmable-shading effects like procedural texturing and
|
||||
approximated Fresnel terms.</li>
|
||||
<li>Accelerated ray tracing: The ray tracing part uses an algorithm
|
||||
better than the brute-force intersection of everything. The renderer
|
||||
even builds an acceleration data structure! Despite the double precision
|
||||
and the single-threadedness, it still runs at about 0.5 million rays per
|
||||
second on the author’s machine.</li>
|
||||
<li>Pause and resume: Can’t run <code>./hou</code> overnight? No
|
||||
problem! You can kill and resume a rendering session whenever you want.
|
||||
The renderer automatically saves the progress every 16 samples and
|
||||
resumes where it’s left off when restarted. Also, each scene/parameter
|
||||
combination gets a different saved session so you don’t have to worry
|
||||
about conflicts.</li>
|
||||
<li>Fully programmable: Almost every stage of the renderer is programmable with
|
||||
a shader, i.e., a short script that does something rendering-related. In
|
||||
particular, each scene consists of one or more geometry shaders, a camera
|
||||
shader, and one or more material shaders. Shaders are written in an
|
||||
interpreted language that supports basic arithmetic, a few math functions,
|
||||
variables and procedural calls in the CPS (Continuation Passing Style).</li>
|
||||
<li>Fast preview: This renderer isn’t just a naive path tracer, it actually uses a
|
||||
modern global illumination algorithm which is robust against challenging scene
|
||||
configurations. You can mostly place light sources and specify surface
|
||||
properties as you please without worrying too much about the convergence speed;
|
||||
you always get a nice fast preview within one or two minutes. As proof, there
|
||||
is a comparison: <code>./hou otherroom.scene</code> gives a rough idea about the overall
|
||||
illumination at 16 samples per pixel (i.e., when the program prints 16), whereas
|
||||
the naive approach <code>./hou otherroom.scene NAIVE</code> only produces a mess of white
|
||||
dots.</li>
|
||||
<li>Rich visual effects: The algorithm samples all light path types so most
|
||||
physically based effects can be produced. The default scene demonstrates quite a
|
||||
few of them: reflection, area light, soft shadows, color bleeding, caustics, and
|
||||
depth-of-field blur. Of course, one can also get programmable-shading effects
|
||||
like procedural texturing and approximated Fresnel terms.</li>
|
||||
<li>Accelerated ray tracing: The ray tracing part uses an algorithm better than
|
||||
the brute-force intersection of everything. The renderer even builds an
|
||||
acceleration data structure! Despite the double precision and the
|
||||
single-threadedness, it still runs at about 0.5 million rays per second on the
|
||||
author’s machine.</li>
|
||||
<li>Pause and resume: Can’t run <code>./hou</code> overnight? No problem! You can kill and
|
||||
resume a rendering session whenever you want. The renderer automatically saves
|
||||
the progress every 16 samples and resumes where it’s left off when restarted.
|
||||
Also, each scene/parameter combination gets a different saved session so you
|
||||
don’t have to worry about conflicts.</li>
|
||||
</ul>
|
||||
<h3 id="abuse-of-the-rules">Abuse of the rules</h3>
|
||||
<ul>
|
||||
<li><a href="hou.c">hou.c</a> uses compression to get around the size
|
||||
limit. The compression fully complies with the rules and the guidelines
|
||||
(at least the portion that shows up in <code>grep</code> “size limit”).
|
||||
Please see the <a href="self-imposed-restrictions">Self-imposed
|
||||
<li><a href="hou.c">hou.c</a> uses compression to get around the size limit. The compression
|
||||
fully complies with the rules and the guidelines (at least the portion that
|
||||
shows up in <code>grep</code> “size limit”). Please see the <a href="self-imposed-restrictions">Self-imposed
|
||||
restrictions</a> section below for more details.</li>
|
||||
<li><code>hou</code> does not terminate (as suggested by the second line
|
||||
of rule 6).</li>
|
||||
<li><code>hou</code> does not terminate (as suggested by the second line of rule 6).</li>
|
||||
</ul>
|
||||
<h3 id="self-imposed-restrictions">Self-imposed restrictions</h3>
|
||||
<ul>
|
||||
<li>The building process does not involve any OS tool beyond
|
||||
<code>cc(1)</code> and <code>make(1)</code>. No <code>gzip(1)</code>
|
||||
compression! <code>a.c.gz</code> doesn’t fit in 2053 bytes, anyway.</li>
|
||||
<li>Neither <a href="hou.c">hou.c</a> nor <a href="a.c">a.c</a> (the
|
||||
<em>real</em> decompressed source) uses <code>#define</code> (or
|
||||
<code>cc -D</code>) at all.</li>
|
||||
<li>The building process does not involve any OS tool beyond <code>cc(1)</code> and
|
||||
<code>make(1)</code>. No <code>gzip(1)</code> compression! <code>a.c.gz</code> doesn’t fit in 2053 bytes, anyway.</li>
|
||||
<li>Neither <a href="hou.c">hou.c</a> nor <a href="a.c">a.c</a> (the <em>real</em> decompressed source) uses
|
||||
<code>#define</code> (or <code>cc -D</code>) at all.</li>
|
||||
<li>The source code is not required at runtime.</li>
|
||||
<li><a href="a.c">a.c</a> does not drop optional features to reduce
|
||||
size. There are pure optimization code that can be dropped without
|
||||
affecting the converged output (only affecting the ray tracing speed /
|
||||
convergence rate). All files are properly <code>fopen()</code>ed with
|
||||
<code>"rb"</code> / <code>"wb"</code> for Windows compatibility. The PPM
|
||||
header has a comment line for non-standard-compliant viewers
|
||||
(specifically, my old HDRShop 1.0). And there is a nice text message
|
||||
saying “please wait…”. Despite the messy look, <a href="a.c">a.c</a> and
|
||||
<a href="hou.c">hou.c</a> compile warning-free (<a
|
||||
href="hou.c">hou.c</a> even wastes 18 bytes on
|
||||
<code>#include<stdio.h></code> just for <code>putchar(3)</code>).
|
||||
<a href="a.c">a.c</a> compiles mostly clean in the C99/ANSI modes of
|
||||
clang and gcc (with <code>-Wall --pedantic</code>). The only warning
|
||||
generated is a pedantic one:
|
||||
<code>"string constant too long"</code>.</li>
|
||||
<li><a href="a.c">a.c</a> does not drop optional features to reduce size. There are pure
|
||||
optimization code that can be dropped without affecting the converged output
|
||||
(only affecting the ray tracing speed / convergence rate). All files are
|
||||
properly <code>fopen()</code>ed with <code>"rb"</code> / <code>"wb"</code> for Windows compatibility. The PPM
|
||||
header has a comment line for non-standard-compliant viewers (specifically, my
|
||||
old HDRShop 1.0). And there is a nice text message saying “please wait…”.
|
||||
Despite the messy look, <a href="a.c">a.c</a> and <a href="hou.c">hou.c</a> compile warning-free
|
||||
(<a href="hou.c">hou.c</a> even wastes 18 bytes on <code>#include<stdio.h></code> just for <code>putchar(3)</code>).
|
||||
<a href="a.c">a.c</a> compiles mostly clean in the C99/ANSI modes of clang and gcc (with <code>-Wall --pedantic</code>). The only warning generated is a pedantic one: <code>"string constant too long"</code>.</li>
|
||||
</ul>
|
||||
<h3 id="comments-and-why-obfuscated">Comments and why obfuscated</h3>
|
||||
<ul>
|
||||
<li>Both the compression and the rendering use mathematically involved
|
||||
algorithms. Understanding the C doesn’t help much if one isn’t familiar
|
||||
with the math.</li>
|
||||
<li>Modern renderers provide shader access to just about any internal
|
||||
state. This one follows suit and reuses the same shader-accessible array
|
||||
for all important internal states.</li>
|
||||
<li>Infinity and NaN (not-a-number) are used during normal course of
|
||||
execution.</li>
|
||||
<li>Previous image-generating entries may take care to hide the “IOCCC”
|
||||
string in the code, but they leave the text clear in the
|
||||
<em>result</em>. This entry takes it further and obfuscates the output
|
||||
image as well. Can you find the text in the image? Hint: look up.</li>
|
||||
<li><a href="a.c">a.c</a> leaves all shaders in plain text, but the
|
||||
plain text shader code can’t be taken for its face value; the arithmetic
|
||||
rules subtly diverge from our common sense.</li>
|
||||
<li><a href="a.c">a.c</a> is less portable than <a
|
||||
href="hou.c">hou.c</a> itself. <a href="hou.c">hou.c</a> only depends on
|
||||
ASCII and should run just fine on 16-bit, small memory, or
|
||||
floating-point-incapable machines. <a href="a.c">a.c</a>, while still
|
||||
reasonably portable, is quite memory consuming, requires
|
||||
IEEE754-compliant <code>double</code>, and assumes <code>int</code> to
|
||||
be 32-bits.</li>
|
||||
<li>Though technically endian-dependent, <a href="a.c">a.c</a> remains
|
||||
portable providing that one doesn’t copy saved sessions across different
|
||||
endianness.</li>
|
||||
<li>Both the compression and the rendering use mathematically involved algorithms.
|
||||
Understanding the C doesn’t help much if one isn’t familiar with the math.</li>
|
||||
<li>Modern renderers provide shader access to just about any internal state. This
|
||||
one follows suit and reuses the same shader-accessible array for all important
|
||||
internal states.</li>
|
||||
<li>Infinity and NaN (not-a-number) are used during normal course of execution.</li>
|
||||
<li>Previous image-generating entries may take care to hide the “IOCCC” string in
|
||||
the code, but they leave the text clear in the <em>result</em>. This entry takes it
|
||||
further and obfuscates the output image as well. Can you find the text in the
|
||||
image? Hint: look up.</li>
|
||||
<li><a href="a.c">a.c</a> leaves all shaders in plain text, but the plain text shader code can’t
|
||||
be taken for its face value; the arithmetic rules subtly diverge from our common
|
||||
sense.</li>
|
||||
<li><a href="a.c">a.c</a> is less portable than <a href="hou.c">hou.c</a> itself. <a href="hou.c">hou.c</a> only depends
|
||||
on ASCII and should run just fine on 16-bit, small memory, or
|
||||
floating-point-incapable machines. <a href="a.c">a.c</a>, while still reasonably portable, is
|
||||
quite memory consuming, requires IEEE754-compliant <code>double</code>, and assumes <code>int</code> to be
|
||||
32-bits.</li>
|
||||
<li>Though technically endian-dependent, <a href="a.c">a.c</a> remains portable providing that one
|
||||
doesn’t copy saved sessions across different endianness.</li>
|
||||
</ul>
|
||||
<h3 id="spoiler">Spoiler</h3>
|
||||
<pre><code> 3225 3225 3225 9 9 3225 3225
|
||||
@@ -311,132 +283,90 @@ endianness.</li>
|
||||
4225 1226 1 1 1 1 1222 1226
|
||||
1 1 1 1 1 1 1 1 1
|
||||
4226 1 4226 8 4222 4226 1 1</code></pre>
|
||||
<p>The program consists of a recursive-descent interpreter, a
|
||||
<code>3DDDA</code> (3D Discrete Differential Analysis) ray tracer, a
|
||||
<code>PSSMLT</code> (Primary Sample Space Metropolis Light Transport)
|
||||
light path sampler, all squeezed into the size limit using a
|
||||
<code>PPM</code> compressor (Prediction by Partial Matching, and yes,
|
||||
the output format is chosen for the pun..).</p>
|
||||
<p><code>PSSMLT</code> uses the Metropolis-Hasting algorithm to sample a
|
||||
32D unit hypercube. Each point in the hypercube is interpreted as a
|
||||
sequence of random numbers, and is sent to a path tracer to generate a
|
||||
light path. The point’s Metropolis-Hasting energy is then defined as the
|
||||
corresponding path’s contribution value to the final image. Since each
|
||||
path is sampled with a probability proportional to its energy, the
|
||||
sample distribution directly corresponds to the final image, which can
|
||||
then be produced as a simple per-pixel histogram of all generated paths.
|
||||
The robustness comes from a state mutation strategy that actively tries
|
||||
to explore the neighborhood of high energy peaks (e.g. paths that happen
|
||||
to hit the light source in <a
|
||||
href="otherroom.scene">otherroom.scene</a>). In addition, a rudimentary
|
||||
form of lens path stratification is added to balance the attention each
|
||||
pixel receives. The Metropolis-Hasting process completely avoids the
|
||||
tell-tale pixel sampling loop required in most other image generation
|
||||
methods.</p>
|
||||
<p>The <code>3DDDA</code> tracer is chosen for scalability: its
|
||||
performance doesn’t get much worse as scene complexity increases.
|
||||
Another benefit is that with the <code>DDA</code> code in place one can
|
||||
naturally use hierarchical grids as an acceleration structure. The
|
||||
downside, of course, is that the setup involves quite a few divisions,
|
||||
which naturally turns into divisions-by-zero. Fortunately, the IEEE754
|
||||
standard has a nice set of rules just for this purpose and the
|
||||
arithmetics are organized in a specific way to take advantage of this.
|
||||
The shader interpreter component is relatively straightforward, just an
|
||||
expression evaluator stripped to the bare minimum – it doesn’t even
|
||||
support numerical constants natively. A final little bit is a
|
||||
just-good-enough PRNG (Pseudo Random Number Generator) to replace the
|
||||
low precision Windows <code>rand()</code> and the non-C99 Unix
|
||||
<code>drand48(3)</code>. An overnight session would run through its
|
||||
short period many times, but that doesn’t necessarily map to the same
|
||||
set of paths in <code>PSSMLT</code>. After all, Metropolis-Hasting used
|
||||
an even worse PRNG in their 1953 paper.</p>
|
||||
<p>The <code>PPM</code> compressor uses statically weighted fixed order
|
||||
contexts with an arithmetic encoder tweaked for <a
|
||||
href="../iocccsize.c">iocccsize.c</a>. The encoder emits octet-space
|
||||
pairs where each octet encodes ~6.5 bits of information and each space
|
||||
encodes 2 bits (thanks to the generous definition of “space” in <a
|
||||
href="../iocccsize.c">iocccsize.c</a>). The compressor actively shuffles
|
||||
the variable names around until the compressed string happens to contain
|
||||
enough <code>{};</code>s to pass the final <a
|
||||
href="../iocccsize.c">iocccsize.c</a> test. There are a few other
|
||||
tweaks:</p>
|
||||
<p>The program consists of a recursive-descent interpreter, a <code>3DDDA</code> (3D Discrete
|
||||
Differential Analysis) ray tracer, a <code>PSSMLT</code> (Primary Sample Space Metropolis
|
||||
Light Transport) light path sampler, all squeezed into the size limit using a
|
||||
<code>PPM</code> compressor (Prediction by Partial Matching, and yes, the output format is
|
||||
chosen for the pun..).</p>
|
||||
<p><code>PSSMLT</code> uses the Metropolis-Hasting algorithm to sample a 32D unit hypercube.
|
||||
Each point in the hypercube is interpreted as a sequence of random numbers, and
|
||||
is sent to a path tracer to generate a light path. The point’s
|
||||
Metropolis-Hasting energy is then defined as the corresponding path’s
|
||||
contribution value to the final image. Since each path is sampled with a
|
||||
probability proportional to its energy, the sample distribution directly
|
||||
corresponds to the final image, which can then be produced as a simple per-pixel
|
||||
histogram of all generated paths. The robustness comes from a state mutation
|
||||
strategy that actively tries to explore the neighborhood of high energy peaks
|
||||
(e.g. paths that happen to hit the light source in
|
||||
<a href="otherroom.scene">otherroom.scene</a>). In addition, a rudimentary form of lens
|
||||
path stratification is added to balance the attention each pixel receives. The
|
||||
Metropolis-Hasting process completely avoids the tell-tale pixel sampling loop
|
||||
required in most other image generation methods.</p>
|
||||
<p>The <code>3DDDA</code> tracer is chosen for scalability: its performance doesn’t get much
|
||||
worse as scene complexity increases. Another benefit is that with the <code>DDA</code> code
|
||||
in place one can naturally use hierarchical grids as an acceleration structure.
|
||||
The downside, of course, is that the setup involves quite a few divisions, which
|
||||
naturally turns into divisions-by-zero. Fortunately, the IEEE754 standard has a
|
||||
nice set of rules just for this purpose and the arithmetics are organized in a
|
||||
specific way to take advantage of this. The shader interpreter component is
|
||||
relatively straightforward, just an expression evaluator stripped to the bare
|
||||
minimum – it doesn’t even support numerical constants natively. A final little
|
||||
bit is a just-good-enough PRNG (Pseudo Random Number Generator) to replace the
|
||||
low precision Windows <code>rand()</code> and the non-C99 Unix <code>drand48(3)</code>. An overnight
|
||||
session would run through its short period many times, but that doesn’t
|
||||
necessarily map to the same set of paths in <code>PSSMLT</code>. After all,
|
||||
Metropolis-Hasting used an even worse PRNG in their 1953 paper.</p>
|
||||
<p>The <code>PPM</code> compressor uses statically weighted fixed order contexts with an
|
||||
arithmetic encoder tweaked for <a href="../iocccsize.c">iocccsize.c</a>. The encoder emits octet-space pairs
|
||||
where each octet encodes ~6.5 bits of information and each space encodes 2 bits
|
||||
(thanks to the generous definition of “space” in <a href="../iocccsize.c">iocccsize.c</a>). The compressor
|
||||
actively shuffles the variable names around until the compressed string happens
|
||||
to contain enough <code>{};</code>s to pass the final <a href="../iocccsize.c">iocccsize.c</a> test.
|
||||
There are a few other tweaks:</p>
|
||||
<ul>
|
||||
<li><p>The <code>PPM</code> model uses mostly whitespace characters for
|
||||
weights.</p></li>
|
||||
<li><p>The encoder never emits <code>'"'</code> and
|
||||
<code>'\\'</code>.</p></li>
|
||||
<li><p>The decoder uses an O(n^2) algorithm to avoid the gigabytes-sized
|
||||
hash table frequently found in other <code>PPM</code>
|
||||
implementations.</p></li>
|
||||
<li><p>The <code>PPM</code> model uses mostly whitespace characters for weights.</p></li>
|
||||
<li><p>The encoder never emits <code>'"'</code> and <code>'\\'</code>.</p></li>
|
||||
<li><p>The decoder uses an O(n^2) algorithm to avoid the gigabytes-sized hash table
|
||||
frequently found in other <code>PPM</code> implementations.</p></li>
|
||||
</ul>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-2013hou"><a name="inventory"></a>Inventory for
|
||||
2013/hou</h1>
|
||||
<h1 id="inventory-for-2013hou"><a name="inventory"></a>Inventory for 2013/hou</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/hou/hou.c">hou.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/hou/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/hou/hou.orig.c">hou.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a href="doc/example.html">doc/example.html</a> - detailed
|
||||
information about entry</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/hou/old_default.scene">old_default.scene</a>
|
||||
- sample input</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/hou/otherroom.scene">otherroom.scene</a>
|
||||
- sample input</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/hou/try.sh">try.sh</a>
|
||||
- how to run</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/hou/hou.c">hou.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/hou/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/hou/hou.orig.c">hou.orig.c</a> - original source</li>
|
||||
<li><a href="doc/example.html">doc/example.html</a> - detailed information about entry</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/hou/old_default.scene">old_default.scene</a> - sample input</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/hou/otherroom.scene">otherroom.scene</a> - sample input</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/hou/try.sh">try.sh</a> - how to run</li>
|
||||
<li><a href="luna.jpg">luna.jpg</a> - sample image data</li>
|
||||
<li><a href="old_default.jpg">old_default.jpg</a> - sample image
|
||||
data</li>
|
||||
<li><a href="old_default.jpg">old_default.jpg</a> - sample image data</li>
|
||||
<li><a href="otherroom.jpg">otherroom.jpg</a> - sample image data</li>
|
||||
<li><a href="2013_hou.tar.bz2">2013_hou.tar.bz2</a> - download entry
|
||||
source</li>
|
||||
<li><a href="2013_hou.tar.bz2">2013_hou.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/hou/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/hou/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/hou/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/hou/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/hou/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="doc/camera.png">doc/camera.png</a> - documentation support
|
||||
image</li>
|
||||
<li><a href="doc/cosine.png">doc/cosine.png</a> - documentation support
|
||||
image</li>
|
||||
<li><a href="doc/draft.png">doc/draft.png</a> - documentation support
|
||||
image</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/hou/doc/example.md">doc/example.md</a>
|
||||
- markdown source for doc/example.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/hou/README.md">README.md</a> - markdown source for index.html</li>
|
||||
<li><a href="doc/camera.png">doc/camera.png</a> - documentation support image</li>
|
||||
<li><a href="doc/cosine.png">doc/cosine.png</a> - documentation support image</li>
|
||||
<li><a href="doc/draft.png">doc/draft.png</a> - documentation support image</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2013/hou/doc/example.md">doc/example.md</a> - markdown source for doc/example.html</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
Reference in new issue
Block a user