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. MaDDoX

    MaDDoX

    Joined:
    Nov 10, 2009
    Posts:
    764
    Definitely, they're what we could call industry standards (SVG is even the native format for Inkscape) and properly supporting both is already a very tiresome, trial-and-error task. My parser does support polybezier right now, I'm still considering the support of circles and ellipses, they're a touch less trivial than rects and in the end you can always "freeze" them in the source app to get beziers. Might keep this one for a later release, just as text-to-vector support which's in its own league of complexity.

    Of course, as much as it is intrisically related (especially in this beta API stage) and promotes the "host" product, as soon as I have a showcase video for Rage Tools I'll add my own topic. Meanwhile, as a short update today I've implemented the parsing of all SVG outline and fill style settings, both color and opacity, just as multiple paths importing, each as a children of the master object. Now adding support to proper layering of paths will be trivial. iByte should be happy to know that I've also found out what causes the "mesh ripping" problem he posted some pictures about. It's got to do with the overlapping of vertices in closed (loop) paths, plus the lack of proper miter limit adjustments. I've had to do some juggling to work it out - and curiously you still need to nudge any of the path vertices after the generation to properly "wake up" the miter outlines - , there's still the problem of "beak" vertices which will require angle reflection, I'll work on that tomorrow. Keely, apparently your RefreshMesh() isn't affecting the outline mesh? I know I could dig into your code to find out but tbh if I start doing that I'll never finish what I'm doing :) So, pictures, worth a thousand words (which I've already typed), yada yada:
     

    Attached Files:

  2. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    I'm sorry I got a little confused what were the bugs and what you already fixed.

    Could you make list where you describe each problem and post picture or unitypackage (if possible) separately?
     
  3. MaDDoX

    MaDDoX

    Joined:
    Nov 10, 2009
    Posts:
    764
    Okay, sorry if I spit it all out with minimal to no organization, I really thought the pictures would make it clear. Plan failed obviously :) So:

    1 - "Ripped" meshes (the thing iByte was complaining about) - "Fixed". That's not truly RageSpline's fault, imo. iByte should tweak his adapted SVG parser to make sure there is no overlap between the end point and the starting one. Simply aligning the tangents orientations doesn't work, btw.

    2 - "Beak" vertices (I don't know how else to call it, they do look like a bird's beak :p). One example is highlighted in the red triangular shape, second to bottom picture. The problem here is more involved. I've tried to describe it as I understand it in the attached picture.

    3 - Corners not being properly updated. That's an issue with RageSpline, I've found. The pictures of the previous post should make it clear, as soon as the mesh is generated the corners are chiseled, "bevel-like", with very poor results. Once you make a simple nudge of any of the ragespline points it fixes itself. Changing the point density also "wakes up" the ragespline and fix things up. It's possible to make that happen programatically within the RageTools SVG Import, it's just very weird having to do so and hopefully not very hard to fix on your end.

    3 - Corners. In vector illustration programs there are three possible corner settings, they're adjustable per path (and not per point). I've added a screenshot showing the result of these three settings, they're present in the SVG format and used by all major illustration packages, would be extremely good to have them in RageSpline as well.

    So to make it 100% clear, I have touched 0% of your code, and don't really intend to do so. I do have one suggestion though, while/if you don't add proper path edge settings - to add a "corner density" option to the ragespline. Basically whenever the point isn't natural (I'm assuming natural means "smooth" in illustrator terms, ie. leveled in and out tangents) ragespline would automatically multiply the generated mesh density close to those points by a set factor. I remember you mentioned some of that was already being done, but tbh it's far from enough as it is and we really could use a customizable control (ie. x2, x3, x4) since some shapes need it far more than others.

    PS.: Talk is getting *way* too technical here, maybe we should move it to e-mail to stop annoying the 99% of people that simply want pretty and smooth vectors inside Unity? :) If you agree, PM me your e-mail.
     

    Attached Files:

  4. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    I think i am having a duh moment here - which of my posts does this issue get mentioned? I recall fill problems which were the result of my bumping vertex counts way to high on thin objects and the corners (same as you describe in your #3 corners) i found nudging was required as well.

    I think we are handling the first/end points differently with yours being more correct and mine taking a liberty or two (read .. assuming because it is a closed path, the start point and the end point will always be the same (in reality they don't have to be) so that the final "z command" does not really have any effect because of that :) This works with my sample file but is probably not going to cut it in the long run.

    While I think it's important to adhere ot the SVG spec as much as possible, I think making RageSpine act like inkscape/illustrator etc might be a bit of overkill... having said that I would vote for as much flexibility as keely thinks can be done without making it too complicated to use.

    my 2cents

    iByte
     
    Last edited: May 29, 2011
  5. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    Goddamit! Just wrote a post two miles long and lost it due accidental mouseclick. Oh well. Round 2.

    Let's just keep it here. Someone might actually be reading these :)

    Thanks a lot for the breakdown. Very helpful.

    If I understand correctly, a lot of the problems could be solved by making a single option per sharp control point whether user wants that one key vertex "pointy" or "smooth" (which is current behavior).

    Of course there could be more options and fidelity, like you explained in the pictures, but for now this "hack" could go a long way yes?

    Your vertex count should be multiple of the amount of control points you have. If you have 4 control points, the vertex count should be 4,8,12,16,20,... etc

    The SetVertexCount() in the API actually forces this so you can throw any number at it and then do RefreshMesh().

    edit: SetVertexCount() and "vertex count" naming in the inspector is a little confusing. It doesn't mean the actual count of vertices. It means how many times the spline is split into smaller parts.
     
    Last edited: May 29, 2011
  6. MaDDoX

    MaDDoX

    Joined:
    Nov 10, 2009
    Posts:
    764
    Those are the pics I'm talking about. It seems unrelated but, unless I'm 100% dead wrong, it's actually got the same cause. Before I've changed the import routine mesh wouldn't "rip open" with lower vertex count settings, only when increasing it. After the fix I can crank it up as much as I want and the mesh never gets those weird gaps inside it.

    I honestly can't imagine how a single extra-toggle would make it more complicated. Sure, we will be able to make the outline in a vector illustration program and bring it over to RageSpline, and for some things that'll be the best approach, but fact remains that for varying width outlines RageSpline will be your best option. You might not be aware but Illustrator width tool has to be "traced" to a closed shape, Inkscape doesn't even has an option for that. That's why I say that for full interactivity of tweaking variable width outlines using RageSpline will be the easiest, most flexible approach. That's why I'm asking a couple minor improvements in this area, I definitely don't see ragespline adding smart guide snapping or any high end illustrator features - maybe Keely does, but imo *that* would be overkill :)

    Whenever I forget typing long posts in notepad++ first, this happens to me :)

    Actually we don't need per-point control, not at all, it should be a per-spline setting, probably in the general block. Watch the picture below, for "natural" points the adjustment makes no difference whatsoever. In the kind of points where you need this control (technically they're called "cusps") there are only two really interesting options - smooth/round and miter (the "pointy" one). There's rarely a need for the miter limit entry, you can just ommit it and calculate it as infinite - ie. all cusp vertices as pointy.

    As for smooth, the fact remains that the current logic is not making it truly smooth, and increasing the vertex count changes nothing. Apparently the illustration softwares build a true arc around the cusp, with the same width as the rest.

    So, while we're at it, if you truly add a "smooth outline corners" toggle, why not make it also toggle on rounded caps for open lines ("free" as you call them)? Right now there's only the default option, which's called "butt" in the illustration apps. The third cap option ("square") it's also hardly used and unneeded. If you make that happen I promiss not boring you anymore about the outlines quality :)

    Summing it up:
    - smooth outline corner ON: free lines get rounded caps, cusp (non-natural) vertices get smooth joints.
    - smooth outline corner OFF: free line caps get the current (butt) behavior, vertices get miter joints.

    Oh, one really thing I've found out for the "non-refreshing" pointy edges problem: after you create a prefab with it - which you probably will want to make the imported SVG "static" and visible out of play mode - the problem fixes itself. Curious huh? :)
     

    Attached Files:

  7. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    Yeah re: prefab - I found the samething when I went to send keely a sample via prefab and poof the problem was gone :)
     
  8. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    I think I can hack the miter joints easily, because there's no adding extra vertices, just moving that key vertex on the tip a little further away.

    The smoother smooth joints would take a little more work. I'll try anyways.

    I guess you haven't done any inward sharp angles with outline yet (think inside of Pacmans mouth). That's when the S*** really hits the fan.

    Does the problem still exists after what I suggested on my earlier post?
     
  9. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    Has any of the beta testers currently holding v1.1 even noticed that there's a style-system to centralize control. Does it work? I'm sceptical. It's your duty to break it ;)
     
  10. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    @keely, I noticed it but haven't had a use for it. I'll try to tinker around with it today if I get an extra few mins.
     
  11. MaDDoX

    MaDDoX

    Joined:
    Nov 10, 2009
    Posts:
    764
    Yeah, same as Prime31, saw it but didn't touch it yet. I've noticed there's style inheritance/grouping in SVG, but from what I've gathered they're not referential like yours, multiple styles end up being duplicated due to the creation/layering order. I'll double check it anyways, maybe there's some tag system I'm unaware of, that'd be great.

    Exactly, apparently the miter algorithm "projects" the two last real outline points following their current directions, then find the intersection between those two projected lines.

    Smooth joints apparently make a simple arc (semi-circle) connecting the two last (what I call) real outline points in the simplest way, ie. using the cusp point as the center of the radius. If you can get that extra geometry math to work it'd be nice if it would be affected by the 'vertex count' setting as well. Talking of which, since like you said "your vertex count should be multiple of the amount of control points you have. If you have 4 control points, the vertex count should be 4,8,12,16,20,... etc", shouldn't the "vertex count" actually be a "vertex density" setting and actually work as a multiplier? That'd probably be very easy to make and automatically iron out what will seem like a bug to most users (like it did to me and iByte :))
     
  12. coolpowers

    coolpowers

    Joined:
    Mar 23, 2010
    Posts:
    125
    The style properties seem to propagate properly (that's a lot of props), but I can't seem to drag a style onto a RS object, I have to go into the RS properties and choose the new style myself.

    Incidentally, in the 1.1 version you gave me there's a bug with textured outlines, the outline UVs aren't being setup properly (uvPos always stays 0). I dunno exactly what you intended to do, but sticking something like

    Code (csharp):
    1. uvPos += (1.0f / splits.Length);
    within the main loop in GenerateOutlineVerts() gave me a pleasing effect.
     
  13. coolpowers

    coolpowers

    Joined:
    Mar 23, 2010
    Posts:
    125
    Btw (not RageSpline-specific) - what settings for time, fps, and physics are you using in the RageCube browser test? It feels much smoother (and faster) than anything I can get without setting the timescale to 2 or something.
     
  14. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    Weird. Have to check that one. There was a time when drag and drop worked.

    Same thing. I had that done at one point, but I guess I removed some stuff by accident.

    The RageSpline-class is really bloating and I'm a bit disorganized with my source control etc. Maybe I learn someday.

    Thanks for this.
     
    Last edited: May 31, 2011
  15. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    I'm pretty sure I changed both timescale and timestep to something else than default values, but not at home atm so have to check it up.
     
  16. megadouwe

    megadouwe

    Joined:
    Mar 27, 2011
    Posts:
    15
    Hi there,

    We have purchased the RageSpline plugin and installed it on one of our pc's. (Windows 7, with Unity 3.3.0f4)

    When we add the package within Unity, all goes well. However, when we add a prefab in the design area, there are only dots visible. No texture is shown in the scene view. However, when we switch to game view, the object gets visible.

    How can this be solved? Its a bit useless if we cant see wat we are drawing... :D

    Note: Also tried it on a Mac, works perfect!!.
     
  17. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    If you open the example game RageCar. Does it work on both Windows/Mac?
     
  18. megadouwe

    megadouwe

    Joined:
    Mar 27, 2011
    Posts:
    15
    Hi keely!

    In fact, that problem has been solved... Someone disabled the default layer so nothing got visible in the scene... Sorry for this post.

    However, we are trying to use ragespline to redraw our previous developed levels to find out if it may reduce the loading time of our game. The more points we are adding, the more corners there are getting visible. Can this be solved by changing values in the script??

    Thnx
     
  19. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    I'm sorry you lost me there. You have to post some kind of picture or explain the problem in more precise manner.
     
    Last edited: May 31, 2011
  20. coolpowers

    coolpowers

    Joined:
    Mar 23, 2010
    Posts:
    125
    If you ever get chance to look I'd be much obliged.
     
  21. Skyrise

    Skyrise

    Joined:
    Nov 3, 2005
    Posts:
    158
    I think you have to change the outline/fill vertex count in the inspector if you have spline with lots of points. :)
     
  22. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    Project/Time:

    Fixed timestep: 0.01
    Maximum allowed timestep: 0.33
    Time scale: 0.82

    Rigidbody:

    Interpolate: Interpolate
    Collision detection: Continuous
     
  23. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    Hi keely, you might have noticed this already but when you duplicate a RageSpline object that was created from the Creator Script, it adds an extra copy of the RageSpline script every time you duplicate it.

    iByte
     
  24. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    I didn't notice. Thanks.

    I'll understand this when I see it (not at home again), but I don't quite see how you can have multiple RageSpline scripts inside a GameObject. Do you mean that it creates a whole new object or what exactly is happening?
     
  25. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    Steps to duplicate the issue are

    open test scene
    press play
    highlight GameObject
    press Command D
    the new object (1st copy) is automatically highlighted and it now has two copies of the RageSpline component on it
    press Command D again, now the new object (2nd copy) has 3 RageSpine components on it)
    rinse - repeat


    :)

    iByte
     
    Last edited: Jun 1, 2011
  26. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    Funny. I was "cocksure" that you can only have one script/component per GameObject of each type. I wonder if this is something that was locked once upon a time and now they unlocked it.

    Well you learn something new everyday I guess.

    Btw. I don't know if it makes sense to start making duplicates of procedurally generated object at run-time, but I guess I should prepare my examples for that kind of "abuse" too :)
     
  27. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    Yeah it surprised me too. :)

    Maybe there is a better way to add a component to a gameobject on the fly and for what it's worth I can also drop multiple RageSpline scripts on a static GameObject.

    After testing a bit more this behavior doesn't appear to be specific to RageSpine and it seems Unity components like rigidbody for example are checked for duplicates but not regular scripts.

    iByte
     
    Last edited: Jun 1, 2011
  28. Astaelan

    Astaelan

    Joined:
    Jun 2, 2011
    Posts:
    1
    First of all, first time posting on the forums, and it's because of RageSpline. After weighing options, I decided to invest the $50 into RageSpline yesterday, and I could not be more pleased. The improved productivity was worth every penny on it's own...
    I thought I'd post a little screenshot of what we've started with RageSpline, and I also wanted to ask when 1.1 will be released, as we're eagerly awaiting the outline texturing support. If it'll be by this weekend, I can wait, but if not, could I possibly get 1.1 prerelease so we could start on the outline texturing?
    Anyway, here's what we got so far...
     
  29. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    New screenshots of RageSpline-powered games always make me smile :) Nice work!

    I'll send you the preliminary v1.1, BUT the outline texturing doesn't work very well in that build :( Or so I've been told. However there's a fix someone posted (I think on the previous page).

    I think I have a next beta version out soon where things are more polished.

    In general I have to warn you that multitexturing can be a little tricky in terms of how all the vertex colors and texture coords match up within RageSpline. Textures will need some hacks and I need to add some hacking variables to RageSpline too. All in all, the outline texturing and multi-texturing still needs work from my part.

    It helps if you have some understanding of Unity's Shaderlab and can tweak you're own shaders. It's very simple and you can use my shaders as an example.
     
  30. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    Btw. just a friendly reminder for everyone: There is a review box in the Asset Store.
     
  31. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967


    I'm pretty sure the level is made with RageSpline
     
  32. MaDDoX

    MaDDoX

    Joined:
    Nov 10, 2009
    Posts:
    764
    ^-- Very cool and looks quite fun as well :)

    Just as a small update, I've cleaned up lots of "just-make-it-work-for-now" hacks and had my first test with a large illustrator file yesterday. After a couple minor (yet annoying) bugs fixed the first real blocker was the hollow shapes - of course, we all saw it coming. I've created a small routine to take care of it by creating nested shapes using a "hollow color", that's obviously not the best approach ever but at least it's parsed everything I've thrown at it with no halts so far - which's great. All shapes are coming in, I've just got a weird color styling bug to fix, when I've stopped yest my eyes couldn't really cope up with the screen anymore tbh :) Getting back to slavery work tonight.

    BTW Keely, you haven't replied if you intended to change the "vertex count" setting to be a multiplier in the RageSpline interface instead of a raw number. I'll understand if you don't want to, anyways for RageTools "SVG in" script I've opted to do the following: you select a "vertex density" integer multiplier and that value is multiplied by the ragespline actual point count to feed in the 'vertex count' setting. Ultimately I want to add a "scale affects density" toggle that'll make the larger bounding-box shapes have a higher density and vice-versa. Another RageTools script will be responsible for setting up this density on the fly (using a fixed time step), according to the shape scale, when properly set that'll make the edges to be always smooth without needlessly wasting polygons when the object is distant or reduced due to some specific situation in-game.

    Just throwing up a couple of my .plan ideas so you can comment about, I hope we can have our products going on convergent directions :)

    PS.: Added screenshot of my first successful hollow shape inside RageSpline. It *is* possible!
     

    Attached Files:

    Last edited: Jun 3, 2011
  33. Acumen

    Acumen

    Joined:
    Nov 20, 2010
    Posts:
    1,041
    I guess you should clear up if this game really uses your tools ? Don't spoil us, if you're not sure ;)
     
  34. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    Well I can give you 99.9%. I spotted the link from a tweet which was made by this guy who is one of the beta testers. They mentioned in our earlier e-mail conversation, that their new game is about moustaches and has a Ragecube -styled mechanic.

    The funny thing was that I didn't really think about who posted the tweet and just clicked the link in random and I figured out the RageSpline connection only minutes after I first watched the video myself :)
     
  35. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    Nice. I <3 .plan files like any geek would :)

    Cool if you get the holes working. I'm sure they lose the fidelity of the original RageSpline UI (being divided into several objects if I understand correctly), but it's not a showstopper imo.

    I have to keep the vertex count variable as it is under the hood, because people have already build and serialized stuff on top of it. BUT I could ofc have the inspector show the more refined representation of it. Makes sense and I don't think it's going to cause any riots. I can see from the many screenshots that rarely anyone even touches it and there's always the original 64 from the prefabs.

    I think with bouding boxes the run-time LOD might be a bad idea with current functionality. Unless I make some changes on my part. Currently RageSpline caches the bounding boxes and if the count doesn't change, it uses the old instances. If you change the count, it removes everything and recreates them. I think instantiating bounding boxes run-time eats a lot of performance. Not sure though. Meshcollider is currently always regenerated if you change the RageSpline shape. I haven't really paid attention to animation side of things so far.

    I'm not sure that LOD system in 2D games - which RageSpline is made for - makes that much sense anyways? Do you have some scenario in mind where it does?
     
  36. Acumen

    Acumen

    Joined:
    Nov 20, 2010
    Posts:
    1,041
    Welp, in that case, trés manifique ;)
    I envy the excellent use of this product. Wish the devs would share a bit more on their actual process. I demand insight blogposts and whatnot :)
    Can't you force them to do so ? And if they should not cooperate, take access to ragespline away :/
     
  37. MaDDoX

    MaDDoX

    Joined:
    Nov 10, 2009
    Posts:
    764
    Not really, all it does is a "knife" connecting two points, one belonging to the external path and one belonging to the internal path. The tricky part is that it has to be performed between two points with "clear sight" to each other, and optimally no other point in the internal path should be closer to the anchor point of the external path. In the picture above the segmentation was performed manually (think a "C" with top and bottom ends touching each other with no visible seam), but I'm considering some sort of programatic implementation - that'd be "nirvana SVG import" tbh, but as you can imagine it poses many problems and risks. Maybe as a "try at your own risk" option.

    That'd be great. So you'd have both parameters available for API access as well? For instance, a ragespline.setvertexdensity = 2 would call a method which automatically made the vertexcount = original_point_count * vertexdensity? That'd save me a world of trouble :)

    Oh, thanks for the warning. Considering that, the best approach would be something in the opposite direction - any actual scale action (optionally) flag up the RageSpline that a vertex density increase/decrease could be required.

    Initially my main concern is offering a way for the vertex density of any rageSpline to be the right factor considering its proportional size on screen. Even in 2D games where the distance from objects to the camera is generally fixed, objects are scaled up and down. If you use a narrow-fov perspective camera to fake ortho while keeping the parallax effect, you'll also have things sometimes close, sometimes away from the camera. Thus either performance might be lost (by having the splines start up with a higher density than they need) or edge smoothness will be lost, since your starting low-density spline will show faceted edges once scaled up/zoomed in.

    That goes without saying that I envision RageSplines to be usable in 3D as well, as toony environment textures - why not? Talking of which, I've noticed the RageSpline shaders seem to pose some zSort problems in the perspective camera, can you confirm that?

    Edit: I've just noticed that 'vertex count' is always set to a multiple of the original point count when its value is changed in the editor, apparently only when creating new points programatically you can break it.
     
    Last edited: Jun 4, 2011
  38. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    Does it support an outline?

    iByte
     
  39. MaDDoX

    MaDDoX

    Joined:
    Nov 10, 2009
    Posts:
    764
    That's actually a question for Keely :) If we have a "render outlines behind shape" option, it automatically does. Currently I'm not even sure what the RageSpline shader is doing, it seems even though all polygons are in the same plane they're somehow rendered bottom-up in the order they're generated. That's why I asked Keely for some clarification in the current z-sort / z-ordering.

    Anyways, if the z-ordering is random or fixed in a certain way as I suspect, I'd rather not having to "force" the outlines z-positioning out of the API, from experience I know such "overdrives" will just lead to incompatibility problems in the future. Maybe Keely would be nice and give us the option in the API? :)

    PS.: I know, now I'm sounding demanding.. oh well. Sorry Keely.

    Edit: Finally fixed the nasty color offset bug I was getting, here goes a screenshot of the first complex art SVG-parsed by RageTools:
     

    Attached Files:

    Last edited: Jun 4, 2011
  40. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    Sorry I missed this question. To be honest I'm not 100% sure how my stuff even works, but AFAIK my shaders don't write to Z-buffer so within one mesh, the Z-value doesn't actually mean anything (with orthographic camera that is). Everything gets overdrawn according to draw order. I can make outlines go behind the fill by just reversing the order of fillpolys/outlinepolys inside the mesh. There's some complications with antialiasing though. I currently leave the AA off from the fill if it's going to be under the outline anyways. I have to remove that optimization I guess.

    That latest screenshot looks awesome. I hope I can get this v1.1 out soon enough. I "lost" last week to everything not RageSpline related. I'm trying to catch up this week since it's my holiday and all I have is time.
     
  41. MaDDoX

    MaDDoX

    Joined:
    Nov 10, 2009
    Posts:
    764
    In the perspective camera the z-position doesn't account for anything in fact, as you can see from my previously posted pic. In my "SVG In" component you define what's the z-offset you want for shapes that go on top of each other, by default it's -0.1. Unfortunately if you want to use RageSpline in 3D/perspective mode like I suggested, the RageSpline default shaders won't do as they are, hence my question. Shader writing is far from my specialty area btw, hopefully it isn't too hard to add z-buffer writing to the shader, maybe as another, modified shader?

    By that I infer you're actually considering "outline behind the fill" as an option? Lovely :) You could leave that optimization (a great one by the way) only for when the toggle is ON, makes the most sense to me.

    Owww.. that precious little thing ^_^ Lucky you! Looking forward to the almightyness you'll show us along the week. On my side I've finished the "vertex density" option (a multiple of the original point count), now working on the "adaptive density" SVG-in setting, which will set this density on import according to the ragespline bounding box size relative to the camera - if that sounds confusing, think about it as a "the smaller the spline, the lower the density" option. Looking good, 90% done so far.
     
  42. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    I'm using Shaderlab, which is nice script language in Unity for simple shaders. While limited, it's guaranteed to work on different platforms. Z-buffer writing can be enabled by just changing that "Z-write" variable in the shader code if I remember correctly.
     
  43. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    Actually I was more interested in what your "P" would look like if you turned on the outline?

    iByte
     
  44. MaDDoX

    MaDDoX

    Joined:
    Nov 10, 2009
    Posts:
    764
    Prolly like S***e but I didnt check it out tbh :) Nice to hear that you're using Shaderlab Keely, should make changes quite easy. Ive played with Stramit's shader node editor, quite nice and free as a bonus.
     
  45. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967


    Finally a new feature to show: Manual coordinates. I wasn't going to add new features to v1.1 anymore, but this was born out of my own personal frustration.

    You can type in coordinate values in either local or world space numbers. There is also "Round"-button which rounds up to nearest integer.
     
    Last edited: Jun 9, 2011
  46. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    I was talking to John yesterday. He is the guy making the tutorial videos. We decided that it should be a tutorial where you build a very simple game from zero to hero. All the code/project will be shipped with RageSpline or downloaded from the site.

    John isn't a coding wizard so I decided to make a very very very very simple game as an example for him. RageSpline is all about simple. It turns out I can make a game like this in something like 30 minutes.



    There's a playable demo at http://www.ragespline.com.

    Here is all the code you need for a game like this:

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class Ball : MonoBehaviour {
    6.  
    7.     public Vector3 forwardForce;
    8.     public Vector3 jumpForce;
    9.     private Vector3 startPos;
    10.     public bool canJump = true;
    11.  
    12.     void Start () {
    13.         startPos = transform.position;
    14.     }
    15.  
    16.     void Update()
    17.     {
    18.         if (Input.GetMouseButtonDown(0)  canJump)
    19.         {
    20.             rigidbody.AddForce(jumpForce, ForceMode.Impulse);
    21.             canJump = false;
    22.         }
    23.     }
    24.  
    25.     void FixedUpdate () {
    26.         rigidbody.AddForce(Time.fixedDeltaTime*forwardForce);
    27.     }
    28.  
    29.     void OnCollisionEnter(Collision collision)
    30.     {
    31.         foreach (ContactPoint contact in collision.contacts)
    32.         {
    33.             if (contact.otherCollider.name == "Triangle")
    34.             {
    35.                 transform.position = startPos;
    36.             }
    37.             if (contact.otherCollider.name == "Landscape")
    38.             {
    39.                 canJump = true;
    40.             }
    41.         }
    42.     }
    43. }
    44.  
    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class CameraFollow : MonoBehaviour {
    6.  
    7.     public GameObject objectToFollow;
    8.     private Vector3 origOffset;
    9.    
    10.     public float followSpeed = 0.5f;
    11.  
    12.     void Start () {
    13.             origOffset = - objectToFollow.transform.position + transform.position;
    14.         }
    15.  
    16.     void Update () {
    17.             float z = transform.position.z;
    18.             float y = transform.position.y;
    19.             transform.position = Vector3.Lerp(transform.position, objectToFollow.transform.position + origOffset, Time.deltaTime * followSpeed);
    20.             transform.position = new Vector3(transform.position.x, y, z);
    21.     }
    22. }
    23.  
     
    Last edited: Jun 9, 2011
  47. keely

    keely

    Joined:
    Sep 9, 2010
    Posts:
    967
    Actually we are doing game where you can go vertical too. It makes more sense to have one of these simple test characters with RageSpline to quickly test any kind of level you make. Whether horizontal or vertical.
     
  48. MaDDoX

    MaDDoX

    Joined:
    Nov 10, 2009
    Posts:
    764
    Great stuff Keely :) BTW, wouldn't this "manual coordinates" section get too big for complex shapes? Anyways, time to show what yours truly have been working on this week, I'm finally hitting the "higher level" point where I can actually get good stuff to work with less effort and time.

    1 - RageTools Path List - An almost required script for all RageTools dynamic components (including the incoming animation ones), this script works as a repository for all splines found as children of the current, root game object. This list can either be built automatically, on start, or programatically generated/regenerated by another script.

    2 - SVG-in Adaptive Vertex Density - Vertex "Density" is what I call the number of subdivisions per segment, ie. the current "vertex points" setting divided by the original point count. The user can manually enter minimum and maximum vertex density values, and in case they're different the "adaptive density" routine kicks in action. What it does is simple yet powerful, it compares the size of the imported spline to the
    camera size in game units. This ratio determines how much the spline will be subdivided, preventing excessive subdivision on smaller shapes while keeping higher subdivisions on the bigger shapes. In the attached example image (density 6 vs dynamic density 3-6) you can see a vast decrease in triangles with minimal to no visual quality loss.

    3 - Bulk AA-Set - Sets the anti-alias width of all sub-paths in the containing/root game object. It's dynamic, as such it can be adjusted interactively and in-game, allowing even some special effects like out-of-focus blur for distant shapes.

    Much more to come of course, the fact that I'm using this for a real under-production game (the art you see here is for a working title) puts the tool under real test stress. Comments? Suggestions? Bring it! :)
     

    Attached Files:

  49. ProjectOne

    ProjectOne

    Joined:
    Aug 9, 2010
    Posts:
    442
    That's cool keely
     
  50. Acumen

    Acumen

    Joined:
    Nov 20, 2010
    Posts:
    1,041
    Is this terrain procedurally generated ? Handmade ?

    Also, dude, you really make the most frustrating game prototypes I ever played ;)