Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Obi fluid + Quest 2 | Rendering in editor but not when making a build
#1
Triste 
Hello again,

I am still testing the asset with the Oculus Quest 2 and I got new mistakes that I am not able to fix.

First of all, I got it to render with Quest 2 using the Unity editor (with oculus link) and it works fine. I am using URP (7.5.3 version) and 2019.4.14f1 version of Unity. I am also using HPTK asset (https://github.com/jorgejgnz/HPTK) in the scene for making the interaction with objects and hand tracking easier and better.

So, as I said, I got it to work with he unity editor when using my Quest, but when I make a build and try it, some materials appear pink and the obi fluid isn't rendering.

I got three shader error on the console when making the build, and I think that maybe it is because of that. The shader and the error are:

Shader error in 'Obi/URP/Particles': failed to open source file: 'Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl' at Assets/Obi/Resources/ObiMaterials/URP/ObiLightingURP.cginc(4) (on d3d11)

Compiling Vertex program
Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR



Shader error in 'Obi/URP/Fluid/FluidShading': failed to open source file: 'Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl' at Assets/Obi/Resources/ObiMaterials/URP/ObiLightingURP.cginc(4) (on d3d11)

Compiling Vertex program
Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR


Shader error in 'Hidden/ScreenSpaceCurvatureFlow': undeclared identifier 'sampler_MainTex' at line 57 (on d3d11)

Compiling Vertex program with STEREO_INSTANCING_ON
Platform defines: UNITY_NO_DXT5nm UNITY_ENABLE_REFLECTION_BUFFERS UNITY_NO_CUBEMAP_ARRAY UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHTMAP_DLDR_ENCODING
Reply
#2
Hi there,

Check that "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" exists in your project. If you've installed URP, it should be there.

Pink materials in Unity always mean the shader used can't compile for the pipeline you're using. These are common SRP errors, not directly related to Obi. Often they're related to URP/HDRP installation issues. See:
https://dawnarc.com/2019/12/unitysolutio...on-issues/
https://forum.unity.com/threads/errors-w...te.515500/

let me know if I can be of further help,

kind regards
Reply
#3
(11-05-2021, 07:50 AM)josemendez Wrote: Hi there,

Check that "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" exists in your project. If you've installed URP, it should be there.

Pink materials in Unity always mean the shader used can't compile for the pipeline you're using. These are common SRP errors, not directly related to Obi. Often they're related to URP/HDRP installation issues. See:
https://dawnarc.com/2019/12/unitysolutio...on-issues/
https://forum.unity.com/threads/errors-w...te.515500/

let me know if I can be of further help,

kind regards

Yes! It is there... I think I found a solution to the first part of my question (which is that I wasn't able to see the fluid when making the build but it was possible to see it on the editor), and I changed the Stereo Rendering Mode to Multipass instead of Multivew when making the build, and then it worked... but can't fix the pink materials.
Reply
#4
(11-05-2021, 08:13 AM)alpaib Wrote: Yes! It is there... I think I found a solution to the first part of my question (which is that I wasn't able to see the fluid when making the build but it was possible to see it on the editor), and I changed the Stereo Rendering Mode to Multipass instead of Multivew when making the build, and then it worked... but can't fix the pink materials.

Hi there,

Fluid rendering does not support single-pass stereo rendering (as mentioned in the FAQ and manual) so Multipass is required.

As for the pink materials, Unity will shade pink any materials that can't be rendered for whatever reason (can't compile, missing from the build, etc). What shader(s) are these materials using?
Reply
#5
(11-05-2021, 08:37 AM)josemendez Wrote: Hi there,

Fluid rendering does not support single-pass stereo rendering (as mentioned in the FAQ and manual) so Multipass is required.

As for the pink materials, this is always a symptom that the shader used is not compatible with your current rendering pipeline. Unity will shade pink any materials that can't be rendered for whatever reason (can't compile, missing from the build, etc). What shader(s) are these materials using?

Well, actually I think I can look for the solution for the pink materials because, as you said, it is not something about Obi Fluid. But, the error that doesn't let me make the build is actually one of your asset, called ScreenSpaceCurvatureFlow.shader, so I deleted it and I am able to make the build and see the fluid, but the color is black.
Reply
#6
(11-05-2021, 08:42 AM)alpaib Wrote: Well, actually I think I can look for the solution for the pink materials because, as you said, it is not something about Obi Fluid. But, the error that doesn't let me make the build is actually one of your asset, called ScreenSpaceCurvatureFlow.shader, so I deleted it and I am able to make the build and see the fluid, but the color is black.

Hi,

That shader is a core part of fluid rendering, if you delete it rendering will stop working.

Did you try my suggestion on the other thread? copying it here for convenience:

Quote:Edit: can you try changing the declaration in Assets/Obi/Resources/ObiMaterials/ScreenSpaceCurvatureFlow.shader line 44 from

Code:
sampler2D_float _MainTex;

to

Code:
UNITY_DECLARE_DEPTH_TEXTURE(_MainTex);

?
Reply
#7
(11-05-2021, 08:42 AM)alpaib Wrote: Well, actually I think I can look for the solution for the pink materials because, as you said, it is not something about Obi Fluid. But, the error that doesn't let me make the build is actually one of your asset, called ScreenSpaceCurvatureFlow.shader, so I deleted it and I am able to make the build and see the fluid, but the color is black.

So the shader error is,

Shader error in 'Hidden/ScreenSpaceCurvatureFlow': undeclared identifier 'sampler_MainTex' at line 56 (on gles3)

And the lines are these ones:

sampler2D_float _MainTex;
float4 _MainTex_TexelSize;
float _BlurScale;
float _BlurRadiusWorldspace;

float4 frag (v2f i) : SV_Target
{
float maxBlurRadius = 8.0;
float blurDepthFalloff = 5.5;

//discontinuities between different tap counts are visible. to avoid this we
//use fractional contributions between #taps = ceil(radius) and floor(radius)

float depth = Z2EyeDepth(SAMPLE_DEPTH_TEXTURE(_MainTex, i.uv));

The last one is the line 56.
Reply
#8
Hi,

Please try what I suggested before. Replace sampler2D_float _MainTex; with UNITY_DECLARE_DEPTH_TEXTURE(_MainTex);

Let me know if this works.
Reply
#9
(11-05-2021, 08:47 AM)josemendez Wrote: Hi,

Please try what I suggested before. Replace sampler2D_float _MainTex; with UNITY_DECLARE_DEPTH_TEXTURE(_MainTex);

Let me know if this works.

It works! Thank you very much again for your attention.
Reply
#10
You're welcome Sonrisa

Let me know if I can be of further help.
Reply