Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Light Pre-Pass (or Deferred) Pipeline Bug

Tags:

c#

graphics

xna

Me and some guys are creating a simple game in XNA 4.0 (yea, i know it's not supported by MS anymore, but it's requirement given by our tutors). Recently I wrote Light-Pre Pass Renderer based on J. Coluna's one. It was working fine until we added some meshes with bump and albedo maps. Now we've got strange bug. Here are given the examples:

Renderer bugRenderer bugRenderer bug

I dont't have a clue what causes these artifacts (green/purple). Sometimes similar artifacts occur on the floor and they are black. Do you have any idea what might be the problem in renderer?

If my post isn't clear enough let me know, I'll try clarify it.

like image 675
Shot Avatar asked Jun 06 '13 11:06

Shot


1 Answers

You have not provided any code so I have to base my answer on observation only.

I believe the problem is from flipped normals related to how the object geometry was created.

If you take a close look on image #3 - you will notice that the purple artifact can be seen on the left side of the object as well but in a narrower area. according to that this is the theory I offer:

Your animator created the object and didn't like the sharp edges - so to get rid of them he or she rotated the edge vertexes and moved them inner to in a manner that overlap the shape exterior.

If I'll try to illustrate it somehow it would look something like this:

original object:

+-------+
|=====|
|=====|
|=====|
+-------+

vs. tinkered object:

  -------
|x===x|
|=====|
|x===x|
  -------

Where the '+' is converted to 'x' - meaning the vertex was rotated and moved further inside the shape. this probably inverted the normals which affect the light being reflected back from the object.

The reason we see in image #3 a narrow area with artifact in the left is probably since the artist rotated all corners at the same time - and if that is the case I believe the if you rotate the shape the phenomena will be symmetric meaning you will see again wider artifact to the right of the object and narrower to the left - but if you flip the shape (rotate on Y 180 degrees) the phenomena will flip with it.

Another option to test for this will be to put a new simple box shape into the scene and check if the artifact is gone.

like image 180
G.Y Avatar answered Oct 27 '22 20:10

G.Y