Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  URP Shader Error
#1
(I apologize if there are any flaws or rudeness due to machine translation.)

When I create a new project with "3D(URP)" and import Obi Fluid, I get an error in the following Shader inspector.
If I build on Windows Intel 64bit environment in this state, the fluid that was normally displayed in Editor will not be rendered.

Obi/Resources/ObiMaterials/URP/FluidShaderURP

Code:
Implicit truncation of vector type
Compiling Subshader: 0, Pass: FluidShader, Fragment program with <no keywords>.
Platform defines: SHADER_API_DESKTOP UNITY_ENABLE_DETAIL_NORMALMAP UNITY_ENABLE_REFLECTION_BUFFERS UNITY_LIGHTMAP_FULL_HDR UNITY_LIGHT_ PROBE_PROXY_VOLUME UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BLENDING UNITY_SPECCUBE_BOX_PROJECTION UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_ SHADOWS
Disabled keywords: FLUID_FOAM FLUID_FOAM FLUID_LIGHTING FLUID_REFLECTION FLUID_REFRACTION SHADER_API_GLES30 UNITY_ASTC_NORMALMAP_ENCODING UNITY_COLORSPACE_GAMMA UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_RGBM_ENCODING UNITY_METAL_SHADOWS_USE_POINT_FILTERING unity_no_dxt5nm unity_no_full_standard_shader unity_no_screenspace_shadows unity_pbs_use_brdf2 unity_pbs_use_brdf3 unity_pretransform_to_display_orientation unity_unified_shader_prevention_model UNITY_VIRTUAL_TEXTURING _GLOSSYREFLECTIONS_OFF _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _RECEIVE_SHADOWS_OFF _SHADOWS_SOFT _SPECULARHIGHLIGHTS_OFF _SPECULAR_SETUP


Obi/Resources/ObiMaterials/URP/ParticleShaderURP

Code:
'BuildAuxiliaryNormalVectors': implicit truncation of vector type
Compiling Subshader: 0, Pass: 0 0, Pass: ShadowCaster, Fragment program ShadowCaster, Fragment program with SHADOWS_DEPTH
Platform defines: SHADER_API_DEPTH SHADER_API_DESKTOP UNITY_ENABLE_DETAIL_NORMALMAP UNITY_ENABLE_REFLECTION_BUFFERS UNITY_LIGHTMAP_FULL_HDR UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_PASS_SHADOWCASTER UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BLENDING UNITY_SPECCUBE_BOX_PROJECTION UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS
Disabled keywords:. SHADER_API_GLES30 SHADOWS_CUBE UNITY_ASTC_NORMALMAP_ENCODING UNITY_COLORSPACE_GAMMA UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_RGBM_ENCODING UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_DXT5nm UNITY_NO_FULL_STANDARD_SHADER UNITY_NO_SCREENSPACE_SHADOWS unity_pbs_use_brdf2 unity_pbs_use_brdf3 unity_pretransform_to_display_orientation unity_unified_shader_precision_model unity_virtual_texturing

Obi/Resources/ObiMaterials/URP/SimpleParticleShaderURP

Code:
'BillboardSphereNormals': implicit truncation of vector type
Compiling Subshader: 0, Pass: 0 0, Pass: ShadowCaster, Vertex ShadowCaster, Vertex program with SHADOWS_DEPTH
Platform defines: SHADER_API_DEPTH SHADER_API_DESKTOP UNITY_ENABLE_DETAIL_NORMALMAP UNITY_ENABLE_REFLECTION_BUFFERS UNITY_LIGHTMAP_FULL_HDR UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_PASS_SHADOWCASTER UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BLENDING UNITY_SPECCUBE_BOX_PROJECTION UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS
Disabled keywords: SHADER_API_GLES30 SHADOWS_CUBE UNITY_ASTC_NORMALMAP_ENCODING UNITY_COLORSPACE_GAMMA UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_LIGHTMAP_DLDR_ENCODING ENCODING UNITY_LIGHTMAP_RGBM_ENCODING UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_DXT5nm UNITY_NO_FULL_STANDARD_SHADER SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 UNITY_PBS_USE_BRDF3 UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_UNIFIED_SHADER_PRECISION_ MODEL model unity_virtual_texturing


There were no errors in the following Shader.
  • Obi/Resources/ObiMaterials/FluidThickness
  • Obi/Resources/ObiMaterials/ScreenSpaceCurvature
  • Obi/Resources/ObiMaterials/NormalReconstruction
Other concerns
  • Script Updating Consent" dialog appears when importing Obi Fluid (error did not go away no matter which option was selected).
  • When importing the packages required for Burst in Obi Renderer, a compile error occurs at line 74 of "Obi\Scripts\Common\Backends\Burst\DataStructures\NativeMultilevelGrid.cs" ( (Fixed by setting length to Length).
The version I am using is listed below.
  • Unity 2022.3.5f1
  • Universal RP 14.0.8
  • Core RP Library 14.0.8
  • Obi - Advanced fluids for Unity 6.5.4
  • Burst 1.8.7
  • Mathematics 1.2.6
  • Collections 2.1.4
  • Jobs 0.70.0-preview.7


Attached Files Thumbnail(s)
                   
Reply
#2
(31-07-2023, 11:31 AM)Yumineko Wrote: (I apologize if there are any flaws or rudeness due to machine translation.)

When I create a new project with "3D(URP)" and import Obi Fluid, I get an error in the following Shader inspector.
If I build on Windows Intel 64bit environment in this state, the fluid that was normally displayed in Editor will not be rendered.
Hi!

Implicit truncation warnings aren't a concern, they just mean the compiler will automatically convert a float4 to a float3 (or a float3 to a float2, etc) by ignoring the last component. This will raise a warning in some graphics APIs. As long as there are no errors, the shaders should work.

The only remaining possible cause is that the assets simply aren't being included in the build for some reason. They're within a "Resources" folder so this shouldn't be the case, but let's assume they're not making it into the build. To check this, go to ProjectSettings->Graphics->Always Included Shaders and include these shaders in the list:

Obi/Resources/ObiMaterials/FluidThickness
Obi/Resources/ObiMaterials/ScreenSpaceCurvature
Obi/Resources/ObiMaterials/NormalReconstruction
Obi/Resources/ObiMaterials/URP/FluidShader

Then do a build, see if it makes any difference. In case it doesn't, would you mind sending us your project (or a smaller project that reproduces this issue, in case yours is too large) to support(at)virtualmethodstudio.com so that we can take a closer look? Thanks!

(31-07-2023, 11:31 AM)Yumineko Wrote: Other concerns

Script Updating Consent" dialog appears when importing Obi Fluid (error did not go away no matter which option was selected).

This is not an error, just Unity offering to automatically update imported scripts to use the latest available APIs. Depending on the Unity version used this message might appear, either answer to it is valid.

Obi is designed to be compatible with Unity 2019.4 upwards, so more recent versions might show this message.



(31-07-2023, 11:31 AM)Yumineko Wrote: When importing the packages required for Burst in Obi Renderer, a compile error occurs at line 74 of "Obi\Scripts\Common\Backends\Burst\DataStructures\NativeMultilevelGrid.cs" ( (Fixed by setting length to Length).

Newer versions of the packages might have changed the definition of "length" to "Length", will take a look into it. Updating the capitalization should be enough.

kind regards,
Reply
#3
Hi,

Just answered you via email, but I'm also writing it here in case it's useful for other users.

In newer URP package versions, the tag used to identify URP-only shaders has changed from "UniversalRenderPipeline" to "UniversalPipeline". This will prevent shaders from working in builds using recent URP versions, although they'll work fine in editor (quite sure this is a bug in Unity, as it would stand to reason for the shader to stop working in both editor and builds when using an incorrect tag).

Open up the "Obi/Resources/ObiMaterials/URP/FluidShaderURP.shader"  file, and change this line at the top:

Code:
Tags{"RenderPipeline" = "UniversalRenderPipeline"}

so that it looks like this:

Code:
Tags{"RenderPipeline" = "UniversalPipeline"}

That is, just remove the "Render" word in the tag. Then build your project again, and it should work.
The same applies to any other URP shaders included with Obi, and others you might find around or be part of other assets. I've posted about this in the Unity forums: https://forum.unity.com/threads/renderpi...d.1468196/

Will include this change in the next Obi version.

kind regards,
Reply