Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Is there any way to set surfaceTextureScaleOffset in custom light data

Discussion in 'High Definition Render Pipeline' started by Misaki_eKU, Dec 1, 2023.

  1. Misaki_eKU

    Misaki_eKU

    Joined:
    May 3, 2018
    Posts:
    86
    Here is the source code from HDRP 17.0.1 (the unity version in 2023.3.0a15): Graphics/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/PhysicallyBasedSkyRenderer.cs at cb38bcbb1f25d90feff3d3a619245b01a020b0e0 · Unity-Technologies/Graphics (github.com)
    upload_2023-12-1_22-32-25.png
    I want to do the same thing in my own custom sky and able to use
    SampleCookie2D
    in shader to show cookie texture on the sky. However,
    m_TextureCaches
    is inaccessible due to its protection level. Is there any other way to set
    surfaceTextureScaleOffse
    t?
    Before I update this learning project to latest version, I can just use the data from
    DirectionLightData
    directly in shader, but in the last version I need to fill and pass the
    CelestialBodyData
    by myself in sky renderer.
     
    Last edited: Dec 3, 2023
  2. Misaki_eKU

    Misaki_eKU

    Joined:
    May 3, 2018
    Posts:
    86
  3. adrien-de-tocqueville

    adrien-de-tocqueville

    Unity Technologies

    Joined:
    Mar 16, 2020
    Posts:
    245
    Indeed with latest version celestial body data is not uploaded when the pbr sky is not enabled
    What you can do as a workaround is to manage your own atlas of textures by copying the m_CookieAtlas part of the class LightCookieManager. It's mostly a wrapper around PowerOfTwoTextureAtlas which is public API so it shouldn't be too much work, and that way you can upload whaterver you want in your atlas
     
  4. Misaki_eKU

    Misaki_eKU

    Joined:
    May 3, 2018
    Posts:
    86
    That's what I am doing right now. Will here be a simple way to do this in the future?