Meshes get black faces if scaled up several times

Component:YafaRay Core
Category:bug report
Assigned:David Bluecame

The problem occurs when a model is scaled up several times, then the faces look like they are overlaying each other there in fact they aren't.

The first image shows the sphere scaled up 500x

The second image shows the sphere scaled down 0.5x

(to reproduce the second effect, scale down the parent (empty) 0.001x )

(Yafaray build with default optimization)


check the files below:

face_issue.blend231.38 KB
sphereupscaled.png954.09 KB
spheredownscaled.png557.02 KB



Bug confirmed on Windows 7 64 bits / YafaRay 0.1.2 beta 2 / blender 2.5 exporter August 2011, using the scene posted by Aspen.



Still happening in YafaRay 012 beta 5a Blender 2.62a. You can try with the scene below, adapted to Blender 2.63



Confirmed this issue with latest development version of yafaray.

Also tested with an object containing fewer faces, artifacts are present with the diamond shape too.

face_issue_diamond.blend 363.81 KB
face_issue_diamond.png 960.58 KB


I looked into this, I think it's related to numerical precision and the way Yafaray tries to avoid self-shadowing. When having a large-scale scene, the decimal precision is lost and the offset used to avoid self-shadowing may fail somewhat arbitrarily. One solution would be to scale down all scenes inside Yafaray, but this would lead to problems with texture scales etc. Another solution would be to finally change the self-shadowing bias to something adapted to the scene size.


Assigned to:Anonymous» David Bluecame
Status:active» duplicate


I'm marking this as a duplicate because this problem is caused by the same issue affecting the issue here:

I've sent pull requests to expose the Shadow Bias to the user, so the user can fix these problems with black dots in the scenes where they happen.

With this change, I can render this image correctly if I increase the Shadow Bias from the default value (0.0005) to, for example. 0.005. This also changes automatically the minimum ray distance (1/10th of the shadow bias)

For more information and images, please see:


After discussing it with DarkTide, this needs more work. Instead of a temporary solution exposing the shadow bias parameter we will look for an automatic shadow bias calculation depending on the scene.

So, I've sent a very experimental change to automatically calculate the shadow bias and ray minimum distance based on the size of the scene.

The pull request is:


It needs to be extensively tested, but in my tests it gets rid of all these problems without obvious new issues, but such a fundamental change affects everything and needs to be tested thoroughly.

To avoid duplicating comments, I will continue the discussion in the bug report:


Status:duplicate» closed

The change for automatic bias calculation has been accepted in the official YafaRay code and I've made builds of an Experimental version with this fix included, so I will consider it fixed. See bug report for more information.

As this is considered a duplicate bug report and the "original" one has been fixed, I will close this. In any case I want to include the scene in this bug report rendered with the new experimental version for future reference:


sphere automatic shadow bias version fixed self-shadow bug.png 112.87 KB


Also the diamond image without the self shadow problem now:

diamond automatic shadow bias version fixed self-shadow bug.png 102.55 KB