title: Smoothing colors between vertices
body: <p>I've made a minecraft-kinda engine in C#, XNA. It gives a high fps and loads chunks w/o fps falls at all, but when it comes to global lights and shadows - i have problems.</p>
  
  <p>Basically - in chunk's model creation loop </p>
  
  <pre><code>for (i = 0; i &lt; 16; i++) 
  { 
      for(int j = 0; j &lt; chunk_height; j++) 
      { 
          for(int k = 0; k &lt; 16; k++) 
          {
              // check if block (and 4 blocks around 
              // a current one (i, j, k), (i + 1, j, k), 
              // (i - 1, j, k), (i, j, k + 1), (i, j, k -1)) 
              // are covered and put shadows to block face's vertex colors. 
          }
      }
  }
  </code></pre>
  
  <p>Result is old-minecraft-style shadows: </p>
  
  <p><img src="https://i.stack.imgur.com/Hpffx.png" alt=""></p>
  
  <p>(With same good performace as before <em>screenshot is made with vsync on, w/o it fps is ~ 350</em>)</p>
  
  <p>But i am trying to achieve minecraft's shadow, biome color and light smoothing -></p>
  
  <p>I am using triangle list because its impossible to use triangle strip for such stuff.
  But vertex colors aren't smooth between any cube faces in this case.</p>
  
  <p>So the problem is smoothing these vertices.Color -s to look like minecraft's one.</p>
  
  <p>I made a simple algorithm, but it loads cpu too hard <code>(vertices.Count ^ 2 - sized loop)</code> so when you travel world and newly loaded chunks's shadows are computed, pc lags for 1-2 seconds, every time, while in mc there are no such slowdowns.</p>
  
  <p>(I need the smoothing algo to be realtime and onrun because the main goal is to beat minecraft's performance (in minecraft's current minimum / medium graphics the result is achieved (~ 300 fps versus minecraft's 70))</p>
  
  <p>Chunk's class (with the main problem), Helper class (misc stuff, used in project), Block class (Block-Type Base(used for creating and registering block types), block's model generator):</p>
  
  <p><a href="http://pastebin.com/GB1QqtdQ" rel="nofollow noreferrer">http://pastebin.com/GB1QqtdQ</a></p>
  
  <p>P.S. Sorry for my English if it's bad, it isn't my main lang.</p>