Search Unity

Blotchy, dappled, dark patches on lightmaps

Discussion in 'Editor & General Support' started by yezzer, Oct 26, 2014.

  1. yezzer

    yezzer

    Joined:
    Oct 30, 2009
    Posts:
    143
    I've done quite a lot of lightmapping with Unity in the past, but this has me stumped. Whatever I try doesn't seem to help.

    My issue is with dark patches on models when lightmapping, and obvious edges appearing. Hopefully these images will explain:
    lightmap-side.png

    lightmap-nomesh.png

    lightmap-mesh.png

    Comparison with no lightmaps, which is fine:

    no-lightmaps.png

    The object is an airplane in a large hangar, lit by multiple spotlights on the ceiling (Shadow Samples 3, Shadow Radius 1), and a Directional Light that passes through a skylight above.

    All lights are set to BakedOnly. All objects in the scene are static.

    Note: I didn't make the object myself, could it be a problem with the FBX?

    I'm using Skyshop and LM Extended. My beast XML settings are below. I'm using Directional lightmaps.

    Code (CSharp):
    1. <?xml version="1.0" encoding="iso-8859-1"?>
    2. <ILConfig>
    3.   <AASettings>
    4.     <minSampleRate>0</minSampleRate>
    5.     <maxSampleRate>2</maxSampleRate>
    6.     <contrast>0.1</contrast>
    7.     <diagnose>false</diagnose>
    8.     <clamp>false</clamp>
    9.     <samplingMode>Adaptive</samplingMode>
    10.     <filter>Box</filter>
    11.     <filterSize>
    12.       <x>1</x>
    13.       <y>1</y>
    14.     </filterSize>
    15.   </AASettings>
    16.   <RenderSettings>
    17.     <bias>0.005</bias>
    18.     <giTransparencyDepth>2</giTransparencyDepth>
    19.     <ignoreLightLinks>false</ignoreLightLinks>
    20.     <maxRayDepth>6</maxRayDepth>
    21.     <maxShadowRays>4</maxShadowRays>
    22.     <minShadowRays>0</minShadowRays>
    23.     <reflectionDepth>2</reflectionDepth>
    24.     <reflectionThreshold>0.001</reflectionThreshold>
    25.     <shadowDepth>2</shadowDepth>
    26.     <shadowsIgnoreLightLinks>false</shadowsIgnoreLightLinks>
    27.     <transparencyDepth>50</transparencyDepth>
    28.     <tsIntersectionNormalization>true</tsIntersectionNormalization>
    29.     <tsIntersectionOrthogonalization>true</tsIntersectionOrthogonalization>
    30.     <tsOddUVFlipping>true</tsOddUVFlipping>
    31.     <tsVertexNormalization>true</tsVertexNormalization>
    32.     <tsVertexOrthogonalization>true</tsVertexOrthogonalization>
    33.     <vertexMergeThreshold>0.001</vertexMergeThreshold>
    34.   </RenderSettings>
    35.   <EnvironmentSettings>
    36.     <giEnvironment>None</giEnvironment>
    37.     <skyLightColor>
    38.       <r>0.86</r>
    39.       <g>0.93</g>
    40.       <b>1</b>
    41.       <a>1</a>
    42.     </skyLightColor>
    43.     <giEnvironmentIntensity>1</giEnvironmentIntensity>
    44.     <iblImageFile />
    45.     <iblBandingVsNoise>1</iblBandingVsNoise>
    46.     <iblEmitDiffuse>true</iblEmitDiffuse>
    47.     <iblEmitLight>false</iblEmitLight>
    48.     <iblEmitSpecular>false</iblEmitSpecular>
    49.     <iblGIEnvBlur>0</iblGIEnvBlur>
    50.     <iblIntensity>1</iblIntensity>
    51.     <iblSamples>300</iblSamples>
    52.     <iblShadows>true</iblShadows>
    53.     <iblSpecularBoost>1</iblSpecularBoost>
    54.     <iblSwapYZ>false</iblSwapYZ>
    55.     <iblTurnDome>90</iblTurnDome>
    56.   </EnvironmentSettings>
    57.   <FrameSettings>
    58.     <autoThreads>true</autoThreads>
    59.     <autoThreadsSubtract>0</autoThreadsSubtract>
    60.     <renderThreads>2</renderThreads>
    61.     <dither>true</dither>
    62.     <inputGamma>1</inputGamma>
    63.     <outputCorrection>
    64.       <colorCorrection>None</colorCorrection>
    65.       <gamma>1</gamma>
    66.     </outputCorrection>
    67.     <premultiply>true</premultiply>
    68.     <premultiplyThreshold>0</premultiplyThreshold>
    69.     <outputVerbosity>
    70.       <errorPrint>true</errorPrint>
    71.       <warningPrint>true</warningPrint>
    72.       <benchmarkPrint>false</benchmarkPrint>
    73.       <progressPrint>true</progressPrint>
    74.       <infoPrint>false</infoPrint>
    75.       <verbosePrint>false</verbosePrint>
    76.       <debugPrint>false</debugPrint>
    77.       <debugFile>false</debugFile>
    78.     </outputVerbosity>
    79.   </FrameSettings>
    80.   <GISettings>
    81.     <clampMaterials>None</clampMaterials>
    82.     <diffuseBoost>1</diffuseBoost>
    83.     <emissiveScale>1</emissiveScale>
    84.     <enableCaustics>false</enableCaustics>
    85.     <enableGI>true</enableGI>
    86.     <ignoreNonDiffuse>true</ignoreNonDiffuse>
    87.     <prepassMaxSampleRate>0</prepassMaxSampleRate>
    88.     <prepassMinSampleRate>-4</prepassMinSampleRate>
    89.     <primaryIntegrator>FinalGather</primaryIntegrator>
    90.     <primaryIntensity>1</primaryIntensity>
    91.     <primarySaturation>1</primarySaturation>
    92.     <secondaryIntegrator>None</secondaryIntegrator>
    93.     <secondaryIntensity>1</secondaryIntensity>
    94.     <secondarySaturation>1</secondarySaturation>
    95.     <specularScale>1</specularScale>
    96.     <fgAOContrast>0.666</fgAOContrast>
    97.     <fgAOInfluence>0.181</fgAOInfluence>
    98.     <fgAOMaxDistance>0.3</fgAOMaxDistance>
    99.     <fgAOScale>2</fgAOScale>
    100.     <fgAOVisualize>false</fgAOVisualize>
    101.     <fgAttenuationStart>0</fgAttenuationStart>
    102.     <fgAttenuationStop>0</fgAttenuationStop>
    103.     <fgCacheDirectLight>false</fgCacheDirectLight>
    104.     <fgCheckVisibility>true</fgCheckVisibility>
    105.     <fgCheckVisibilityDepth>1</fgCheckVisibilityDepth>
    106.     <fgClampRadiance>false</fgClampRadiance>
    107.     <fgContrastThreshold>0.1</fgContrastThreshold>
    108.     <fgDepth>1</fgDepth>
    109.     <fgEstimatePoints>15</fgEstimatePoints>
    110.     <fgExploitFrameCoherence>false</fgExploitFrameCoherence>
    111.     <fgFalloffExponent>0</fgFalloffExponent>
    112.     <fgGradientThreshold>0.5</fgGradientThreshold>
    113.     <fgInterpolationPoints>15</fgInterpolationPoints>
    114.     <fgLightLeakRadius>0</fgLightLeakRadius>
    115.     <fgLightLeakReduction>false</fgLightLeakReduction>
    116.     <fgMaxRayLength>0</fgMaxRayLength>
    117.     <fgNormalThreshold>0.2</fgNormalThreshold>
    118.     <fgPreview>false</fgPreview>
    119.     <fgRays>500</fgRays>
    120.     <fgUseCache>Irradiance</fgUseCache>
    121.     <ptAccuracy>1</ptAccuracy>
    122.     <ptCacheDirectLight>false</ptCacheDirectLight>
    123.     <ptCheckVisibility>true</ptCheckVisibility>
    124.     <ptConservativeEnergyLimit>0.95</ptConservativeEnergyLimit>
    125.     <ptDefaultColor>
    126.       <r>0</r>
    127.       <g>0</g>
    128.       <b>0</b>
    129.       <a>1</a>
    130.     </ptDefaultColor>
    131.     <ptDepth>5</ptDepth>
    132.     <ptDiffuseIllum>true</ptDiffuseIllum>
    133.     <ptFile />
    134.     <ptFilterSize>3</ptFilterSize>
    135.     <ptFilterType>Gauss</ptFilterType>
    136.     <ptNormalThreshold>0.7</ptNormalThreshold>
    137.     <ptPointSize>0</ptPointSize>
    138.     <ptPrecalcIrradiance>true</ptPrecalcIrradiance>
    139.     <ptPreview>false</ptPreview>
    140.     <ptSpecularIllum>true</ptSpecularIllum>
    141.     <ptTransmissiveIllum>true</ptTransmissiveIllum>
    142.     <mcDepth>2</mcDepth>
    143.     <mcMaxRayLength>0</mcMaxRayLength>
    144.     <mcRays>16</mcRays>
    145.   </GISettings>
    146.   <SurfaceTransferSettings>
    147.     <frontRange>0</frontRange>
    148.     <frontBias>0</frontBias>
    149.     <backRange>2</backRange>
    150.     <backBias>-1</backBias>
    151.     <selectionMode>Normal</selectionMode>
    152.   </SurfaceTransferSettings>
    153.   <TextureBakeSettings>
    154.     <bgColor>
    155.       <r>1</r>
    156.       <g>1</g>
    157.       <b>1</b>
    158.       <a>1</a>
    159.     </bgColor>
    160.     <bilinearFilter>true</bilinearFilter>
    161.     <conservativeRasterization>true</conservativeRasterization>
    162.     <edgeDilation>3</edgeDilation>
    163.   </TextureBakeSettings>
    164. </ILConfig>
     
    Last edited: Oct 26, 2014
  2. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,659
    What's your lightmap resolution look like on the model?
     
  3. yezzer

    yezzer

    Joined:
    Oct 30, 2009
    Posts:
    143
    Screenshot 2014-10-26 18.25.47.png
    It was higher res, I'm just lowering it briefly while I test a lower quality bake
     
  4. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,659
    Am I right in thinking that the discontinuities in the lightmaps correspond to the discontinuities in the checkerboard, there?
     
  5. yezzer

    yezzer

    Joined:
    Oct 30, 2009
    Posts:
    143
    Ha! Yes, Not sure why I didn't notice that. Well, that would explain the line that runs across it - I guess? I'll ask the artist about that, see if he has any ideas..

    The blotchyness though - that remains an issue.

    Lightmaps are uncompressed, and set to a max res of 2048.
     
  6. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,659
    Yeah, first step is to sort out those lightmap UVs so that big continuous chunks of surface get big contiguous islands in the lightmap wherever possible. Then see where you're at with the blotchyness.

    You might want to try setting enableGI to false and baking, just to check whether the blotchyness is being caused by the GI stuff or whether it's present even without that.
     
  7. spike1

    spike1

    Joined:
    Feb 20, 2013
    Posts:
    58
    Not sure if this is the problem (There seem to be a few reasons from the search I did a while back), however I found when baking if I had lights that were really close to objects (Or almost intersecting), it could create the same blotchy pattern. It could also just be caused by only using a small number of rays. I'm pretty sure there's a setting in there somewhere for rays, can't remember where though :).