Search Unity

Official Hybrid Renderer V2 (0.4.0)

Discussion in 'Graphics for ECS' started by SebastianAaltonen, Mar 16, 2020.

Thread Status:
Not open for further replies.
  1. It's already enabled.

    I'll try to create a new project from scratch with the URP template, maybe I have mis-configured something.

    Update: started a fresh project in 2020.2a11 with URP, the converted entities aren't showing up.
    Editor:
    alpha_edit_mode.PNG

    Play mode:
    alpha_play_mode.PNG

    Update2: Okay, I'm an idiot. I forgot to move the materials to hybrid instanced. Ouch. Although now I have another problem, but my cube shows up.
     
    Last edited by a moderator: May 28, 2020
  2. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    I'm seeing issues with culling and/or corrupted data of some type. Renderers are culled when they are in bounds. WorldRenderBounds is correct. Behavior is not entirely consistent. Sometimes i'ts obvious culling plane issues. Sometimes it appears to be mostly distance. Hard to tell for sure. What makes me think it's corrupted data in BatchRenderGroup somehow is that often shadows are still rendered. One of the same side effects of a BRG bug I filed previously.
     
  3. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,117
    Is it possible to disable Hybrid Renderer package when converting a scene ?
    If it's not please add it it's really more practical than having to remove the package each time i want to build a subscene for a headless Server.
     
    Last edited: May 29, 2020
  4. brunocoimbra

    brunocoimbra

    Joined:
    Sep 2, 2015
    Posts:
    679
    Never tried, but won't the Build Configuration component "ConversionSystemFilterSettings" be useful there? It is used on Tiny to remove the Hybrid Renderer package stuff.
     
    Opeth001 likes this.
  5. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,117
    how does ConversionSystemFilterSettings work?
    does it convert all the sub-scenes included in the scenes linked to the construction configuration?
    how to exclude a package from ConversionSystemFilterSettings, do i have to exclude all it's Assemblies ?

    any link to documentation / example will be appreciated
     
  6. brunocoimbra

    brunocoimbra

    Joined:
    Sep 2, 2015
    Posts:
    679
    There is an array named ExcludedConversionSystemAssemblies, just assign there all assemblies with GameObjectConversionSystems that should be ignored. As far as I know, you can't disable for a single sub-scene, so it will disable for your entire build using that BuildConfiguration component.
     
    Opeth001 likes this.
  7. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,117
    so at while building the player all subscenes will be reconverted right ?
    is there a way to check if an actuall package is excluded from a build ?
     
  8. brunocoimbra

    brunocoimbra

    Joined:
    Sep 2, 2015
    Posts:
    679
    AFAIK yes, sub-scenes are always re-converted during the build process. I don't know what you mean by "check if an actual package is excluded", but you can use reflection to see if some class exist or not.
     
    Opeth001 likes this.
  9. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,117
  10. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    Where this samples could be found?
     
  11. Zylkowski_a

    Zylkowski_a

    Joined:
    Jul 27, 2019
    Posts:
    157
    How to change which uvs are used for rendering without changing whole material uvs?
     
  12. Stroustrup

    Stroustrup

    Joined:
    May 18, 2020
    Posts:
    142
    if you were to change from hdrp to urp at runtime, would hybrid renderer components change accordingly?
     
  13. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    723
    @Stroustrup as far as I know you cannot do that currently as HDRP and URP are exclusively and incompatible and may currently not exist in the same project at the same time.
     
  14. Stroustrup

    Stroustrup

    Joined:
    May 18, 2020
    Posts:
    142
    what? of course you can, just get both the urp and hdrp package.
    then you can add an option in the game settings menu to change GraphicsSettings.renderPipelineAsset = urp/hdrp pipeline asset

    if you use a shader made in shadergraph as your default shader for everything, they will work in both render pipelines by default without turning purple and you having to manually change shaders for each material with materal.Shader = Shader.find("default hdrp / urp")

    though i still do that for glass as hdrp glass has extra features and looks nice

    for everything else, there is no visual difference if you don't use stuff like subsurface scattering for hdrp. also its useful to have a shadergraph shader as default because then you can turn on pre prepared effects when the player does something like take shrooms
     
    Last edited: May 31, 2020
    KwahuNashoba and MNNoxMortem like this.
  15. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    723
    @Stroustrup that is great to hear. I could have sworn it was not possible to do that in the early days when it was still named HDRP and LDRP and that we ran into compatibility issues with WebGL were we wanted LDRP and standalone where we would have liked to switch (see this - edit: which does not state it's impossible but tricky, to be correct). It is an obvious use case for me. I am happy to stand corrected in this case.
     
    Last edited: May 31, 2020
  16. Nothke

    Nothke

    Joined:
    Dec 2, 2012
    Posts:
    112
    There seems to be a problem with emissive materials in HDRP (Lit shader). When converted to Entities, emission disappears. (Using latest versions of all packages)

    In editor: Left, GameObject; Right, GameObject with ConvertToEntity (or in subscene, both behave the same)

    upload_2020-5-31_20-47-29.png

    In play mode:

    upload_2020-5-31_20-48-13.png

    Material properties:

    ev.jpg

    Tried with EV100, Nits, or HDR color, same result
     
  17. Zec_

    Zec_

    Joined:
    Feb 9, 2017
    Posts:
    148
    We're experiencing these issues too after upgrading to HDRP 9.0.0 preview13 and enabling hybrid renderer v2. This occurs both for models drawn through the standard HybridRendererSystem, as well as through a custom renderer we've made that purely uses the BatchedRenderer API.

    All instances of models with the same material seems to get culled/flicker together. At certain camera locations, we can see models, but if we just nudge the camera slightly to one side we are only left with shadows on the ground.
    upload_2020-6-1_16-50-58.png

    We upgraded from HDRP 8.0.1. In addition to that, we're using the following releases:
    • Unity 2020.1.0b4
    • Entities 0.11
    • Hybrid Renderer 0.5.1 preview 18
    Does any known fixes exist? I can't find anything in the thread, but I guess it doesn't hurt to ask. If you get any updates on your ticket @snacktime , I'd love to hear about it!
     
    Last edited: Jun 1, 2020
  18. tylo

    tylo

    Joined:
    Dec 7, 2009
    Posts:
    154
    I know this post is from a long time ago, but @vildauget you can create a TextureArray asset, and then use a float value to determine which array slot to use. All of your height map textures will need to be the same height/width/compression to be used in a TextureArray, and you'll also need to either manually edit a shader to support them or use the texture array nodes in Shader Graph.
     
    vildauget likes this.
  19. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    No changes on our ticket yet, and we keep seeing new ways rendering goes wrong almost daily. From culling to things getting rendered at camera position to stuff rendering up in the sky.
     
  20. Just a quick heads up: in 2020.2a12 everything is working without any hacks. 9.0 URP Hybrid V2.
    answer.PNG
    Something with the placement of the element is not right though. But I guess this is because they are a prefab and some calculations are off there. Like the item stuck in the wall on the right. It's not intentional, the entities/convert/hybrid renderer does it. It's the top of the workbench, so it's a duplicate.
     
    colin_young likes this.
  21. Stroustrup

    Stroustrup

    Joined:
    May 18, 2020
    Posts:
    142
    i still get errors like lights not working when converted to entities with the metal backend
     

    Attached Files:

    Last edited: Jun 3, 2020
  22. Stroustrup

    Stroustrup

    Joined:
    May 18, 2020
    Posts:
    142
    surprised to find out that the hybrid renderer works with light probes.
    is there any way however to chose which probes to interpolate between? something like anchor override

     

    Attached Files:

  23. Orimay

    Orimay

    Joined:
    Nov 16, 2012
    Posts:
    304
    Whenever I try to convert a mesh to an entity, regardless of if its material, it doesn't appear, unless I pick wireframe option in the scene view. The entities appear for the RenderMeshSystemv2, and it seems to be working, just not showing anything in the shaded mode. Is there a way to fix it? The packages I have for rendering:

    Core RP Library 8.1.0
    Universal RP 8.1.0
    Entities 0.9.1-preview.15
    HybridRenderer 0.4.2-preview.16


    I wish I could upgrade Entities and HybridRenderer, but I can't, since I also use Unity NetCode 0.1.0-preview.6, that is not compatible with the latest versions of Entities :(
     
  24. colin_young

    colin_young

    Joined:
    Jun 1, 2017
    Posts:
    243
    Attempting to use v2 makes my entities invisible. If I switch back to hybrid renderer v1 the entities are visible.

    I am creating the entities by instantiating prefabs. The prefabs were created by converting from GameObjects. All my static content (terrain, roads, parked vehicles, etc.) are visible, but the entities I spawn (which are derived from the same GameObjects as the static, visible, items, using the same materials) are not.

    Unity 2020.1.0b11
    Core RP 9.0.0-preview.13
    Entities 0.11.0-preview.7
    Hybrid Renderer 0.5.1-preview.18
    URP 9.0.0-preview.14
     
  25. nicolasgramlich

    nicolasgramlich

    Joined:
    Sep 21, 2017
    Posts:
    231
    Do you have the SRP Batcher enabled?
     
  26. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,117
    Are there plans for mobile support?
    btw: I have better performance for the same scene when using the hybrid renderer V1 than V2 is this normal?
     
  27. colin_young

    colin_young

    Joined:
    Jun 1, 2017
    Posts:
    243
    Yeah, should have mentioned that. Assuming that's the one that you enable on the UniversalRenderPipelineAsset under Advanced. I saw your post about that, and was hopeful, but those hopes were quickly dashed. I'm seeing a lot of MovedFrom("UnityEngine.Rendering.LWRP") in that script, is that expected if I'm using the latest URP? Or could I have a old version? Going to try to delete and re-add it to make sure.
     
  28. colin_young

    colin_young

    Joined:
    Jun 1, 2017
    Posts:
    243
    So... it turns out that I did have the latest URP, but I wasn't using it in Project Settings/Graphics. I instead was using the Crest Ocean Sample URP (leftover from some experiments a couple months ago). I switched that to the correct asset and I can now see my entities.

    On the other hand, the movement is very jerky. Not like a low framerate, but actually moving backward and forward when it should only be moving forward.
     
  29. Cell-i-Zenit

    Cell-i-Zenit

    Joined:
    Mar 11, 2016
    Posts:
    290
    Did they change something with position calculation?

    on version 0.4.2 everything is in the correct place, but using the newest 0.5.1 version, everything is not in the correct place ...

    EDIT: iam using the normal converting api as they suggested:

    GameObjectConversionUtility.ConvertGameObjectHierarchy(Resources.Load<GameObject>("cube"),
    settings);
     
  30. EduardoLauer

    EduardoLauer

    Joined:
    Jun 10, 2013
    Posts:
    8
    I searched for this samples but didn't find anything.


     
    cultureulterior likes this.
  31. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    As far as I know nothing has changed in the way Hybrid Renderer treats positions. The most typical case we have seen where objects are rendered out of position is when objects are rendered to the origin instead of their actual position, and this problem is usually caused by the shader being incompatible with Hybrid V2.
     
  32. gamedolphin

    gamedolphin

    Joined:
    Jan 29, 2016
    Posts:
    3
    Hey! Thank you for being so active answering our questions! :)

    I am unable to figure out why it looks different in the scene and the game when using hybrid renderer v2. I think it might be the skybox lighting. This is a cube using URP/Lit shader placed inside a subscene.



     

    Attached Files:

  33. Stroustrup

    Stroustrup

    Joined:
    May 18, 2020
    Posts:
    142
    looks like one is using light probes and the other isn't
     
  34. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    Ambient lighting is not supported in the currently released Hybrid V2 version, and could indeed explain the difference here. It is being actively worked on and support for it should hopefully be coming soon.
     
  35. Stroustrup

    Stroustrup

    Joined:
    May 18, 2020
    Posts:
    142
    how do you access the material block property. i need to manually choose which lightprobes to iterpolate between

    something like this but in ecs.
    Code (CSharp):
    1. MaterialPropertyBlock materialPropertyBlock = new MaterialPropertyBlock();
    2. materialPropertyBlock.CopyProbeOcclusionArrayFrom(...);
    3. materialPropertyBlock.CopySHCoefficientArraysFrom(...);
    4.  
    5. meshRenderer.GetPropertyBlock(materialPropertyBlock);

    guessing something like this but for probes?
    Code (CSharp):
    1. [Serializable]
    2. [MaterialProperty("_Color", MaterialPropertyFormat.Float4)]
    3. public struct MaterialColor : IComponentData
    4. {
    5.     public float4 Value;
    6. }
     
  36. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    Hybrid V2 defines the following ECS components that you can use to manually set light probe behavior:
    BuiltinMaterialPropertyUnity_ProbesOcclusion
    BuiltinMaterialPropertyUnity_SHAr
    BuiltinMaterialPropertyUnity_SHAg
    BuiltinMaterialPropertyUnity_SHAb
    BuiltinMaterialPropertyUnity_SHBr
    BuiltinMaterialPropertyUnity_SHBg
    BuiltinMaterialPropertyUnity_SHBb
    BuiltinMaterialPropertyUnity_SHC
     
  37. Stroustrup

    Stroustrup

    Joined:
    May 18, 2020
    Posts:
    142
    amazing, is there any documentation on this? what each property stands for and what value type it contains
     
  38. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    Unfortunately, there is no documentation for this currently, these components just expose directly the values that the shaders are using to evaluate ambient lighting internally. I think they might correspond to "occlusionProbes" and "lightProbes" in https://docs.unity3d.com/2020.1/Doc...ulateInterpolatedLightAndOcclusionProbes.html. However, I don't know all the related details here, so this might be inaccurate.
     
    andywatts likes this.
  39. gamedolphin

    gamedolphin

    Joined:
    Jan 29, 2016
    Posts:
    3
    Thank you for letting me know. Is there a timeline for this? :)
     
    elJoel likes this.
  40. Cell-i-Zenit

    Cell-i-Zenit

    Joined:
    Mar 11, 2016
    Posts:
    290
    I found that my vertex offsets dont work correctly:

    upload_2020-6-8_20-53-25.png

    Anyone can help me?

    Dont wonder why the add is empty, i applied there a small offset, but for simplicity sake i removed it for now.

    in 0.4.2 i correctly set the vertex position like this,
    in 0.5.1 it doesnt work anymore
     
  41. elJoel

    elJoel

    Joined:
    Sep 7, 2016
    Posts:
    125
    Yeah are we talking weeks or months?
     
    Nothke likes this.
  42. Nothke

    Nothke

    Joined:
    Dec 2, 2012
    Posts:
    112
    About previous problem with emissive materials, browsing the hybrid renderer source and I noticed there is "HDRPMaterialPropertyEmissiveColor". Turns out it doesn't get added automatically by ConvertToEntity. I had to add it myself, and type in the values. I noticed that "MeshRendererConversion" does not have any of the HDRP components. I guess there's a plan to do this?

    Also, some kind of shortcut method to automatically get all the needed components for the material would be great. Previously, we only needed RenderMesh, and RenderBounds, so spawning objects from script was easy. But as now there's a plethora of components, we'd need to manually add each, a shortcut method would be nice. Also we wouldn't need to maintain the method to stay up to date, Unity would need to do it for us :p

    Something like
    AddMaterialPropertyComponents(entityManager, entity, material);
     
  43. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    Yes you need to add all components that you need manually. Adding all properties automatically would be waste of chunk space.
     
  44. It maybe a super-dumb question, but is it possible to set the culling somehow less aggressive without writing my own?
    I'm playing around with the idea of a boardgame-like setup and the individual pieces of the board get culled immediately when some of the parts get out of camera. If I'm just ignorant, could someone turn me into direction and give me some advice where can I read about this?
    Eventually these pieces will be organized into chunks, then the problem will be even more apparent, because more could be missing.

    answer.PNG
     
  45. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    This shouldn't be happening with a default setup using entity conversion. It only culls renderers completely outside of the culling planes.

    Maybe a mesh with invalid bounds? There are some more advanced scenarios where culling is bugged but I've only seen that with moving renderers and/or enabling/disabling renderers. Doesn't mean you couldn't have hit another one V2 is pretty buggy overall right now.
     
    Lurking-Ninja likes this.
  46. Probably I calculated wrong bounds then, because this is not a conversion, everything is spawned in code. Even the mesh. :) I need to double-check my bounds then. Thanks, somehow this didn't appear to me.

    Edit: and that was it. Not just calculated wrong, I forgot to plug it in, so I spawned my entities without AABB.
     
    Last edited by a moderator: Jun 15, 2020
  47. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    This should only be necessary if you want to override the emissive color separately for the entity. In cases where you are happy with the emissive value set in the Material, this component should not be necessary, and the entity should render with the value in the Material.

    The reason why these components are not added by default is because adding additional components to entities costs both memory and runtime performance, so it's recommended to do it only when necessary (when you need per-entity control for the emissive value).
     
  48. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    700
    When I switch from V2 to V1, my entities go totally disco. I can dig it. (not really ;))



    Oddly enough, this is across unity restarts. (I used to have glitches before when switching renderers, but they were not persistent)

    Also, there's intermittent crashing whenever I touch the ENABLE_HYBRID_RENDERER_V2 define.
     
    Antypodish likes this.
  49. elJoel

    elJoel

    Joined:
    Sep 7, 2016
    Posts:
    125
    Try setting this in the HybridV2RenderSystem.cs file.
     
  50. Nothke

    Nothke

    Joined:
    Dec 2, 2012
    Posts:
    112
    If you read my original post, I mention that it doesn't work as you just said it should. If I have a HDRP lit material with emission on, and hit play, the emission gets removed (either with ConvertToEntity or in the subscene). The only way it will work is if I add the HDRPMaterialPropertyEmissiveColor manually.

    if you say it should work then it's a bug I guess?
     
Thread Status:
Not open for further replies.