### Search in Sort by:

 Everything Rendering Current Space

### Search help

• Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
• You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
• cat dog --matches anything with cat,dog or both
• cat +dog --searches for cat +dog where dog is a mandatory term
• cat -dog -- searches for cat excluding any result containing dog
• [cats] —will restrict your search to results with topic named "cats"
• [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

# DistanceToNearestSurface doesn't blend

 0 "Apparently it calculates the distance between the nearest DistanceField and the desired position." This is not entirely correct. It gives the approximate distance in centimeters to the nearest surface from the given position. Which is positive when the given position is outside of the mesh, and negative when the given position is inside of a mesh. Since you clamp the value between 0 and 1 anything negative is going to be zero. Next you invert it using the lerp(1,0) so this means all the negative values will become white. Your mesh is probably a bit to small, and approximately the distance towards the surface is inside the mesh, giving you since it is clamped and inverted the white spots. In all my demos I used fairly large meshes. You could also play around with the console settings. All settings start with r.DF or r.DistanceField. Bonus tip: Since at the end you have a value between 0 and 1, doing a lerp(1,0) as doing a OneMinus. Expample, lets say you have a value of 0.3, these would be the equations: `````` Lerp: 0.3 * (0 - 1) + 1 = 0.7; OneMinus: 1 - 0.3 = 0.7; `````` OneMinus basically inverts a value between 0 and 1. Lerp linearly interpolates between 2 values based on a single value between 0 and 1. Enjoy! more ▼ answered Aug 05 '16 at 10:24 AM Roel 2.4k ● 69 ● 42 ● 141 add new comment (comments are locked) 10|2000 characters needed characters left ▼ Viewable by all users