Jump to content

Generating Impostor in URP - Flipped texture + fog causes washed out render texture


Murshid

Recommended Posts

Hey everyone,

After migrating from Unity 2020 to 2022,

I was trying to bake multiple terrains to impostors using the "Ortho capture" method. The texture was always turning out washed-out/white and incorrectly rendered with blocky-ness and flip. After a bit of trouble shooting I realized two things:

  • Fog was active and density was high during conversion.
  • Had to comment out the UPPipeline flip code block.

Added the following piece of code to OrthographicBake.cs should mitigate it:

// New member variable
private static bool m_FogActive;

// In LightsOff()
m_FogActive = RenderSettings.fog;
RenderSettings.fog = false;

// In LightsOn()
RenderSettings.fog = m_FogActive;

Commented out the following (or add a less-than version define!):

#if HDPipeline || UPPipeline
            Material flipMat = new Material(Shader.Find("Hidden/Gaia/FlipY"));
            flipMat.SetTexture("_InputTex", m_tmpRenderTexture);
            RenderTexture buffer = RenderTexture.GetTemporary(m_tmpRenderTexture.descriptor);
            Graphics.Blit(m_tmpRenderTexture, buffer, flipMat);
            Graphics.Blit(buffer, m_tmpRenderTexture);
            RenderTexture.ReleaseTemporary(buffer);
#endif

 

My Unity version: 2022.1.23f1 Pro
Pipeline: URP 13.1.8
Build platform: Android

Hope that helps someone.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Tell a friend

    Love Canopy - Procedural Worlds? Tell a friend!
  • Need help?

    We work with some of the biggest brands in global gaming, automotive, technology, and government to create environments, games, simulations, and product launches for desktop, mobile, and VR.

    Our unique expertise and technology enable us to deliver solutions that look and run better at a fraction of the time and cost of a typical project.

    Check out some of our non-NDA work in the Gallery, and then Contact Us to accelerate your next project!

×
×
  • Create New...