Search Unity

LightWeight render pipeline + blitting == broken ?

Discussion in 'General Graphics' started by Paradoks, Nov 16, 2018.

  1. Paradoks

    Paradoks

    Joined:
    Oct 13, 2009
    Posts:
    436
    Hello,

    I got a script that does a blitting, it worked perfectly well before i tried to use the lightweight render pipeline.
    Are those still compatible, if not, do you know a workaround ?

    thx
     
  2. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,025
    Hi!
    You have to use a shader that is compatible with LWRP for blitting.
     
  3. Paradoks

    Paradoks

    Joined:
    Oct 13, 2009
    Posts:
    436
    What do you mean ? i think that all my shaders are LWRP compatible by now.
     
  4. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,025
    Which shader are you using for the blit?
     
  5. Paradoks

    Paradoks

    Joined:
    Oct 13, 2009
    Posts:
    436
    My shader is simply this one:
    Particles/Aplha Blended

    And my way to blit is simply that:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class FowBlitter : MonoBehaviour{
    5.  
    6.     public RenderTexture fowRenderTexture;
    7.     public Material material;//Particles/AlphaBlended
    8.  
    9.  
    10.     void OnRenderImage(RenderTexture source, RenderTexture destination){
    11.  
    12.         Graphics.Blit(fowRenderTexture, source, material);
    13.         Graphics.Blit(source, destination);
    14.     }
    15. }
    Works perfectly well with "normal" render, not at all with LWRP.
    Tryied every LightWeightPipeline shaders with no success.
     
    Last edited: Nov 19, 2018
  6. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,025
    Particles/Alpha Blended is a shader for the built-in render pipeline, not LWRP.
    Use Hidden/Lightweight Render Pipeline/Blit for LWRP :)
     
  7. Paradoks

    Paradoks

    Joined:
    Oct 13, 2009
    Posts:
    436
    How do you select it ?
    I don't have it in my shader list.

    i try that:
    Code (CSharp):
    1.     void Awake(){
    2.  
    3.         var shader = Shader.Find (" Hidden/Lightweight Render Pipeline/Blit");
    4.         material.shader = shader;
    5.     }
    Don't work.
    Plus i need a semi transparent shader that i can tweak.
     
  8. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,025
    Then make a copy of this shader and tweak it the way you need. It's located in "Shaders/Util/Blit.shader"

    Btw, I suppose it didn't work because you have a leading space in the shader name.
     
  9. Paradoks

    Paradoks

    Joined:
    Oct 13, 2009
    Posts:
    436
  10. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,792
    I don't think it's the shaders. Unless something changed recently, I was under the impression that OnRenderImage doesn't get called in LWRP.
     
  11. Paradoks

    Paradoks

    Joined:
    Oct 13, 2009
    Posts:
    436
    BTW: i got nothing in Packages directory.

    @AcidArrow
    I can't even follow the first instructions, wonder if it is on my side only or an unity bug.
     
  12. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,025
    That's correct.
    You should have at least some packages there. Which version of Unity/LWRP are you using?
     
  13. Paradoks

    Paradoks

    Joined:
    Oct 13, 2009
    Posts:
    436
    unity: 20118.2.4f1
    LWRP: 3.0.0
     
  14. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,025
    LWRP 3.0.0 is outdated, please use a more recent one.

    It will still not work with OnRenerImage, though.
     
  15. Paradoks

    Paradoks

    Joined:
    Oct 13, 2009
    Posts:
    436
    where do i get the more recent one ? i got this with the asset manager.
     
  16. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,025
    There should be something called Package Manager. It allows you to select the version for each package you have installed, and install newer ones. It only shows compatible versions, so it might be that 3.0.0 is the highest usable with Unity 2018.2.4f1.
     
  17. Paradoks

    Paradoks

    Joined:
    Oct 13, 2009
    Posts:
    436
    Ok, i will update.
    But you said :
    and now:
    So once i installed the latest version of unity with the latest version of LWRP.

    How should i do my blit other than with OnRenderImage ?
     
  18. Paradoks

    Paradoks

    Joined:
    Oct 13, 2009
    Posts:
    436
    Ha ha, updated to latest 2018.2.16 - only 3.0.0 LWRP is available lol.
     
  19. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    I believe the latest versions of LWRP are only available when using Unity 2019, which is only just now out as an alpha preview.
     
  20. Paradoks

    Paradoks

    Joined:
    Oct 13, 2009
    Posts:
    436
    So with the latest version 2018.2.16, i can't blit with OnRenderImage, is there an other way with this version to make custom blitt/post process effect ?
     
    Menion-Leah likes this.
  21. andrew-lukasik

    andrew-lukasik

    Joined:
    Jan 31, 2013
    Posts:
    249
    Any more info on this? Writing color with Blit seems to work but sampling render texture always gives me black for some reason

    EDIT: After writing this post I continued to delve into the subject for few days straight and discover it was my mistake :T
     
    Last edited: Apr 27, 2019
  22. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,025
    When do you sample it? On which device and which graphics API? What is the texture format?
     
  23. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,025
    Please submit a bug report :)