Search Unity

► Curved World ◄

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

  1. rerwandi

    rerwandi

    Joined:
    Dec 8, 2014
    Posts:
    536
    is it included in demo ? or i should make invisible portal like someone else's mentions ?
     
  2. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,734
    'Infinity sphere' means that you can not make 360 degree and come at starting point. It is never ending spherical effect.
    Curved World can bend mesh but it is not real 3d sphere.
    It's just an 'illusion'. And that's the point of Curved World.
    'Portal' was misunderstanding, such thing is not included and is not even planed.



    VacuumShaders - Facebook Twitter YouTube
     
  3. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,734
    Update v2.12
    • VacuumShaders assets synchronization. Required update for all VacuumShaders assets.
    • Improved CustumShaders.pdf doc file.
    • T4M asset is deprecated by Unity. Same is T4M shaders included in Curved World. They will be removed in the next update.



    VacuumShaders - Facebook Twitter YouTube
     
  4. Sandstorm

    Sandstorm

    Joined:
    Nov 24, 2012
    Posts:
    4
    Hi, I have recently purchased this fantastic asset but I have now bumped into a small problem : Raycasting.
    Do you provide some raycast extension / math to convert raycast point to curved point?

    I need the correct representation of the rendered coordinate.

    Edit: And I do understand that the shader only handles the rendering, so the mesh collider is still the normal shape, thus the raycast "fails". I still hope you have a suggestion for a solution :)
     

    Attached Files:

  5. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,734
    Curved World API has function for converting real world Vector3 point into 'bend version'.
    TransformPoint() - Check API.pdf file inside doc folder.
    Also check example scene - '3. Little Planet: Deferred Rendering, Physics and NavMesh' - there is usage of that function for updating physics colliders and point lights position.



    VacuumShaders - Facebook Twitter YouTube
     
  6. Sandstorm

    Sandstorm

    Joined:
    Nov 24, 2012
    Posts:
    4
    Thanks, I tried using TransformPosition now, but it doesn't work as intended. I tried writing out the values, and there seems to only be a change in the Y component:

    My camera is located at approx: 250 Y (depending on terrain), so that fits.
    Pivot point : (0.6, 250.4, 0.5)
    However as you can see, it only changes the Y component, which is really the only part I wouldn't expect to change.
    Hit point : (62.6, 45.7, -26.2), Curved world transform point : (62.6, 27.4, -26.2)

    So based on this, I think I'm using the TransformPoint wrong or it can't be used for raycasting purposes.

    Are you suggesting that I instead move the y-position of the collider? (In the demo scene, the light is moved, which I can't really see a way to apply to raycasting logic). Edit: I dont even think its possible to offset a terrain collider :/
     
  7. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,734
    Seems you are using it wrong way, but I can not help, because it's your code and logic and you better know what you are doing (or want to achieve).
    All the TransformPoint() function does - convert world's Vector3 point into Curved World 'bend version'.
    You can transform just one point (pivot point of object or center of mass, or what ever you want) or iterate through all mesh vertices and bend it using script on CPU instead of using shader.



    VacuumShaders - Facebook Twitter YouTube
     
  8. Sandstorm

    Sandstorm

    Joined:
    Nov 24, 2012
    Posts:
    4
    Okay, it was worth a shot. Thanks anyway :)

    I guess I'll try to dig into the shaders and attempt to write my own Raycast extension that works similarly (but opposite) of the TransformPoint method.
     
  9. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,734
    Better transform position of collider and then use normal(original) Raycast.
    That's why I suggested to have a look at - 3. Little Planet: Deferred Rendering, Physics and NavMesh - colliders positions there are updated to reflect Curved World's transformation and normal Raycast can be used on them without problem.



    VacuumShaders - Facebook Twitter YouTube
     
  10. Sandstorm

    Sandstorm

    Joined:
    Nov 24, 2012
    Posts:
    4
    Transforming the collider doesn't help. I tried transforming the collider and doing a new raycast but that doesnt do any good. It really only moves my raycast closer to the ground.
    I've tried drawing it, but I don't know how else to explain it.
     

    Attached Files:

  11. Jono-B

    Jono-B

    Joined:
    Jan 30, 2014
    Posts:
    5
    Hi,
    I don't know where to post this, as the Curved World 1 threads are closed, I realise that Curved World 2 is what is officially supporting Unity 5, but I thought someone might know a workaround for a bug with Unity we're experiencing.

    We're using Curved World 1 in Unity 5, and the shader works fine on the whole, except it doesn't compile on Adreno 320 Android devices (Samsung S5, Xperia Z2).
    This looks to us like a bug with Unity, and I have filed an issue (744987) but with a release date looming, I thought it'd be worth checking here in-case there is a workaround.

    The compiled shader code when view in the Unity Editor is attached

    The error from the device logs when ran on Adreno 320 devices is:
    ERROR: 0:152: 'assign' : cannot convert from '2-component vector of float' to '4-component vector of float'

    Problem line in generated shader code:
    vs_TEXCOORD1 = phase0_Output0_2.x;

    where the variables are:
    out mediump float vs_TEXCOORD1;
    mediump vec4 phase0_Output0_2;

    Sorry if there is a better place to post this!
     

    Attached Files:

  12. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,734
    What's the shader name and what optional parameters are checked ON?



    VacuumShaders - Facebook Twitter YouTube
     
    Last edited: Nov 16, 2015
  13. mikedolan03

    mikedolan03

    Joined:
    Oct 28, 2013
    Posts:
    14
    Hi, I am trying to write a script to access the API and change the Bend variables at runtime. I can't seem to get the namespace to work for me, but it could be that I don't really know how to access namespaces properly? Can't seem to access SetBend or the public bend variables. Do you have any example scripts to modify the vars at runtime?
     
  14. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,734
    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. using VacuumShaders.CurvedWorld;    //!!!
    6.  
    7. public class NewBehaviourScript : MonoBehaviour
    8. {
    9.  
    10.     public float xAxisBendSize;
    11.     public float yAxisBendSize;
    12.  
    13.  
    14.     void Update ()
    15.     {
    16.         //Getting reference to the existing in the scene CurvedWorld_Controller script.
    17.         if (CurvedWorld_Controller.get != null)
    18.         {
    19.             CurvedWorld_Controller.get._V_CW_Bend_X = xAxisBendSize;
    20.             CurvedWorld_Controller.get._V_CW_Bend_Y = yAxisBendSize;
    21.         }
    22.     }
    23. }
    24.  
    Check API.pdf file inside Doc folder.



    VacuumShaders - Facebook Twitter YouTube
     
    mikedolan03 likes this.
  15. mikedolan03

    mikedolan03

    Joined:
    Oct 28, 2013
    Posts:
    14
    Was missing the .get. ! Gracias! I am too used to Unity namespaces I think. This is a very cool asset!
     
  16. steddyman

    steddyman

    Joined:
    Apr 10, 2009
    Posts:
    253
    Hi. This looks a top quality product so I have bought it, even if there is a chance it can't fit my current needs.

    I want to create a tower climbing game, but the intricacies of building levels around a tower are horrific for quick level design. I was hoping to use this shader in the Perspective 2D mode to wrap a plane with obstacles placed on a grid around a tower.

    However I want to be able to run all the way around the tower and for it to seamlessly then move from one side of the 2d plane to the other. Similar to the old Amiga game Nebulous (I also would like tunnels through the tower which is a harder problem).

    Is there anyway I could use this asset to perform that function for me in either its current form or in a modified form? Then I could just design my levels in 2D on a grid, click Play and it would then build the tower for me? Ideally you should set the world points or size at which it joins the ends of the plane together.

    PS I also posted this question on your Facebook page earlier today.

    Thanks
     
  17. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,734
    Curved World creates never ending curvature effect. It can not convert plane to sphere or cylinder where you can rotate on orbit on 360 degree and return to starting point.
    As for Nebulous game, I think it does not need any special shaders, it can be achieved with script rotating 'world' while character always stays in the camera center.



    VacuumShaders - Facebook Twitter YouTube
     
  18. steddyman

    steddyman

    Joined:
    Apr 10, 2009
    Posts:
    253
    That's a great idea. That will work. Thanks for the suggestion.
     
  19. steddyman

    steddyman

    Joined:
    Apr 10, 2009
    Posts:
    253
    I have another question.... I need my player to be able to climb the tower. However when I extend the sample scene grid to double the height, the view on screen cuts off the top and bottom so you only see 16 rows of the grid no matter how tall it is.

    Is there a way to adapt the shader or settings so it extends off the top and bottom of the screen?
     
  20. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,734
    Use Unity 5.2.2p2 and EagleEye script on active camera. Meshes that go beyond camera view frustum are culled before Curved World bends them. EagleEye script will fix it.




    VacuumShaders - Facebook Twitter YouTube
     
  21. steddyman

    steddyman

    Joined:
    Apr 10, 2009
    Posts:
    253
    I am doing that. I am just using your example perspective 2d scene. I have copied the top two rows of your grid and pasted it multiple times above, so it is now twice the height. The Game View still shows a hard cull at the top and bottom after 16 grid spaces.

    I have attached a screenshot for example:
     
  22. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,734
    Do not confirm. At my side everything works as supposed.
    Use Unity 5.2.2p2
    In earlier versions EagleEye script does not work and some objects may disappear.
    CW.png



    VacuumShaders - Facebook Twitter YouTube
     
  23. steddyman

    steddyman

    Joined:
    Apr 10, 2009
    Posts:
    253
    Ok. I am on 5.2.0f3. Does your component work with the latest 4.3 beta?
     
  24. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,734
  25. steddyman

    steddyman

    Joined:
    Apr 10, 2009
    Posts:
    253
    Thanks. I did of course mean the latest 5.3 beta (f1). I've tested and it works fine in that beta and in 5.2.3.
     
    Last edited: Nov 20, 2015
  26. steddyman

    steddyman

    Joined:
    Apr 10, 2009
    Posts:
    253
    Is there any way at all this could be done without shifting all the tiles but just moving the player? Reason I ask is it makes for much worse performance that way. I've quite a few games where I keep the camera and player still and move everything else and it always creates its own problems.
     
  27. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,734
    It depends on your game design. You know better. All I can help is with Curved World.



    VacuumShaders - Facebook Twitter YouTube
     
  28. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,734
    If particles are not rendered correctly in Unity 5.3, disable Use With Particle System option inside material editor.
    p.png



    VacuumShaders - Facebook Twitter YouTube
     
  29. Linebecks

    Linebecks

    Joined:
    Oct 8, 2015
    Posts:
    2
    Are Lightmaps supported in snenes with Surved world?
     
  30. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,734
    Yes.



    VacuumShaders - Facebook Twitter YouTube
     
  31. XenonSpher

    XenonSpher

    Joined:
    Dec 11, 2015
    Posts:
    29
    Can you curve this?
    https://www.assetstore.unity3d.com/en/#!/content/50771
    its an instantiated object that creates a road
     
  32. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,734
  33. seejay3061

    seejay3061

    Joined:
    Oct 21, 2013
    Posts:
    12
    I was able to get this working pretty quickly but I'm not seeing the Curved World options in preferences. Is there a step that I need to take to make those option show up? I have classic runner set as default in the "Curved World_Controller" script and the drop down it is greyed out. I'm using Unity 5.3.0f4 Personal
     
  34. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,734
    Menu / Window / VacuumShaders/ Curved World Settings



    VacuumShaders - Facebook Twitter YouTube
     
  35. ababab5

    ababab5

    Joined:
    Apr 15, 2014
    Posts:
    508
    Hi,

    Is it possible to use the Toon Shader Basic / Outline ?

    Thanks.
     
  36. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,734
    Package includes toon outline/ramp shaders.



    VacuumShaders - Facebook Twitter YouTube
     
  37. ababab5

    ababab5

    Joined:
    Apr 15, 2014
    Posts:
    508
    Hi,

    Thanks for your quick answer!

    It's not the same effect as Toon Basic / Outline.

    I will do a custom shader :(

    Thanks!

    I Have another question : I have a lot of error :
    IsFinite(outDistanceForSort)
    UnityEditor.DockArea:OnGUI()

    What can I do for this?

    Thanks a lot.

    Best regards,
    AB
     
  38. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,734
    With error messages Unity prints in console function names where error occurs. Can you provide more info, 'IsFinite(outDistanceForSort)' alone tells nothing.



    VacuumShaders - Facebook Twitter YouTube
     
  39. ababab5

    ababab5

    Joined:
    Apr 15, 2014
    Posts:
    508
    I would have liked but I just have this messages.




     
  40. ababab5

    ababab5

    Joined:
    Apr 15, 2014
    Posts:
    508
    I have this too some times :

    IsFinite(outDistanceAlongView)
    UnityEditor.DockArea:OnGUI()


    Thanks a lot
     
  41. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,734
    Not enough info, I even can not identify it as Curved World bug.



    VacuumShaders - Facebook Twitter YouTube
     
  42. ababab5

    ababab5

    Joined:
    Apr 15, 2014
    Posts:
    508
    Totally understand that. But how can I provide you more info?

    Thanks a lot.

    (I'm on Unity 5.3.1)
     
  43. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,734
    Select error and Unity will display more info about it (function name and error reason).
    Untitled-1.png



    VacuumShaders - Facebook Twitter YouTube
     
  44. ababab5

    ababab5

    Joined:
    Apr 15, 2014
    Posts:
    508
    I did't send you this because is useless in this case :
     
  45. Arkhivrag

    Arkhivrag

    Joined:
    Apr 25, 2012
    Posts:
    2,734
    I have just updated Unity 5.3.1f1 and found no problem. Also your warnings do not show any references to the Curved World, so I can not help.



    VacuumShaders - Facebook Twitter YouTube
     
  46. ababab5

    ababab5

    Joined:
    Apr 15, 2014
    Posts:
    508
    Ok,

    Thanks for trying !
     
  47. ababab5

    ababab5

    Joined:
    Apr 15, 2014
    Posts:
    508
    OK it's happening on Unity 5.3.1 with Particle (using your shader) for your info.
     
  48. ababab5

    ababab5

    Joined:
    Apr 15, 2014
    Posts:
    508
    Hi,

    Here my code to have a toon texture with your amazing asset.

    How can I add the outline in this shader ?

    Thanks !

    Code (CSharp):
    1. Shader "VacuumShaders/Curved World/Custom/ToonCurved" {
    2.     Properties {
    3.         _Color ("Main Color", Color) = (.5,.5,.5,1)
    4.         _MainTex ("Base (RGB)", 2D) = "white" {}
    5.         _ToonShade ("ToonShader Cubemap(RGB)", CUBE) = "" { }
    6.  
    7.         _OutlineColor ("Outline Color", Color) = (0,0,0,1)
    8.         _Outline ("Outline width", Range (.002, 0.03)) = .005
    9.  
    10.             _V_CW_OutlineColor ("Outline Color", Color) = (0,0,0,1)
    11.         _V_CW_OutlineWidth ("Outline width", Float) = .005
    12.     }
    13.  
    14.  
    15.     SubShader {
    16.         Tags { "RenderType"="Opaque" }
    17.         Pass {
    18.             Name "BASE"
    19.             Cull Off
    20.             ZWrite On
    21.             ColorMask RGB
    22.             Blend SrcAlpha OneMinusSrcAlpha
    23.          
    24.             CGPROGRAM
    25.             #pragma vertex vert
    26.             #pragma fragment frag
    27.             #pragma multi_compile_fog
    28.  
    29.  
    30.                 #pragma shader_feature V_CW_FOG_OFF V_CW_FOG  
    31.             #ifdef V_CW_FOG
    32.                 #pragma multi_compile_fog
    33.             #endif
    34.  
    35.  
    36.  
    37.             #include "UnityCG.cginc"
    38.  
    39.             #include "Assets/VacuumShaders/Curved World/Shaders/cginc/CurvedWorld_Base.cginc"
    40.  
    41.             sampler2D _MainTex;
    42.             samplerCUBE _ToonShade;
    43.             float4 _MainTex_ST;
    44.             float4 _Color;
    45.  
    46.             struct vertexInput {
    47.                 float4 vertex : POSITION;
    48.                 float2 texcoord0 : TEXCOORD0;
    49.                 float3 normal : NORMAL;
    50.             };
    51.          
    52.             struct fragmentInput {
    53.                 float4 position : SV_POSITION;
    54.                 float2 uv : TEXCOORD0;
    55.                 float3 cubenormal : TEXCOORD1;
    56.                 UNITY_FOG_COORDS(0)
    57.                 fixed4 color : COLOR;
    58.             };
    59.  
    60.             uniform float _Outline;
    61.             uniform float4 _OutlineColor;
    62.  
    63.  
    64.             fragmentInput vert (vertexInput i)
    65.             {
    66.                 fragmentInput o;
    67.  
    68.  
    69.  
    70.  
    71.  
    72.                 UNITY_INITIALIZE_OUTPUT(fragmentInput,o);
    73.  
    74.  
    75.                 //CurvedWorld vertex transform
    76.                 V_CW_TransformPoint(i.vertex);
    77.  
    78.  
    79.                 o.position = mul (UNITY_MATRIX_MVP, i.vertex);
    80.                 o.uv = i.texcoord0.xy;
    81.  
    82.  
    83.  
    84.  
    85.  
    86.          
    87.                 o.position = mul (UNITY_MATRIX_MVP, i.vertex);
    88.                 o.uv = TRANSFORM_TEX(i.texcoord0, _MainTex);
    89.                 o.cubenormal = mul (UNITY_MATRIX_MV, float4(i.normal,0));
    90.                 UNITY_TRANSFER_FOG(o,o.position);
    91.  
    92.  
    93.                 o.position = mul(UNITY_MATRIX_MVP, i.vertex);
    94.  
    95.  
    96.  
    97.  
    98.  
    99.  
    100.                 float3 norm   = normalize(mul ((float3x3)UNITY_MATRIX_IT_MV, i.normal));
    101.                 float2 offset = TransformViewToProjection(norm.xy);
    102.  
    103.                 o.position.xy += offset * o.position.z * _Outline;
    104.                 o.color = _OutlineColor;
    105.                 UNITY_TRANSFER_FOG(o,o.position);
    106.  
    107.  
    108.  
    109.  
    110.                 return o;
    111.             }
    112.  
    113.             fixed4 frag (fragmentInput i) : SV_Target
    114.             {
    115.                 fixed4 col = _Color * tex2D(_MainTex, i.uv);
    116.                 fixed4 cube = texCUBE(_ToonShade, i.cubenormal);
    117.                 fixed4 c = fixed4(2.0f * cube.rgb * col.rgb, col.a);
    118.                 UNITY_APPLY_FOG(i.fogCoord, c);
    119.                 return c;
    120.             }
    121.             ENDCG          
    122.         }
    123.     }
    124.  
    125.     Fallback "VertexLit"
    126. }
    127.  
     
  49. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    509
    hey,
    is there a way to adjust also a box collider according to the curved object?

    it somehow always floating in the air which makes clicking on it pretty difficult


    curvedworld3.gif
     
  50. seejay3061

    seejay3061

    Joined:
    Oct 21, 2013
    Posts:
    12
    Thank you for the quick response to my previous question.

    Question about Mobile. I replaced the Mobile>Diffuse (with diffuse map) shader that I was using with VacuumShaders > Curved World > U5 Standard > Standard. The map is put into the Albedo slot and this looks OK. However, I lose 10-20 frames per second (testing on iPhone 6 Plus) even when I am not doing any world curving. Is there a better shader option for replacing mobile/diffuse that includes the map slot?

    Thanks!
     
unityunity