Jump to content
Sign in to follow this  
spooky

Lightmap Bleed / UV2 Padding?

Recommended Posts

So I'm having an issue with lightmapping (when am I not? I hate it) and I'm not sure if Beast is the problem or the UV2s generated by ProBuilder.

 

I'm seeing significant light bleed on complex ProBuilder objects. The texel padding setting in the scene lighting properties only seems to affect the padding between separate objects. So I believe the issue is in the UV2s generated by ProBuilder not having [enough?] padding. If that is the case is there a way to change the UV2 generation settings, or should I put this in Feature Requests?

 

Below: The light in the highlighted area is bleeding into the opposite edge of the nearby (in UV space) face.

post-681-0-94639300-1470888689_thumb.png

 

post-681-0-41169600-1470889324_thumb.jpg

*Also note the other less defined glowing edges on the other steps.

Share this post


Link to post
Share on other sites

That does seem likely.  This was a feature available up until the 2.5 update, where it was omitted from the toolbar (and subsequently forgotten).  I've added it back in the "Generate UV2" options window, will have the update out asap.

Share this post


Link to post
Share on other sites

That does seem likely.  This was a feature available up until the 2.5 update, where it was omitted from the toolbar (and subsequently forgotten).  I've added it back in the "Generate UV2" options window, will have the update out asap.

There's an options window for Generate UV2? I was doing it through "Tools > ProBuilder > Actions > Generate UV2 - Scene" since auto UV2 generation wasn't working reliably. I would sit through a bake only to have bad UV2s on several new or modified PBOs.

 

I'll be looking forward to the update. Thanks for the continued great support. :)

 

Edit: I found it. Automatic UV2 Generation has to be disabled in ProBuilder preferences.

Share this post


Link to post
Share on other sites

I just pushed the update this afternoon, let me know how it works for you!

Ok, so the new/default settings after the update are causing more light bleeding error. The good news is that I can mostly* eliminate it using the new generation settings.

 

Mostly because even at the maximum slider value of 64 some objects are still receiving a partial lightmap texel (luxel). While it's still not perfect this is still a vast improvement over receiving one or more entire luxels and proves my hypothesis (which means it can be solved, and it's not an unfixable issue with Beast) so I'm very appreciative of this update!

 

I believe the issue is that, at least within the ranges of values I have tested, there does not appear to be any pixel difference in the resulting lightmap (See attachment) faces of individual objects are still edge to edge even at the maximum Pack Margin value. The magenta area is the same lightmap without padding on Beast. Is there any way PB could create similar padding?

 

As a side note, it would be nice if there were a way to set defaults for the UV2 settings for new PBOs so I don't have to set them on every object. :)

 

Edit: Nevermind, everything seems to be working acceptably after some tweaking! Thanks!

post-681-0-83987500-1472251590_thumb.jpg

Share this post


Link to post
Share on other sites

As a side note, it would be nice if there were a way to set defaults for the UV2 settings for new PBOs so I don't have to set them on every object.  :)

 

 

 

That's a solid idea... shoot.  I'm kind-of upset I didn't think of it first :)

Share this post


Link to post
Share on other sites

Actually come to think of it, you can do this now using the OnObjectCreated delegate.

/**
 *	Set new ProBuilder objects to use uwnrap params.
 */

using UnityEngine;
using UnityEditor;
using System.Collections;
using ProBuilder2.Common;
using ProBuilder2.EditorCommon;

[InitializeOnLoad]
public class SetUnwrapParams : Editor
{
	/**
	 *	Static constructor is called and subscribes to the OnProBuilderObjectCreated delegate. 
	 */
	static SetUnwrapParams()
	{
		pb_EditorUtility.AddOnObjectCreatedListener(OnProBuilderObjectCreated);
	}

	~SetUnwrapParams()
	{
		pb_EditorUtility.RemoveOnObjectCreatedListener(OnProBuilderObjectCreated);
	}

	/**
	 *	When a new object is created this function is called with a reference to the pb_Object
	 *	last built.
	 */
	static void OnProBuilderObjectCreated(pb_Object pb)
	{
		pb_UnwrapParameters up = pb.unwrapParameters;
		up.hardAngle = 88f;			// range: 1f, 180f
		up.packMargin = 15f;		// range: 1f, 64f
		up.angleError = 30f;		// range: 1f, 75f
		up.areaError = 15f;			// range: 1f, 75f

		// to reset back to defaults: 
		// up.Reset()
	}
}

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×