master
dfsek 1 year ago
parent 3b02f48f7c
commit af690eef49
  1. 5
      pages/about.hamlet
  2. 4
      pages/blog.hamlet
  3. 7
      pages/home.hamlet
  4. 8
      src/Application.hs
  5. 12
      static_blog/noise_rivers.hamlet

@ -1,2 +1,5 @@
<h1>About Me
<p>TODO
<p>
I'm dfsek, I work mostly on Minecraft stuff at Polyhedral Development (lots of worldgen stuff), as well as on
my homelab. This website is still a work-in-progress, it's a long overdue from-scratch project to replace
the bloated nightmare that 15 year-old me made.

@ -1,2 +1,4 @@
<h1>dfsek's Blog
<p>This is my blog, I probably won't post too much here.
<p>
This is my blog, I probably won't post too much here. Eventually this will support logging in and making posts
that way, but for now its just silly static posts from my old site.

@ -1,4 +1,5 @@
<h1>dfsek.com
<p>Hi! I'm dfsek, the founder and lead developer
at <a href="https://github.com/PolyhedralDev">Polyhedral Development</a>. This website contains
random projects of mine. Enjoy!
<p>
Hi! I'm dfsek, the founder and lead developer
at <a href="https://github.com/PolyhedralDev">Polyhedral Development</a>. This website contains
random projects of mine. Enjoy!

@ -13,26 +13,20 @@
module Application where
import ClassyPrelude.Yesod (fromString, newManager, pack, runMigration, unpack, (</>))
import ClassyPrelude.Yesod (newManager, runMigration, UTCTime)
import Control.Monad.Logger (runStdoutLoggingT)
import Data.Int (Int64)
import Data.Time (UTCTime, getCurrentTime)
import Data.Time.Format (FormatTime, defaultTimeLocale, formatTime)
import Data.Word as W
import Data.Yaml.Aeson (decodeFileEither)
import Database.Persist.Sqlite (ConnectionPool, SqlBackend, createSqlitePool, runSqlPersistMPool, runSqlPool)
import DfsekConfig
import GenericOIDC (oidcAuth')
import System.Directory (createDirectoryIfMissing)
import Text.Cassius
import Text.Hamlet (hamletFile)
import Text.Julius
import URI.ByteString ()
import qualified Web.ClientSession as CS
import Yesod
import Yesod.Auth
import Yesod.Auth.OAuth2.Prelude
import Yesod.Form.Bootstrap3
import Yesod.Static
import Prelude

@ -6,7 +6,8 @@
<pre>
<code class="javascript">
if(|simplex(x, z)| &gt; 0.2, 0, 1)
<img src="naive.png" alt="Naive solution to noise rivers.">
<img src="/static/blog/img/naive.png" alt="Naive solution to noise rivers.">
<br>
<sub>In this case, <code>simplex</code> is a 1-octave OpenSimplex2 noise function, domain-warped with another
1-octave OpenSimplex2 noise function with twice the frequency.</sub>
<br>
@ -37,14 +38,15 @@
<pre>
<code class="javascript">
if(simplex(x, z) &gt; 0, -1, 1)
<img src="posterized.png" alt="Posterized noise function">
<img src="/static/blog/img/posterized.png" alt="Posterized noise function">
<p>
Then, we apply the kernel to it:
<pre>
<code class="javascript">
kernel(if(simplex(x, z) &gt; 0, -1, 1), 1)
<img src="kerneled.png" alt="Posterized noise function with kernel applied">
<img src="/static/blog/img/kerneled.png" alt="Posterized noise function with kernel applied">
<br>
<sub>
<code>kernel</code> is simply a function that accepts a function to have the edge-detection kernel
applied, and the step at which to sample values for the kernel. E.G. 1 = sample every pixel, 4 =
@ -57,14 +59,14 @@
<pre>
<code class="javascript">
kernel(if(simplex(x, z) &gt; 0, -1, 1), 4)
<img src="kerneled_scaled.png" alt="Posterized, scaled noise function with kernel applied">
<img src="/static/blog/img/kerneled_scaled.png" alt="Posterized, scaled noise function with kernel applied">
<p>
Finally, we posterize again, and we have our result:
<pre>
<code class="javascript">
if(kernel(if(simplex(x, z) &gt; 0, -1, 1), 4) &gt; 0, 1, -1)
<img src="kerneled_scaled_posterized.png" alt="Posterized, scaled noise function with kernel applied, then posterized again">
<img src="/static/blog/img/kerneled_scaled_posterized.png" alt="Posterized, scaled noise function with kernel applied, then posterized again">
<p>
This completed function can easily be inserted into a biome generation system to create good-looking
fully procedural noise-based rivers. If slight width variations are desired, a simple domain warp can

Loading…
Cancel
Save