Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

RageSpline - Create smooth 2D graphics inside Unity Editor - RELEASED

Discussion in 'Assets and Asset Store' started by keely, Apr 23, 2011.

  1. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    There's no way to adjust currently :(

    How bad is it? I mean RageCar seems to work fine, but I guess you have some other scenario. I have to think about making some kind of 1.01 fix soon if this is very bad. Can you send a screenshot? If it's a car, could you make the tire colliders smaller? If it's not a car, could you tune the non-RageSpline object collider? Or do you have two RageSplines colliding?
     
  2. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,158
    Glad you like it... because I will love it too !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    Here a screenshot of my actual project : (even if it's always too much designed !!! I have to learn to be less complicated !)
    (And the wings move to let the wasp fly...)



    6R
     
  3. shadowfork

    shadowfork

    Joined:
    Jan 8, 2010
    Posts:
    167
    It's pretty bad :(
    I was hoping to plug this in a game I'm working on to be released next month.

    Here's a snapshot:


    It works great... only thing is it's a little way off. I don't mind thickening the outline to hide it but it takes the colliders with it.
     
  4. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    Based on this screenshot, it looks bad enough. I can get a fix going hopefully during weekend. I can give you some hotfix to test with even tonight, but I'm not at my home office to check it, but it should be rather painless fix.

    Can you tell me what are you're outline settings. Width, AAwidth, Outline-mode
     
  5. shadowfork

    shadowfork

    Joined:
    Jan 8, 2010
    Posts:
    167
    Don't worry about it :D

    Look...


    All I had to do was pull the outline width to a negative value and I get this effect. Seems to be running just fine. Is there a repercussion for doing this approach?

    Anyways... 5 STARS! 4 Thumbs up! Phenomenal product!!!
     
  6. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,158
    @ shadowfork : Is there a way to make your bike run on clone (without outline) of the ground directly behind (or before ?) the ground with the outline, for example ???
    Make this other ground invisible ???

    Ooops ! Too late ! My answer and yours have appear at the same time on the forum !!!

    But it's a great solution with this negative value. Can help us... Thanks !

    6R
     
  7. shadowfork

    shadowfork

    Joined:
    Jan 8, 2010
    Posts:
    167
    Yeah, I was about to reply... not quite sure about the question... then I realized I think you were proposing a solution.

    Appreciate it though. :)
     
  8. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    Rock'n'roll!
     
  9. Veli

    Veli

    Joined:
    Mar 10, 2009
    Posts:
    301
    Bought it and I've been using it for couple of days.

    Suggestions:

    - Have gradient colors, emboss setting and all that visual stuff saved in the material. Makes life easier when we have 20 platforms, need to make changes and we dont have to cange everything by hand.

    - Allow us to use a mesh collider instead of boxes. The boxes create some problems with round edges.

    BTW, are you on any IRC channels?
     
  10. shadowfork

    shadowfork

    Joined:
    Jan 8, 2010
    Posts:
    167
    OK. I think I caught the problem.

    It seems the negative value solution doesn't apply to Textured objects. The outline disappears.

    By the way, I don't seem to be able to control the outline color when I use a texture/material of my own. Where does that color come from? I tried to set all colors to red but it didn't change.

    Any thoughts?
     
  11. shadowfork

    shadowfork

    Joined:
    Jan 8, 2010
    Posts:
    167
    +1 @ Mesh Colliders. I'm getting unnatural sharp bumps on my bike when running on curved paths.
     
    Last edited: Apr 29, 2011
  12. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    I knew this would come up sooner or later. I'm going to explain why this happens under the hood. If someone has a good solution to this problem, I'd love to hear.

    When you are using texturing, it means that every part of the mesh needs to have a thing called texture coordinate. Every polygon in the mesh has to be textured, if the object material has a texture, even the outline. It's just the way Unity and materials work.

    What I did to make the outline single colored, was to set every texture coordinate in the outline to sample the same pixel (actually texel) from you texture. This means is that every polygon in the outline mesh gets a same color information from your texture. It is now set to [0,0], and this points to a pixel in one of the corners of your texture (can't remember which corner from the top of my head).

    Now the color of this one pixel is multiplied with the actual selected outline color. Let's say for instance that you have selected a red color for your outline RGB (255, 0, 0). Let's say you have a gray pixel RGB (128,128,128) in coordinates [0,0] of your texture. When these are multiplied, the resulting color is (128, 0, 0). So you get a red color, but slightly dark.

    If you are so lucky, that you have a totally white pixel in the coordinates of [0,0] of your texture, then you will have the exact color you selected. If you are so unlucky, that your pixel is black, you always get a black outline.

    So the fix is to have that one pixel as bright as possible and near gray/white as possible if you are looking for any other outline color than black.

    This troubled me alot while developing and I was sad that I couldn't find a proper solution. At the end of the day, I thought that most people are fine with the black outlines anyway, and this problematic combination wouldn't occur too often.

    Maybe there's a way around this, but so far I haven't figured anything out.
     
    Last edited: Apr 29, 2011
  13. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,158
    You mean the outline disappears at runtime when your (nice) bike is far from one of the grounds !?! Because we can see them on your screenshot and I have tested on a textured spline : there are visible !
    Did you see a negative value outline seems to lose the antialiasing effect !?!

    By trying to change this bad no-antialiasing effect, I have changed the antialiasing parameter and suddenly I could have a great halo effect for a sun for example :
    Use a yellow-orange circle spline, give the same color to the outline and try 10 or 20 to the antialiasing option !!! It can be great for a nice summer sun or for a desert background...

    6R
     
  14. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,158
    Strange :
    Your script shows emboss color 1 and 2 white and black as I wish it generally but the inspector is showing another colors by default (brown and white) !?!

    6R
     
  15. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    Yeah that material thing makes sense. Now I just have to figure out how to make the change without breaking peoples projects.

    I guess some kind of selection if you wan't to use the settings from the material or from the object.

    I'm going to test mesh colliders this weekend. I once had problems with them on 2D setups, but I may have been too hasty.

    I'm at #load on IRCNet (Turku Game Tech Lab channel)
     
  16. shadowfork

    shadowfork

    Joined:
    Jan 8, 2010
    Posts:
    167
    Thanks for the detailed explanation. Glad to see you're working hard for solutions and taking suggestions very well (of course within reason).

    Never been so happy with my purchase! Highly recommended and can't wait for the improvements!


    @P6R ... no, it doesn't disappear @ runtime. As keely explained above, he is aware of that bug. I'll try to see if I can make it work based on keely's suggestion.

    Here's a screen cap. The first one is the outline I'm getting. I've set everything to black and I would be happy to settle for black but I can't get it :( ... the second one is when I did the negative value... now the outline totally disappeared :(
     
  17. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    The negative value is kind of undocumented so I can't say for sure how it behaves. If you are setting outline as black and getting that white(ish) outline, you must be using additive or double shader right?

    Maybe if you make your texture not colored (make it black&white image. Make it bright if you can), change to RageSplineTextured-shader and set the color you previously had (a little bit orange right) to be your RageSpline fill-color. This should get the same look you have now, but with the black outline.

    And as bonus feature, you can now change the color of the shape in Unity, even with the texture on. Or even put a nice gradient on that mofo :)

    You can also keep your current texture with colors and all, but just change to that RageSplineTextured -shader in your material and choose a 100% white fill color.
     
    Last edited: Apr 29, 2011
  18. shadowfork

    shadowfork

    Joined:
    Jan 8, 2010
    Posts:
    167
    It's not an additive or double shader... it's just a regular diffuse shader.

    The solution you proposed above, unfortunately, can only work for this specific situation.

    However, I have other objects that are multi-colored/textured where filling it with a solid color and blending it with black/white texture will not cut it :(
     
  19. shadowfork

    shadowfork

    Joined:
    Jan 8, 2010
    Posts:
    167
    Maybe a temporary solution is to do what P6r suggested: Cloning.

    1 object is the outline, 1 would be the filled texture. Having them offset from one another.
     
  20. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    You need to use materials with RageSpline-shaders only. That diffuse shader might work ok in some cases, but prefer those that are with the product.

    I already edited into that last post, that you can have you're multicolored textures, if you use the RageSplineTextured-shader + 100% white fill color.
     
  21. shadowfork

    shadowfork

    Joined:
    Jan 8, 2010
    Posts:
    167
    Your absolutely correct! Problem solved! Thanks Keely!
     
  22. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,158
    It's why I didn't have this problem because I use the included ragespline shader...

    6R
     
  23. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    Hi 6R,

    if you are using the prefabs just go and adjust those transform settings right on the prefab to your preference. (of course it might get overridden when keely does a package update). Make sure you drag to the hierarchy and not the scene.

    One thing that i wonder about is the placement of the initial object even if the coords are (0,0,whatever)) in the prefab and that is the objects are not centred over the centre point.

    Here is a screen shot of all instantiated prefabs @ 0,0,n



    keely, just a nit pick but your circle is not exactly round :)

    iByte
     
  24. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    Yeah the spline points in the prefabs I bundled, weren't drawn exactly in the middle of the local coordinate space. I didn't think it was a big deal. Only place where I think this matters, is that if you use local space origo as your pivot when you scale/rotate. I can't remember from the top of my head, but I think Unity default pivot point is the actual center of the object and not the local coordinate space origo.

    I thought that ppl are going to make their own prefab-palettes anyway. Or that's what I recommend anyway. If you make a nice looking tree or want a perfect red circle, then it's easy to make it your own prefab and use that as a base.
     
  25. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    Nothing wrong with it really :)

    I am just used to seeing objects centred over the grid when placed at a known location. Not being artistic i tend to be more inclined to symmetry and transforms rounded to .0 just one of my quirks :D

    iByte
     
  26. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,158
    yes iByte, I drag to the hierarchy panel, not on the scene (and not on the project panel as i said before !).

    YEAH ! I didn't think to change the coord in the inspector before inserting them... Now it works perfect and I can see my splines immediately in front of the camera. Thanks a lot...

    With such a great extension we need this kind of "perfect" parameters allowing us to avoid unuseful clicks or tasks ! One Reset for each spline for a platform game isn't the best thing !!!

    With this kind of trick and all what we already have requested to keely, RageSpline will become RapidSpline !!!!!!!!!!!!!!!!!!!!!!!!!!
    For the same reason (rapidity !) we could have circle and textured circle, egg and textured egg and so on in the default prefabs to avoid to change the shader... But if it isn't in the next update each user can do that by himself very easily.

    So, don't forget keely : To avoid unuseful tasks, clicks, changes... must always keep in your mind for all what you will update !!!!!!!!!!!!!!!!!!!
    Easy to find : When you make your own game with RageSpline, which repetitive tasks do you do ??????

    6R
     
    Last edited: Apr 29, 2011
  27. Eyeofgod

    Eyeofgod

    Joined:
    Jun 25, 2010
    Posts:
    126
    I just bought it. Truly awesome and really easy to use. Thanks a lot!

    I just have a question, How can I access the properties of a form, like the points position, control points, color... from a script. I wan't to change the curve points while running the game to deform the objects.
     
  28. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    I'm going to link to older post couple pages back:

    http://forum.unity3d.com/threads/86772-RageSpline-Create-smooth-2D-graphics-inside-Unity-Editor-RELEASED?p=563396&viewfull=1#post563396

    Remember to call the RefreshMesh() after you changed the control points.

    I haven't commented the code and it might be little cryptic here and there. Try not to make bigger than life engine on top of this yet. I'm planning refine it to suit code access and 3rd party development for the next version so you're code might break after the v1.1 update.
     
  29. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
  30. Eyeofgod

    Eyeofgod

    Joined:
    Jun 25, 2010
    Posts:
    126
    Im sorry I missed that TWO post... :,(

    Thanks keely
     
  31. Acumen

    Acumen

    Joined:
    Nov 20, 2010
    Posts:
    1,041
    holla, what a success story :D
    Congrats on bringing so many sales in !
    I hoped this would take off as it did now. Since the original thread was kinda slow paced. Brilliant work :)
    Now maybe you could tell me what you plan on doing next, so I can rip it off before you get superrich ? Sounds reasonable to me :eek:
     
  32. vpdp_pc

    vpdp_pc

    Joined:
    Apr 29, 2011
    Posts:
    3
    First, sorry for my English :(

    I think change "fixed time step" is not a good way because it could slow down on low end computer.
    So I used a better way and I'm very happy with the result:

    I expand the side of each BoxCollider like this:

    In function RefreshPhysics:
    Code (csharp):
    1.  
    2. //fix by vpdp_pc
    3. //note: change 15f to any number but remember to set same at below
    4. //old: newObj.transform.localPosition = (pos + pos2) * 0.5f - 0.5f * norm;
    5. newObj.transform.localPosition = (pos + pos2) * 0.5f - 0.5f * norm*15f;
    6. //end
    7. newObj.transform.LookAt(transform.TransformPoint(newObj.transform.localPosition + Vector3.Cross((pos2 - pos).normalized, new Vector3(0f, 0f, -1f))), new Vector3(1f, 0f, 0f));
    8. //fix by vpdp_pc
    9. //note: 15f should be same at above
    10. //old: newObj.transform.localScale = new Vector3(100f, (pos2 - pos).magnitude, 1f);
    11. newObj.transform.localScale = new Vector3(100f, (pos2 - pos).magnitude, 1f*15f);
    12. //end
    13. boxColliders[i] = box;
    14.  
    As you can see, I expand each BoxCollider 15 times.
    I can make a ball fall with Y=1000 to a complex shape at Y=0 with gravity Y=-100 without any stucks :D

    HOPE IT USEFUL :eek:
     
    sGlorz likes this.
  33. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,158
    @ Eyeofgod : I'm very interested in this too. But I can't figure out how to do that in the script, even with the comments of keely...
    * If you can do that, could you share the code, please ?
    * Can we do this part of coding in javascript too ??? For example how can I drag a point only from a javascript !?!

    6R
     
  34. WebWolfRussian

    WebWolfRussian

    Joined:
    Feb 5, 2010
    Posts:
    123
    Hello Keely. What do you think about animation?
     
  35. MaDDoX

    MaDDoX

    Joined:
    Nov 10, 2009
    Posts:
    764
    I've made a question about this very same matter, with a nice suggestion, but got thoroughly ignored.
     
  36. shadowfork

    shadowfork

    Joined:
    Jan 8, 2010
    Posts:
    167
    I wonder if this works along 'Batch Edit' plugin from Unity Asset Store.

    If someone has this working with it, please let us know. It'll save time editing mutliple objects. Thanks!
     
  37. Wenceslao

    Wenceslao

    Joined:
    Feb 7, 2009
    Posts:
    142
    I'm not very good with shaders, I poked around with no results but would it be possible to make a shader so that you could build a scene where everything was dark and use a light to illuminate parts of the scene? Like a flashlight pointing at the scene from the side? What would be involved? This might be interesting for me to learn.
     
  38. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    Sorry about not answering to you. I was going to answer, after I did some research. I haven't done it still.

    I currently know nothing about animation, how animators work or even the technical side of it, so I can't really say what would be the best approach or is it even doable.
     
  39. p6r

    p6r

    Joined:
    Nov 6, 2010
    Posts:
    1,158
    OK ! I can't resist to create some nice prefabs with the splines... even if I would like to be more simple.
    Here is a screenshot of buttons we can make easily and of my virtual "playstation" + a basketball !!!



    6R
     
  40. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @Maddox WebWolf, while animation is totally doable it would be an extremely expensive operation depending on what you want to do. In the simplest case, say animating a vert from one position to another you would need to move the outer vert, inner vert and emboss vert. Moving 3 verts is obviously simple but what do you do with the distances between them? Do they scale or remain constant? Now if you wanted to skip direct vert access and instead animate the actual RageSpline points you are now potentially adding/removing a lot of tris and verts on every frame of you animation. Without knowing exactly what you are thinking it's hard to recommend a workable solution but I don't think you are gonna want to directly animate verts or RageSpline control points. Maybe sticking a few bones on a spline could work for you?
     
  41. MaDDoX

    MaDDoX

    Joined:
    Nov 10, 2009
    Posts:
    764
    Right now I see RageSpline helping in the following areas:
    - "Quality" setting to define tesselation/performance without the need for multiple resolution assets
    - Quick and easily setting up the materials
    - Adding a couple effects like bevel and stroke on-the-fly
    - Auto-generated mesh colliders

    But to be honest aside from the auto-generated mesh colliders you could get away with bitmaps for such tasks. It's just static anyways. Now, add animation on top of it and you've got a really unique thing - having long animations on large-scale objects makes for prohibitively expensive bitmap atlases for mobile devices. Having this ability would aggregate so much value to the product. As to "exactly what I'm thinking", I thought I had described it in sufficient detail, but I might be wrong so I'll do it again as I reply to prime31's question:

    It could, if it used imported objects instead of just internally generated ones (at least that's how I think it works, correct me if I'm wrong). Bones are attached to polygons, and its animation generally comes from an imported object/mesh. Sure, you can animate bones/joints inside Unity, but you still need to define the joints influence weights over the vertices, and that has to be done in an external package like Maya, Messiah, Max, MotionBuilder, etc. So you'd better do the weighting and animation in the external package as well. Thus my suggestion to use these imported meshes as the basis for the spline creation, I can't imagine any other sufficiently fast animation method in Unity, even using the default skinned mesh animations might be too slow on "refresh spline" is performed on a per-frame basis.

    Supposing that can be optimized enough, the problem would still be how to export this array of points and tangents to polygon format and "read them back". I took some screenshots of the difficulties we artists meet when converting from bezier splines (from illutrator) to some major 3D packages:

    - Pic 01 shows the same curve exported with the regular curved and flat tangents, and imported to Modo.
    - Pic 02 shows the flat tangents geometry subdivided (ie. hitting TAB) inside Modo. Notice the catmull-clark (subdivision algorithm used by everyone and their dog in the 3D world) one and the original curves don't match at all.
    - Pic 03 shows that Maya does a slightly better job when converting curves to Planar NURBS and then to polys + sub
    - In Pic 04 you see that to get really good results you need to manually tweak and add points to the cage polygon until its subdivided version looks just like the original. Lots and lots of work and you still end up with...
    - Pic 05. The cage is very distorted to get the look we want, and for more complicated shapes you'll have to animate in subdivision mode only to be able to understand what-is-what.

    Of course you could start shaping things up directly inside the 3D application, if RageSpline then used the same subdvision method to generate its curves. Then we'd have easy-to-animate meshes (using joints/bones) with just the solid shapes, and RageSpline would add the strokes, colors, bevels etc on those shapes. That's my suggestion, but of course there might be other ways to do this without relying on an external 3D app. I just can't imagine anything that would provide us with Flash-like performance, which I'm sure it's one of the main goals for a professional-quality vector tool. Opinions/ideas?
     

    Attached Files:

  42. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    My computers fan would argue about Flash being performant but that is a whole other matter :) So, your last sentence explained it: you want full vector support in Unity. That is a pretty huge direction change from mesh based rendering like it currently is. RageSpline feels vector like during editor creation but it is still just emulating a vector tool and creating a mesh.

    It won't get you a true vector system but you can assign bones (including vertex weights) at runtime. You'll still have the same mesh that is being distorted programatically via the bones though.
     
  43. Wenceslao

    Wenceslao

    Joined:
    Feb 7, 2009
    Posts:
    142
    Besides crashes that I've submitted to Unity, there seems to be some problems making Prefabs of a Ragespline. I've made a few and when I go to edit the prefabs directly I get this error in console:

    In addition I end up with box colliders that just appear in my scene.
     
    Last edited: May 1, 2011
  44. Wenceslao

    Wenceslao

    Joined:
    Feb 7, 2009
    Posts:
    142
    Is anyone else getting leaked errors?

     
  45. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    Hi keely, I am seeing some issues with point selection. I select a point and press N - it changes a point farther away and not the point I just clicked on? Have you seen that behavior? Doing a refresh doesn't seem to help. Only way to shake it is to move the points farther away from each other. Change the point type and then move them back closer together .. of course it doesn't happen all the time.

    iByte
     
    Last edited: May 1, 2011
  46. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    This is what happens when you let colour blind people draw pictures.



    My RageSpline creation

    iByte
     
  47. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    Are you using orthographic or perspective in your editor view?
     
  48. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    I would need to get more specific info on what you are doing. Could you describe how to recreate this error, starting from a empty project? Can you recreate it yourself every time or does it appear randomly? Can you send me your (small) project or .unitypackage-file, where this can be recreated?

    The point is, that whenever a developer needs to fix a bug, he needs to recreate it first. Otherwise it's near impossible to fix. I can't currently recreate myself, what you are describing here, so I need you're help.

    I had these while developing, but I thought I got rid of them. This pops in the console when you are saving your project or scene, right?

    It's annoying, but not too dangerous. It never ends up ruining your game build for the end-user anyway. What it means is what it says: There was a mesh or texture created (by code), which is not used anymore and just sits there in the memory, so it is "garbage collected". I have to see, if I can recreate this one too.

    You might be doing something or have some kind of workflow that no one else is having, because I haven't gotten any similar reports from any of the other users or early beta-testers. If you can describe what you are doing with more details, it would be helpful.
     
  49. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    Someone finally asked in my blog, where does the background music in the original RageCube video come from.

    Now I can finally brag, that I made it myself and music production + guitar playing is a longtime hobby of mine.

    The funkier track on the "Introduction"-video is made by my friend Lunar Ladder, lunarladder [at] kuutikkaat.net, also check out this
     
    Last edited: May 1, 2011
  50. proportion

    proportion

    Joined:
    May 21, 2009
    Posts:
    10
    Hi Keely a bug i found is if you drag in your rectangle prefab onto the hierarchy, scale either your x or y to zero (i accidentally did this) and when you try to scale it back to 1 or more, the object its self wont. it would kinda annoy you if you made something really cool and for some dumb reason scaled to zero and would have to start all over.