Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Modify 2D lights render texture

Discussion in 'Universal Render Pipeline' started by pietro0games, Dec 19, 2022.

  1. pietro0games

    pietro0games

    Joined:
    Jun 5, 2017
    Posts:
    4
    I want to create a pixelated shadow effect on my 2d game. Right now, i can make it by changing the way the light texture(the one generated by 2d lights) is processed in every objects shaders. It's an equal process being applied on every shader. It's an multiple process that could be done one time per frame if i could change the original light texture.
    Then, I ask this: Is it possible to modify the "original" render texture, that will be used by URP shaders, by a renderer feature or something else? It is possible to at least get this texture outside shadergraph?
     
    Last edited: Dec 19, 2022
  2. pietro0games

    pietro0games

    Joined:
    Jun 5, 2017
    Posts:
    4
    Ok, The light texture is a global texture, then i can get the reference in the renderer feature, but it seems it always came "null" the texture. If I pass the reference to a new global texture during the execute, almost works as the light texture ( It has some odd behaviour if i set the render event after the skybox). If I try to blit this global reference, it seems is comes a null texture only with the sizes.(I can't find the graphic format for this texture too).
    Edit: maybe it is the blit problem, that im seeing other people talk about it.
     
    Last edited: Dec 20, 2022
  3. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,503
    I suspect this can only be fixed by forking URP and modifying its passes. In the Render2DLightingPass, it generates and disposes the light textures within this pass, so you don't have the opportunity to get and modify them in a Feature.
     
  4. pietro0games

    pietro0games

    Joined:
    Jun 5, 2017
    Posts:
    4
    hm, i heard about that and looking at the frame debugger seems there isn't an option to add a render feature in between 2d lights and sprites Then, maybe in the far future will look further into this, trying to mudify URP. But i really hope the unity team decide to change and only dispose the light texture on the next frame.