Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  [Resolved] (Android/Unity) The Obi Fluid Renderer kill the performance.
#4
(28-06-2019, 11:16 AM)Suryavarman Wrote: Just adding the Write Depth on the simple shader ... doesn't work on the android. The particles have no rendering.

Code:
Shader "Toto/Fluid/Simple3DFluid"
{
    Properties
    {
        _MainTex ("Texture", 2D) = "white" {}
        _RefractionCoeff ("Refraction", Range (-0.1, 0.1)) = 0.01
        _Color ("Fluid color", Color) = (0.3,0.6,1,1)
    }

    SubShader
   {
        Cull Back
        ZWrite On
        ZTest LEqual

       Pass
       {
           Name "Simple3DFluid"
           Tags {"LightMode" = "ForwardBase"}
            Offset 1, 1

           Blend SrcAlpha OneMinusSrcAlpha

           CGPROGRAM
           #pragma vertex vert
           #pragma fragment frag
           //#pragma target 3.0

            #include "../Obi/Resources/ObiMaterials/ObiParticles.cginc"

...


Code:
Shader "Toto/Simple 3D Particles" {

Properties {
    _Color         ("Particle color", Color) = (1,1,1,1)
}

    SubShader
    {
        Cull Back
        ZWrite On
        ZTest LEqual

        Pass
        {
            Name "ParticleFwdBase"
            Tags {"Queue"="Geometry" "IgnoreProjector"="True" "RenderType"="Opaque" "LightMode" = "ForwardBase"}
            Blend SrcAlpha OneMinusSrcAlpha  

            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #pragma fragmentoption ARB_precision_hint_fastest

            #pragma multi_compile_fwdbase nolightmap

            #include "../Obi/Resources/ObiMaterials/ObiParticles.cginc"

Hi,

I don't see where you're adding depth RenderTexture to the renderer, reading from or writing to it in the shaders.. you've just added a ZWrite flag on two shaders, but that won't make your renderer work with depth automagically.

Read about how RenderTextures work in conjunction with shaders, and take the FluidRenderer's UpdateFluidRenderingCommandBuffer() implementation as reference on how to set up your buffers, and how to cull fragments in a fragment shader when they're occluded by scene geometry, based on what you read from the depth buffer.
Reply


Messages In This Thread
RE: [Android][Unity] The Obi Fluid Renderer kill the performance. - by josemendez - 28-06-2019, 11:36 AM