Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

► Curved World ◄

Discussion in 'Assets and Asset Store' started by Arkhivrag, Jul 28, 2015.

  1. Cypras

    Cypras

    Joined:
    Oct 25, 2013
    Posts:
    64
    @Arkhivrag Is there a way to have the camera correctly follow a player moving forward on the z axis? I don't want to move the world towards the player, I want to move the player down the track.

    Example would be moving the car in your examples down the road, instead of the moving the road.
     
  2. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,944
    Yes, it is possible. Example is here.
     
  3. silentslack

    silentslack

    Joined:
    Apr 5, 2013
    Posts:
    381
    Hi, I'm attempting to add the Curved World effect to the Bakery URP shader and not sure if I'm getting the expected result.

    Here is my scene without any bend:


    And here is after quite a strong bend is applied:


    As you can see I'm getting quite weird squashing effect. Is this expected? We'd likely not use this extreme bend but of course even on low bend amounts the same issue is happening albeit less exaggerated.

    Here is how my shader graph looks:


    Any help appreciated!
     
  4. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,944
    And how package included shaders behave? Do they have the same bending effect? If yes, then your shader is correct and you have to adjust CW settings.
     
  5. bloomiu

    bloomiu

    Joined:
    Aug 22, 2022
    Posts:
    2
    Is there any way to add this on VRChat? It works fine on Unity but it doesn't work on VRchat..
     
  6. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,944
    What is the problem with VRChat? Does not it allow using custom shaders or scripts?
     
  7. bloomiu

    bloomiu

    Joined:
    Aug 22, 2022
    Posts:
    2
    I'm not sure what's the problem. I think i might have to do something with the camera in VRchat. There is no problem with custom shaders in VRChat but maybe camera is the issue. I might solve this problem someday! Just curious someone solved this problem..
     
  8. codevisionary005

    codevisionary005

    Joined:
    Nov 15, 2021
    Posts:
    17
    I am using the Universal render pipeline in unity 2021.3.8f1(latest LTS) and a custom compute grass shader and to render the grass geometry, I use a .shader file. Now as per in the curved world documentation, under the custom shader(Univeral), I did both the Material properties and Definitions right. But the vertex transformations doesn't work. The grass turns magenta and It gives an error "
    Shader error in 'Custom/GrassComputeHLSL': undeclared identifier 'v' at line 75 (on d3d11)
    ".

    Any thoughts about this? I've been scratching my head on this for hours now.
     

    Attached Files:

    Last edited: Sep 12, 2022
  9. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,944
    'v' is a name of a vertex input variable.
    Your shader may be using other name (for example, it may be input instead of v).

    upload_2022-9-13_10-21-29.png

    Update vertex input variable name inside Curved World methods to be the same as it is declared in your shader.
     
  10. codevisionary005

    codevisionary005

    Joined:
    Nov 15, 2021
    Posts:
    17
    I did what you said and I get 2 errors from one line from the vertex transformation. I get Shader error in
    'Custom/GrassComputeHLSL': 'CurvedWorld_ClassicRunner_X_Positive_ID1': no matching 1 parameter function at line 75 (on d3d11)
    and
    Shader error in 'Custom/GrassComputeHLSL': invalid subscript 'vertex' at line 75 (on d3d11)
    . NewErrorWithGrassShaderCurved.PNG
     
  11. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,944
    Modifying custom hand written shaders by integrating Curved World vertex transformations there, assumes knowledge of shader programing (HLSL) as such cases are outside of the support scope.

    If shader you are trying to modify is from the Asset Store, it is better ask asset developer to make it CW compatible. In this case it will not be necessary to adjust it manually again, when source shaders will be updated or changed by developer.
     
  12. Fletcher-Studios

    Fletcher-Studios

    Joined:
    Sep 25, 2014
    Posts:
    11
    Trying to - it seems to not want to appear in my HMD (Rift S) - I just get the Unity sign 'Loading...' and its running in editor, but I see nothing in VR,
     
  13. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,944
    Would like to know more about this problem. What is not working, CW shaders or scripts?
     
  14. tomworcom

    tomworcom

    Joined:
    Dec 27, 2011
    Posts:
    45
    I updated my project to Unity 2021.3.11f1 LTS and URP - I removed the CW folder and imported the package again through the package manager, latest version.
    There seems to be no "Standard" shader package anymore, it's also not in the "Curved World > Shader packages" tool window. Is there another way to import it?
     
  15. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,944
    Try, clear asset store cache folder and re-download package. Then check Assets/Amazing Assets/Curved World/Installer folder.
     
  16. tomworcom

    tomworcom

    Joined:
    Dec 27, 2011
    Posts:
    45
    I get the Installers, but when I try to install the URP package, the import dialog shows no "Standard" shader under "Amazing Assets > Curved World > Shaders". It's not in the package. Version 2022.4

    [Edit] I also manually deleted all the folders in the Asset store cache and deleted the Curved World folder from my project before importing again.

    The Standard shader package is available in the "Built-In" installer package.
     
  17. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,944
    Standard shader is part of the Built-in render pipeline and it is not available in URP.
    URP package has its own shaders.
     
    tomworcom likes this.
  18. gamesbydre

    gamesbydre

    Joined:
    Nov 25, 2014
    Posts:
    58
    Hey Im using the classic runner shader and everything works, except the camera does not continue following the player once the world starts bending. How can I get the camera to follow the player properly?
     
  19. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,944
    Like this?
     
  20. theonlysake

    theonlysake

    Joined:
    Dec 12, 2019
    Posts:
    4
    Hello! I'm very interested in buying your product but I have a particular use case and I was wondering if your shader could work.

    I'm creating an open-world game on an actual planet, so the player would be able to walk freely on the surface of the planet in any direction. The problem I'm having is that the horizon cuts off far-distance objects unless I were to make the planet very big. Would your shader be able to flatten the planet relative to the direction the camera is facing so that you could see farther in the distance?
     
  21. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,944
    No.
     
  22. tr0ma

    tr0ma

    Joined:
    Dec 4, 2012
    Posts:
    19
    I'm interested in creating a full cylinder out of a plane using the Spiral blend type with an angle set to 360 degrees.

    Is there a way to calculate the right minimum radius to input based on the width of that plane, so that both edges exactly touch each other to form a perfect cylinder?
     
  23. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,944
    There is no formula. Just adjust position of pivot point, rotation center and angle properties to your needs.
     
  24. tr0ma

    tr0ma

    Joined:
    Dec 4, 2012
    Posts:
    19
    Thank you for your answer, I guess I was hoping for some help to find a formula since I would like to do this at runtime, the width of the plane being dynamic, and wanted to get exact contact between the edges visually since objects will be looping from an edge to another through script.
     
    Last edited: Oct 31, 2022
  25. JacobSozap

    JacobSozap

    Joined:
    Oct 28, 2015
    Posts:
    18
    Hey, I have an issue with the camera culling.
    I'm using the "Curved world Camera" script and have set the field of view to 88 (any less and I'm starting to get objects popping in/out at the top corners of the screen).

    The issue is that the camera seems to render a lot of objects "behind the camera" so to speak, in -z (bottom of the screen). I clearly see were the rendering should end (visualize in editor checkbox), but it still renders way beyond that.

    I've checked the Unity stat window while turning on/off objects that look like they are outside the frustum and it is a large amount of triangles that is being unnecessary rendered.

    I'm using the "Little planet Y" bend type.

    Any way to improve this?
     
  26. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,944
    That's correct behavior, purpose of the CurvedWorldCamera script is to extend(override) camera's culling matrix and allow rendering of those objects that are outside of the camera's FOV.
     
  27. JacobSozap

    JacobSozap

    Joined:
    Oct 28, 2015
    Posts:
    18
    Yes, that the frustrum extends beyond the camera I understand, but the main issue is that it renders objects beyond where the frustrum ends (i check this by turning on/off objects beyond the frustrum and seeing the performance stats change).
    All the tiles, props and characters in the image are indivdual objects.

    https://imgur.com/WFUFoXR
     
  28. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,944
    View distance depends on the camera's Far Clipping Plane property. You can adjust it directly from the camera script.
    Also, if objects are static, they may be combined in game mode and if their combined rendering bound box intersects with cameras FOV, they will be included in the rendering.
     
  29. JacobSozap

    JacobSozap

    Joined:
    Oct 28, 2015
    Posts:
    18
    None of the objects are set to static, and their bounding boxes are a long way from the camera fov or culling frustrum.
    Like I said, I can disable individual objects and see in realtime that their triangle count is removed from the total triangle amount.
     
    Last edited: Nov 9, 2022
  30. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,944
    Do any of objects use CurvedWorldBoundBox script?
     
  31. JacobSozap

    JacobSozap

    Joined:
    Oct 28, 2015
    Posts:
    18
    No can that help?
     
  32. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,944
    No.
    Send me your scene as package (maximum simplified) on support e-mail, with asset purchase invoice and I'll check it.
    Also include Unity version you are using, render pipeline and build target.
     
    JacobSozap likes this.
  33. JacobSozap

    JacobSozap

    Joined:
    Oct 28, 2015
    Posts:
    18
    So, I figured out the issue. Shadows. The shadows from the objects were intersecting with the frustum and were therefore rendered.
    Is it possible to rotate the culling frustum independent of the camera? For example, in the image i sent, if the frustum would be rotated up (in x) about -15 degrees we would render less of the unseen objects.
     
  34. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,944
    With included camera script it is not possible. But you can try modify worldToCameraMatrix used on line: 63
     
    JacobSozap likes this.
  35. Liminal-Ridges

    Liminal-Ridges

    Joined:
    Oct 21, 2015
    Posts:
    255
    Can Curved World function without changing the shader in all materials in scene? Some are custom from other assets
     
  36. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,944
    No, it isn't an image effect, but a per-mesh vertex displacement effect.
    Mesh needs to use the Curved World shader to be rendered being bent.
     
  37. Liminal-Ridges

    Liminal-Ridges

    Joined:
    Oct 21, 2015
    Posts:
    255
    So are any of the shaders suitable for water? How can i do that?
     
  38. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,944
    Package doesn't include water shader. You have to integrated CW into any suitable water shader yourself.
    Manual file on page 39 describes all required steps for hand-written shaders and on page 45 for ShaderGraph and Amplify Shader Editor.
     
    Liminal-Ridges likes this.
  39. valentinwinkelmann

    valentinwinkelmann

    Joined:
    Nov 3, 2014
    Posts:
    187
    Is it possible to bend a series of terrains so that they meet again at the top so that I can place them in a stanford torus? If I don't look at the actual terrain (i.e. look up) will there be display errors?
     
  40. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,944
    It is possible.
    curved_world.gif
     
    khos likes this.
  41. thanhle

    thanhle

    Joined:
    May 2, 2013
    Posts:
    162
    @Arkhivrag
    I use URP Shader Graph

    But when i apply 3d objects disappear
    Please help me

    upload_2022-12-4_0-12-38.png ]]

    upload_2022-12-4_0-13-4.png
     
  42. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,944
    Do you have CurvedWorldController script in the scene? If no, then add it.
    Also I'll advice to have several meshes with package included CW shaders in the scene, they will visually help you, to find out if your custom shader works correctly or not.
     
  43. TwentyOneGamesStudio

    TwentyOneGamesStudio

    Joined:
    Jul 10, 2020
    Posts:
    5
    Are they available now?
     
  44. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,944
    Custom curves? No.
     
  45. thanhle

    thanhle

    Joined:
    May 2, 2013
    Posts:
    162
    yes ! i have CurvedWorldController script in the scene

    Now i tested with CW scene :
    THis is not apply
    upload_2022-12-4_21-11-54.png

    Now i apply material urp for the house .... then it disappear

    upload_2022-12-4_21-13-17.png

    I don't know ... what wrong T_T
     
  46. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,944
    Manual file page 44: you have to use position node with object space.
     
    thanhle likes this.
  47. thanhle

    thanhle

    Joined:
    May 2, 2013
    Posts:
    162
    I got it !
     
  48. unity_95402159F21CC1EFA414

    unity_95402159F21CC1EFA414

    Joined:
    Sep 15, 2022
    Posts:
    2
    curve.png
    View attachment 1162665 @Arkhivrag

    Hello. I am trying to simulate a ring-shaped platform.

    So, I made a long straight platform. Then I use Classic Runner (X Positive) mode, and I set the player as the pivot point.

    It looks great as the player moves forward along the platform. It feels like I am walking inside a perfect ring. But behind the player is flat. How can I make it so the player is always at the apex of the curve? Is there a way to mirror the bend?



    You posted this image before. It is exactly the type of world I am trying to create. Like a space Habitat Ring:
    Yes_No.png
     
    Last edited: Dec 8, 2022
  49. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,944
    Try Spiral or Rollout bending effects.
     
  50. unity_95402159F21CC1EFA414

    unity_95402159F21CC1EFA414

    Joined:
    Sep 15, 2022
    Posts:
    2
    I'm not sure how badly I'm going to pay for it later with performance, but I've actually now made duplicates of my environment with the Classic Runner X Negative shader, and that has it looking the way I want. I will try Spiral eventually though thanks!


    Edit: I just realized my plan makes no sense after I add more than just the floor structure. I've been up for too long.

    Edit 2: Spiral Vertical Rolloff is crushing it! I love this tool.
     
    Last edited: Dec 8, 2022