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:
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With