Search Unity

[RELEASED] Realtime CSG - level design for Unity

Discussion in 'Assets and Asset Store' started by LogicalError-Unity3D, Aug 24, 2016.

  1. PartyBoat

    PartyBoat

    Joined:
    Oct 21, 2012
    Posts:
    97
    Woah awesome! I didn't think you were doing updates anymore. Are you sorta working on RealtimeCSG again?
     
  2. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    Yes, I plan to release updates now and then.
    At the very least I'll make sure it'll work with every new version of Unity
     
    hippocoder, Mark_01 and Petethegoat like this.
  3. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    Aaand I just uploaded version 1.535, which fixes a couple of more prefab issues I discovered + selection ordering issue:
    • Fixed duplicate on prefab-instance sometimes not working + error messages
    • Fixed not selecting brush behind cursor when clicking on brush (issue #250)
    • Fixed "Selection interacts with models outside prefab mode, while inside prefab mode" (issue #275)
    • Fixed "Creating new brushes while inside prefab mode, creates brushes in scene instead" (issue #276)
     
  4. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    Just uploaded version 1.536 which fixes an error when upgrading models from an older version
    (having to do with UnityEditor.UnwrapParam:SetDefaults)

    You can find it here
     
    tarahugger, dadude123 and Mark_01 like this.
  5. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    Capture.PNG

    Just a sneak peak
    It may not look like much, but this is the beginning of Realtime CSG 2. The UI is just functional at the moment, this will be improved. You can see here that generators will be components in the future! The new foundation will make it easier to implement new types of generators & it should all work at runtime. It also has a whole lot less overhead compared to the original
    (Keep in mind that there's still a lot of work remaining, so don't expect it to be released soon)
     
    xVergilx, Petethegoat, andyz and 7 others like this.
  6. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    I'm a big fan of realtime CSG. Any update is a joy for me.
    Will it be free for current customers or is it a paid upgrade?
     
    hippocoder likes this.
  7. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    It'll be a free upgrade!

    It might be a different asset on the asset store though .. I'm not sure yet how I'm going to release it
    I'm considering releasing it as a beta version first on the realtimecsg.com website, so that v1 users can try it out and give feedback on it, before I release it on the asset store
     
    xVergilx, Petethegoat and Mark_01 like this.
  8. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Cool! Thanks a lot!
    I don't know if I will be able to betatest it though, as I'm quite busy working out my motion capture workflow right now :p
     
    LogicalError-Unity3D likes this.
  9. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    Well I'm not releasing a beta *now* ;p So who knows, maybe by the time I release a beta version you'll have time :)
     
    Mark_01, dadude123 and atomicjoe like this.
  10. JuliuszK

    JuliuszK

    Joined:
    Dec 22, 2014
    Posts:
    25
    Great news! Looking forward for the runtime aspect of it.
     
    LogicalError-Unity3D likes this.
  11. tarahugger

    tarahugger

    Joined:
    Jul 18, 2014
    Posts:
    129
    Looks really great :)
     
    LogicalError-Unity3D likes this.
  12. Petethegoat

    Petethegoat

    Joined:
    Jun 12, 2013
    Posts:
    39
    Very exciting, take your time on it :)
     
    logicalerror likes this.
  13. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    NO! Don't take your time! I want it NOW! :p
     
  14. CrazeDevelopment

    CrazeDevelopment

    Joined:
    Nov 26, 2010
    Posts:
    22
    Based on RealtimeCSG 1.0, I would honestly pay $100-200 for 2.0.

    I'm sure you get plenty of praise but again: everyone I've shown / recommended has been absolutely astonished by it. Every week I swing by your site wishing you the best.

    Hope life is good!
     
    Mark_01 and logicalerror like this.
  15. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    @CrazeDevelopment Thanks! Yes, life is good rn

    Still churning away on Realtime CSG 2.0 ;p
     
    Petethegoat and Mark_01 like this.
  16. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    FYI; some fixes have been coming out over the last couple of months

    Version 1.541 - 26 nov 2018
    • Fixed FBX export generating an error after export

    Version 1.540 - 5 nov 2018
    • Fixed default physics material not being applied to mesh colliders

    Version 1.539 - 10 oct 2018
    • Fixed grouping objects causing NullReferenceException (oops)

    Version 1.538 - 8 oct 2018
    • Fixed mesh being destroyed on build

    Version 1.537 - 2 oct 2018
    • Fixed grouping objects causing NullReferenceException
     
    Mark_01, dadude123 and twobob like this.
  17. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    Realtime CSG is ON SALE RIGHT NOW! 50% OFF!
    Tell your friends!
     
    Mark_01 likes this.
  18. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    I'll tell myself to get it thanks
     
    LogicalError-Unity3D likes this.
  19. LogicalError-Unity3D

    LogicalError-Unity3D

    Unity Technologies

    Joined:
    Aug 7, 2015
    Posts:
    58
  20. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    Released some more bug fixes

    Version 1.543 - 27 nov 2018
    • Fixed compilation error in 2019.1a10
      Keep in mind that 2019 is pretty much untested with realtime CSG, there might be other things that don't work
      At the very least visibility of brushes is not supported (yet) at the moment

    Version 1.542 - 27 nov 2018
    • Fixed FBX exporting failing when a material is missing on exported model
    • Fixed FBX exporting in different locales causing malformed fbx files
     
    Mark_01 likes this.
  21. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    Got it thanks.. pretty good, no requests yet :D

    Just a question as I barely had time to play with it, but I noticed csg prefabs are supported does that mean this all works at runtime with all the boolean operations and colliders recalculated?

    Think for now it will serve best for level prototyping and exporting out the fbx, I didn't have much fun with probuilder, and sadly sabrecsg got abandoned, though from what I remember it didn't have the best performance while this does.. and sale price honestly probably the best purchase all week.
     
  22. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    @Player7 There's no runtime support in realtime CSG, sorry ...
    realtime-CSG 2.0 will have runtime support however, but it'll take a while before that's done :)

    Prefab support is basically there just to make it easier to reuse pieces in your level(s)
     
    hippocoder likes this.
  23. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    Maybe I'm missing something, but in scene view Realtime CSG hotbar.. if you close it, it becomes a floating panel, and if you close that, it goes back to being in the scene view.... this is kinda annoying when you aren't doing anything with CSG.. I don't mind the toolbar at the bottom of the scene view being permanent, and I think maybe an icon to toggle on/off the hotbar might be a good use for it.

    Also the CSG grid... 1) possible to make this work with all transforms of other gameobjects, ugui?
    2) possible to have a way of independently adjusting grid snapping levels, and the grip lines/sub gridlines.. they don't really match up with the snapping sometimes, and depending on zoom player its like there are more lines visible that can't be snapped to anyway. Some finer control or mapping on lines/snap levels would be nice.

    Oh and some way of selecting all faces, or something like maya where you can paint select faces? to apply material(s) faster?
     
    atomicjoe likes this.
  24. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    I concur on everything.
     
  25. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    @Player7 @atomicjoe you can turn realtime CSG on/off using control-F3 when you're not using it, the toolbar disappears then..

    1. that used to work, but something got broken. Haven't yet had the time to look into why .. :-/
    2. with independently adjusting grid snapping levels, do you mean different snapping for x, y & z? you can already do that; if you click on position it'll toggle between uniform grid and non uniform grid. As for showing sub-lines below the snapping distance, yeah maybe that's not a good idea .. I'm not sure what you mean with "Some finer control or mapping on lines/snap levels would be nice"?

    You can select faces while dragging over them while holding shift, control or alt in surface edit mode. When you drag a material onto the a selected surface, it'll apply to all selected surfaces. When you hold shift while dragging a material on a surface, it'll apply to all sides of all brushes that belong to all selected surfaces. If you hold G and click on a surface, and then click on another surface, it'll copy the material and make the uvs continuous between those surfaces. You can also drag over surfaces while holding G .. does that help? Maybe I don't understand what you mean with paint-select faces?
     
  26. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    yeah that explanation on texturing faces and the shortcuts might help will check it out later on.

    ctrl+f3 ..maybe this could cycle between 'all on' | 'all off ' | 'grid on only'? Well at least when the grid working with normal gameobject transforming.

    For grid lines and snapping, just a way of adjusting the visual grid independently off the snapping levels.
     
  27. Falagard

    Falagard

    Joined:
    Jan 8, 2014
    Posts:
    43
    You're working at Unity and looking at updating Realtime CSG... hmm I'm wondering if we'll see Realtime CSG join Unity Technologies like Pro Builder did? ;-)
     
  28. tarahugger

    tarahugger

    Joined:
    Jul 18, 2014
    Posts:
    129
    I'm having an issue with the CSG not taking effect immediately after adding a CSGTreeNode to an already rendering CSGTreeBranch. The node i am adding is a shape set to Subtraction, but it doesn't update for me properly. My current workaround is to wait a while, and change the localtransformation so that it is updated at least twice - and then the subtraction shows up correctly.

    Relevent Code:
    Code (CSharp):
    1.     private IEnumerator RefreshHack()
    2.     {
    3.         transform.localScale += new Vector3(0, 0.01f * Time.deltaTime, 0);
    4.         yield return new WaitForSeconds(0.01f);
    5.  
    6.         transform.localScale -= new Vector3(0, 0.01f * Time.deltaTime, 0);
    7.         yield return new WaitForSeconds(0.01f);
    8.     }
    and the brush is being checked for changes and updated every tick

    Code (CSharp):
    1.     public static void SetMatrix(this CSGTreeBrush brush, Transform transform)
    2.     {
    3.         brush.LocalTransformation = Matrix4x4.TRS(transform.localPosition, transform.localRotation, transform.localScale);
    4.     }
    Any ideas?
     
  29. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    @Player7 so you want to turn off realtime csg, but not the grid? I'd have to think about how to set that up in a clean way ... in the meantime you could just have the realtime CSG window, but tab it underneath another window, maybe?

    @Falagard Perhaps one day .. certainly would help if you let Unity how you feel ;p

    @tarahugger I'm not sure why there is a delay, but you could try to call CSGModelManager.EnsureBuildFinished()
     
    Petethegoat likes this.
  30. CrowbarSka

    CrowbarSka

    Joined:
    Dec 15, 2009
    Posts:
    192
    Hey! Loving this tool so far. I just blocked out a whole level in record time and feel very comfortable using it as a Source SDK / Hammer veteran.

    I'm having a couple of issues though...

    1. After doing a lot of work, I hit Play to test it but constantly get this error:

    Invalid editor window UnityEditor.FallbackEditorWindow
    UnityEditor.EditorApplicationLayout:SetPlaymodeLayout()


    After quitting Play mode the RealtimeCSG tab now says "Failed to load" and is blank.

    2. I'm trying to just create 2 rooms with a doorway alcove between them. I have 3 adjacent Subtractive boxes, all flush against each other, but some of the faces behave differently to each other and I don't get a hole in the wall.

    Take a look at this gif to see what I mean: https://imgur.com/TEiIoWl

    I've read the docs and it seems to be an order of operation issue, where it depends on the hierarchy order. If that's the case, is there a simple way to change that order without delving into Operations?

    Thanks!
     
  31. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    Yeah the grid toolbar at the bottom of the scene view looks good and useful, I mean if and when it works for everything.. I do think an icon on that toolbar to toggle realtime CSG tool could be used.. detaching it to a window and putting it in another panel that is hidden is really just more worfklow steps to use it again, and I think when I'm going to use it CSG having it actually in the scene view is better use of screen space than having it windowed or docked in another panel (likely meaning it would be taking up space that another panel would otherwise be shown in)

    I've always thought a game engine should have good CSG tools, the hammer editor was pretty good if not the best for its time... Probuilder I believe was doing some CSG tooling, but it's not the main area and I doubt it will match this. So I think Realtime CSG actually working in game realtime would be great and could open up for some really fun gameplay with the way it can cut through geometry.

    I do think you should utilize the scene hierarchy to show csg objects with an icon with the operation they are doing, like subtraction etc, and if they are hidden distinguishing that in the hierarchy would help find them aswel, could be other ideas to flesh out with improving things using more of the scene hierarchy to visualize that more.
     
  32. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    @CrowbarSka Hi, great to hear that you like realtime CSG :)
    As for your problems; the SetPlaymodeLayout thing is a unity bug. You can fix it by Go to Window > Layouts > Revert To Factory Settings. (It will erase any layouts you currently have). The "Failed to load" thing is weird, it sounds like a Unity bug as well, might be related to the first? Let me know if you still have this problem after reverting your layout ...

    As for 2. there is a big in RCSG at the moment that can happen when surfaces are exactly on top of each other, it was accidentally introduced in a previous version and I haven't yet had time to debug it.. If you make the subtractive brush a bit bigger it should work for now. Also, fyi; you can change the order of brushes by dragging brushes higher or lower in the hierarchy, you don't need to use Operations to change the order of brushes.

    I hope that helps!

    @Player7 Well I obviously think CSG tools are great for level design as well, otherwise I wouldn't be spending so much time on this ;)
    Realtime CSG 2 will have runtime support, but it'll be some time before that's out.

    I'm confused about your third paragraph though, Realtime CSG is already showing the operations of brushes in the hierarchy:
    csg_operations.PNG
     
    Mark_01 likes this.
  33. Petethegoat

    Petethegoat

    Joined:
    Jun 12, 2013
    Posts:
    39
    Where's the most productive place to do this?
     
    hippocoder likes this.
  34. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    I get an error on that one, 2019.1a.. sorry was just trying it out in another project that I was testing on that version figured you might aswel know about it.
     
  35. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    @Petethegoat I'm not sure? Create a post in Worldbuilding forum maybe? I feel conflicted here .. telling someone where to ask unity to acquire an asset that I own, while working at unity ;p

    @Player7 The latest version already fixes that compilation error on 2019.1a: https://realtimecsg.com/updates/index.php
    2019.1 isn't properly supported yet though, I haven't gone through it and see if there are other issues. At the very least the visibility toggle won't work on brushes and operations .. it should work on models though
     
    Petethegoat and Mark_01 like this.
  36. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    weird I don't get any icons like that showing in the hierarchy.. infact some of the grid toolbar icons don't show either.. like the toggle show grid icon is missing, while the XYZ show up.. all works but yeh icons are missing for me in the project I'm using this in which is 2018.2.17f1 and using version RealtimeCSG[1_543][Unity2018_2_3f1]
     
  37. LogicalError-Unity3D

    LogicalError-Unity3D

    Unity Technologies

    Joined:
    Aug 7, 2015
    Posts:
    58
    @Player7 Ok, this is confusing .. I just installed 1.543, both full and eval version, in professional and personal skin .. and it looks fine from over here? Weird. Can you try deleting your realtime csg folder (when unity is not running) and reinstall it?
     
  38. LogicalError-Unity3D

    LogicalError-Unity3D

    Unity Technologies

    Joined:
    Aug 7, 2015
    Posts:
    58
    @CrowbarSka do you still have issues? let me know if you do
     
  39. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    Just tried that and it actually worked, icons are back now, last time I just updated to the latest and figured that would sort it out but it didn't oh well.
     
    logicalerror likes this.
  40. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    I just uploaded version 1.544, which has a couple of small improvements.
    • Improved line rendering
    • Grid no longer shows gridlines smaller than the current grid size
    • Update lightmap UV button now also visible in surface mode
    • Surface edit mode window now has scrollbar when it's too small
    • Surface edit mode window now has button to select as the surfaces of all brushes that are currently selected (issue #279)
    • Max sphere splits / Max cylinder sides can now be set in options preference menu (issue #278)
    • Edit mode window now has option to automatically commit an extruded shape after extruding it from a polygon


      auto_commit.PNG


      Note that when it's off, you can just press enter after each operation, which would essentially do the same.
      But this is just a little bit better workflow when you need to do something like this.

      continuous_extrude.gif
     
    Last edited: Dec 10, 2018
    tarahugger, Player7, 2dgame and 2 others like this.
  41. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    This is better, I wouldn't say perfect, I think ideally more preference options on it like coloring/opacity etc might help.. Also the two other issue with it is that in orthographic compass view some directions just won't show the grid not sure I'm missing something on that or a bug and another is that at certain zoom levels the grid can disappear :(

    Also not sure if you use the asset Odin inspector, but it seems if you are in the RealtimeCSG with the Edit or Generate tab selected, if the Surfaces toggle is down in the inspector where it shows materials, well it's causing some massive editor slowdown, hiding the surfaces pulldown and it goes away.. strangely when in the tabs Place,Clip,Surfaces you can the have the surfaces materials showing and it doesn't cause any slowdown.
     
  42. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    @Player7 the color/opacity of the gridlines can be modified by changing the Center Axis/Grid/Guide line colors in preferences

    I've create the following issues for you
    grid lines sometimes not showing up properly in orthographic camera Bug #283
    showing lots of surfaces in the inspector slows down unity #284

    the slowdown is because rendering the material icon is done by calling some unity code .. which is not too efficient .. if you have lots of these then it'll slow down unity .. I'll see if I can work around it
     
    Mark_01 likes this.
  43. CrazeDevelopment

    CrazeDevelopment

    Joined:
    Nov 26, 2010
    Posts:
    22
    @Falagard Perhaps one day .. certainly would help if you let Unity how you feel ;p

    What would be the best way to inform unity we would like it to be integrated? I am all for pushing on that. Could you put a link on your site to let people vote toward that?
     
  44. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
  45. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    I'd like to share some information about realtime CSG 2.0!

    So in realtime CSG 2.0, generators will be components, so they'll stay editable forever. You can still convert them to regular brushes of course, but you'll lose the context of a generator

    some work in progress examples:

    Spiral stairs generator
    spiral_stairs.gif

    Revolving shape generator:
    revolving_shape (1).gif

    Pathed stairs:
    pathed_stairs.gif

    Another idea is to have modifiers in the scene that automatically create chamfers/bevels or clip geometry
    For example, you could have a bevel between two brushes and when you move one, the bevel will adapt to the intersection between the two brushes, in real time obviously.

    I'm also moving the CSG algorithm to C# to be able to, more easily, support more platforms & runtime.
     
    Last edited: Jan 3, 2019
  46. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    Other ideas are adding a 2d editor and a palette to drag & drop materials/surfaces & brush prefabs from

    The concept of a surface (I might change the name) is that you have something that groups together things like a material, physicmaterial, several parameters such as "visible", "collidable", "receive shadows" etc. and I'm also planning on adding a way to add additional user information (so additional gameplay information like "footstep audio group" or "is climbable" could be added).
     
    Last edited: Jan 3, 2019
    Mark_01 likes this.
  47. Quakeulf

    Quakeulf

    Joined:
    Mar 26, 2013
    Posts:
    40
    How are colliders working for these?
     
  48. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    Super cool, the bevel/chamfer is probably what I look forward to the most, depending on the implementation it would allow for more finished geometry to be textured and used right in engine without exporting out to add more detail. Not sure if it could be done like setting selected edges to have a modifier bevel that can be adjusted, bit like sub div edge creasing, only with it working a little differently in this.. LOD levels tied into the edge beveling based on camera distance?

    Also I'd love to see scene panel that is designed around supporting a 4grid view, complete with maya like hit [space bar] to toggle fullscreen in that view and back out again to the 4grid view, where each of the grid view maybe just has an overlay grid settings toolbar instead of a permanent view of that toolbar per grid as it would chew up height space..
     
  49. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    @Quakeulf the CSG algorithm creates multiple meshes, one for each material for rendering, and one for each physicMaterial for physics.. which are then all automatically hooked up to MeshRenderers and MeshColliders. This way they're compatible with generating navmesh, doing lightmapping etc. etc.

    @Player7 LOD levels is something I'm thinking about, but just not sure how to implement them in a simple way. I haven't implemented the bevel/chamfering thing (even though I already know how to implement it), so I haven't started on the UX yet .. so any feedback on this is useful :)
    I'm considering the edge approach, but there might be some caveats, we'll see

    When it comes to the 4grid approach, that sounds useful!
    but in the meantime .. you probably already know this, but you know you can store/load your own custom layouts in the top-right corner, right?
     
  50. tarahugger

    tarahugger

    Joined:
    Jul 18, 2014
    Posts:
    129
    Awesome! Personally the biggest thing i miss working in Unity is being able to use line-by-line profiling like ANTS and DotTrace.

    This is an interesting idea, perhaps as a long flag for lots of options, it might be possible then to use it as a navmesh - maybe that's the intention with naming it a surface like NavMeshSurface?

    If possible i'd love to see the various vertex/face operations be designed to be easily coded against by the user with an API. Like if i wanted to store a point/face reference (or just a fast way to find it) then be able to extrude face or translate point etc. Also, being able to smartly divide a face or edge is really important for world building.

    Another thought, it would be cool to have a way to merge shapes. I found while building a scene that i ended up wanting to reduce the amount of calculations and simplify and merge the level geometry to reduce the size of the CSG tree and setup processing.

    UX looks good so far, being able to modify it in-place in the scene like you're showing with the dragging of points around is much better than inputting numbers and fiddling with widgets in a disconnected form/inspector, but it has to be done in a minimalist way as to not overwhelm or confuse. I like 'tools' approach as a way to segment off the functionality so that you're still working on it / in-place but doing a specific task at a time and limiting the GUI to only relevant things. For example, user selecting extrude, divide mode etc.

    Anyway it's really impressive so far, i am excited to see it progress. :D