Search Unity

  1. Click here to see what's on sale for the "Best of Super Sale" on the Asset Store
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Terrain Case 1221827 URP -Terrain LightProbes for Speedtree7/8 shaders bake black

Discussion in 'World Building' started by ROBYER1, Feb 21, 2020.

  1. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    984
    Reported at (Case 1221827) [URP][Terrain][Speedtree]Terrain LightProbes for Speedtree7/8 shaders bake black

    When importing Speedtree shaders into URP, we noticed that once the light mode was set to baked only on the directional light in our scene, the speedtree shaders bake out completely black from Terrain Light probes. Prior to baking (with all baked lighting cleared), the trees just have a dark side where they are in shadow but this is very dark and looks ugly nomatter what we do with Shadow intensity on the directional light.
    When we took the tree materials and changed them to the default URP/Lit shader, they look just fine with terrain light probes.

    My assumption here is that in URP only, the light probes on the terrain bake out completely black for Speedtree shaders as this does not happen with the built-in renderer, see the videos below. I am happy to share this example scene (both the URP and built-in renderer version) as we are not pleased our trees do not look right in URP now.

    UniversalRP version:


    Built-In version
     
    camta005, URPian and Rowlan like this.
  2. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    984
    Reproduction steps here @wyattt_


    Steps:
    1. Make a new Unity 2020.1.0a23 (or a24) project for Android Platform using 3D Template in Unity Hub
    2. Build Settings - Set texture compression to ASTC
    3. Player settings - Set scripting backend to IL2CPP
    4. From the Asset Store, import these example speedtrees (or copy the exact same assets from the repro project with this case as the Speedtree files are unmodified) https://assetstore.unity.com/packages/3d/vegetation/speedtree/free-speedtrees-package-29170
    5. Make a new scene, leave everything as default
    6. Set Directional Light to 'Baked Only'
    7. Create a terrain, leave default settings but set width 50 and height to 50 under terrain settings, Lightmapping settings - Scale in lightmap to '1' (so we can see if any shadows bake clearly)
    8. Lighting - Lightmapping Settings - Lightmapper - set to GPU (preview)
    9. Drag and drop Broadleaf mobile or any other speedtree into the scene
    10. Set the tree to 0,0,0 position in the world and tick it as static, tick 'set children static' also when asked
    11. Drag the tree gameobject back into the project window to make it a prefab
    12. Under Terrain - Paint Trees, click 'Edit tree' and add tree, drag the prefab tree we have just made into the tree edit dialogue
    13. Now paint some of the trees on terrain
    14. Bake the scene lighting in the Lighting window, verify the trees cast shadows and are lit perfectly using built-in 3d renderer with the Terrain light probes (you can see under Terrain-Terrain Settings - Tree & Detail Objects - Bake Light Probes For Trees is ticked by default for this.

    15. --Importing of URP--
    16. Window-Package Manager- All Packages - Universal RP - Install
    17. Right click in project window - Create - Rendering- Universal Render Pipeline - Pipeline Asset (Forward Renderer)
    18. Edit - Project Settings - Graphics - drag the newly created Pipeline asset into the Render Pipeline Asset field at the top of the window
    19. On the Terrain, Terrain Settings - Basic Terrain - Material, add the TerrainLit material from Packages - Universal RP\Runtime\Materials (This seems to be a workflow issue with switching to URP)
    20. Select the original speedtree asset you used in the project window (Broadleaf mobile) - Materials - Generate (or regenerate materials)
    21. Now see the trees that looked fine (then turned pink due to the render pipeline change) are now black, something is obviously off here!
    22. Lighting Window - Clear Baked Data (this is in the arrow dropdown which is part of the Generate Lighting button)
    23. Now the trees look fine again!
    24. Generate lighting again to verify that the terrain tree light probes go black again, you can at this point make a Unity cube marked as static into a prefab and paint a few as 'Trees' on the terrain and bake the lighting to see that the probes on the cubes look just fine but not the URP Speedtrees.


      --Speedtree 8 warping effect repro
    25. Player settings - Set scripting backend to IL2CPP
    26. From the Asset Store, import these example speedtrees (or copy the exact same assets from the repro project with this case as the Speedtree files are unmodified) https://assetstore.unity.com/packages/3d/vegetation/speedtree/free-speedtrees-package-29170
    27. Make a new scene, leave everything as default
    28. Set Directional Light to 'Baked Only'
    29. Create a terrain, leave default settings but set width and height to 50 under terrain settings, Lightmapping settings - Scale in lightmap to '1' (so we can see if any shadows bake clearly)
    30. Lighting - Lightmapping Settings - Lightmapper - set to GPU (preview)
    31. Drag and drop Broadleaf mobile or any other speedtree into the scene
    32. Set the tree to 0,0,0 position in the world and tick it as static, tick 'set children static' also when asked
    33. Set both the material shaders on the speedtree and the LOD models under the speedtree from Nature/Speedtree to Nature/Speedtree8
    34. Zoom the camera back/forth to see the warping effect
    35. Import URP same as above and make a Pipeline Asset
    36. Regenerate the Speedtree materials
    37. Set both the material shaders on the speedtree and the LOD models under the speedtree from UniversalRP/Nature/Speedtree to UniversalRP/Nature/Speedtree8
    38. Zoom the camera back/forth to see the warping effect
     
  3. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    984
  4. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    1,634
    Is this Android only?
     
  5. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    984
    Nope, any platform but my reproduction case was for Android
     
unityunity