Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

[RELEASED] Realtime CSG - level design for Unity

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

  1. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    162
    @matteumayo I have a theory what might be going on. Unity has the ability for programs to set compilation defines, which are useful to turn pieces of code on or off depending on platform, unity version, or in this case, if realtime-CSG is present or not. Unfortunately the way this has been implemented on Unity is a single string containing all user-defines. When this string is changed unity will recompile everything.

    I have a theory VRTK is overwriting these user-defines and removing the defines created by realtime-CSG, then realtime-CSG notices that they're missing and adds them back again. In between unity recompiles everything and this creates an infinite loop.

    You can test this by replacing the line:
    PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, stringBuilder.ToString());
    with
    //PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, stringBuilder.ToString());

    in the file UnityCompilerDefineManager.cs
    I'm going to take a look at VRTK

    @dadude123 thanks for the stack trace, I'll see if I can figure out what happened
     
    matteumayo likes this.
  2. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    162
    @matteumayo Turns out the symbol thing was my fault. Apparently I was changing the order of the symbols, oops. I have a fix ready, I'll submit it soon
     
    matteumayo likes this.
  3. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    700
    There is something wrong with the freeform generator in 511.
    https://streamable.com/1z44t

    The shape can't be commited, and there's some 3rd red point out there somewhere (also visible in the video)

    By the way, the ability to cycle through the bezier modes by double-clicking a vertex is really awesome! (but a bit hidden, I found it on accident :p)

    edit: the bug seems to heavily depend on accurate placement, so turning on grid snapping is required (but its possible to make it happen without grid as well if you're really accurate)
     
    Last edited: Jan 5, 2018
  4. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    162
    I just released version 1.512 which fixes @matteumayo ’s issue with VRTK combined with realtime CSG causing an infinite compile loop, and @dadude123 ’s problems with freedraw mode + curved lines (and yes, probably need to make some functionality easier to find!)
     
    matteumayo and dadude123 like this.
  5. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    162
  6. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    700
    Great work!
    Any idea what causes lines to sometimes flicker and become unselectable?
    (also happens to the lines in rotation mode, so you have to try all sorts of camera angles until the rotation edge becomes selectable)
    https://streamable.com/8c06g

    Also for some reason I often get this now (at the end of the video)
    "Could not create brush from given 2D shape"
    https://streamable.com/hpel3


    Are there some restrictions on what 2D shapes are valid?


    edit 1:
    Somehow I'm now unable to reproduce the "could not create brush" error.
    Got a crash two more times, but other than that and the line selection thing everything is working pretty well now.

    Freeform brushes are pretty awesome :)
    https://i.imgur.com/zsKU9yZ.jpg


    edit 2:
    The recent crash has a different stack trace, this time at CreateModelMeshes():

    Code (csharp):
    1.  
    2.  
    3. 0x000000007729F23C (ntdll) RtlAnsiStringToUnicodeString
    4. 0x0000000077051A0A (kernel32) HeapFree
    5.   ERROR: SymGetSymFromAddr64, GetLastError: 'Es wurde versucht, auf eine unzulässige Adresse zuzugreifen.' (Address: 000007FED56F5CCC)
    6. 0x000007FED56F5CCC (RealtimeCSG[1.512]) (function-name not available)
    7.   ERROR: SymGetSymFromAddr64, GetLastError: 'Es wurde versucht, auf eine unzulässige Adresse zuzugreifen.' (Address: 000007FED56EAD10)
    8. 0x000007FED56EAD10 (RealtimeCSG[1.512]) (function-name not available)
    9.   ERROR: SymGetSymFromAddr64, GetLastError: 'Es wurde versucht, auf eine unzulässige Adresse zuzugreifen.' (Address: 000007FED571D041)
    10. 0x000007FED571D041 (RealtimeCSG[1.512]) (function-name not available)
    11. 0x000007FED5729280 (RealtimeCSG[1.512]) CreateModelMeshes
    12. 0x000000000C3240A6 (Mono JIT Code) (wrapper managed-to-native) RealtimeCSG.NativeMethodBindings:CreateModelMeshes (int,UnityEngine.Matrix4x4&,RealtimeCSG.MeshType,int,RealtimeCSG.VertexChannelFlags)
    13. 0x000000000C32435D (Mono JIT Code) (wrapper delegate-invoke) RealtimeCSG.CreateModelMeshesDelegate:invoke_uint__this___int_Matrix4x4&_MeshType_int_VertexChannelFlags (int,UnityEngine.Matrix4x4&,RealtimeCSG.MeshType,int,RealtimeCSG.VertexChannelFlags)
    14. 0x000000000C3223FB (Mono JIT Code) [C:\Users\User\Documents\ProceduralTest\ProceduralTest\Assets\Plugins\RealtimeCSG\Editor\Scripts\Control\Managers\InternalCSGModelManager.cs:2996] RealtimeCSG.InternalCSGModelManager:GetModelMesh (InternalRealtimeCSG.GeneratedMeshes,int,UnityEngine.Matrix4x4&,RealtimeCSG.VertexChannelFlags,RealtimeCSG.MeshType,int,UnityEngine.Material,UnityEngine.PhysicMaterial,bool,System.Collections.Generic.HashSet`1<InternalRealtimeCSG.GeneratedMeshInstance>)
    15. 0x0000000045BB2E1A (Mono JIT Code) [C:\Users\User\Documents\ProceduralTest\ProceduralTest\Assets\Plugins\RealtimeCSG\Editor\Scripts\Control\Managers\InternalCSGModelManager.cs:3288] RealtimeCSG.InternalCSGModelManager:UpdateMeshes (System.Text.StringBuilder,bool)
    16. 0x0000000045B5C417 (Mono JIT Code) [C:\Users\User\Documents\ProceduralTest\ProceduralTest\Assets\Plugins\RealtimeCSG\Editor\Scripts\Control\Managers\InternalCSGModelManager.cs:2370] RealtimeCSG.InternalCSGModelManager:Refresh (bool)
    17. 0x0000000045B9EA65 (Mono JIT Code) [C:\Users\User\Documents\ProceduralTest\ProceduralTest\Assets\Plugins\RealtimeCSG\Editor\Scripts\Control\Managers\UpdateLoop.cs:219] RealtimeCSG.UpdateLoop:RunEditorUpdate ()
    18. 0x00000000426F1504 (Mono JIT Code) (wrapper delegate-invoke) UnityEditor.EditorApplication/CallbackFunction:invoke_void__this__ ()
    19. 0x00000000426F1119 (Mono JIT Code) [C:\buildslave\unity\build\Editor\Mono\EditorApplication.cs:127] UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()
    20. 0x0000000031F90A8E (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr)
    21. 0x000007FEBD0B64AF (mono) [c:\buildslave\mono\build\mono\mini\mini.c:4937] mono_jit_runtime_invoke
    22. 0x000007FEBD008A19 (mono) [c:\buildslave\mono\build\mono\metadata\object.c:2623] mono_runtime_invoke
    23. 0x00000001407EC7C9 (Unity) mono_runtime_invoke_profiled
    24. 0x0000000140A224BE (Unity) CallStaticMonoMethod
    25. 0x0000000140A225CF (Unity) CallStaticMonoMethod
    26. 0x0000000140A23641 (Unity) CallStaticMonoMethod
    27. 0x0000000141186763 (Unity) SceneTracker::Update
    28. 0x00000001411E9AEF (Unity) Application::TickTimer
    29. 0x000000014140EB0F (Unity) MainMessageLoop
    30. 0x00000001414103B5 (Unity) WinMain
    31. 0x0000000141E643A8 (Unity) __tmainCRTStartup
    32. 0x00000000770459CD (kernel32) BaseThreadInitThunk
    33. 0x000000007727A561 (ntdll) RtlUserThreadStart
    34.  
    35.  
    edit3:
    Happened again, this time while preparing some clipping operation on a subtractive brush. (a cylinder, subtracting from another, bigger, cylinder)
    Code (csharp):
    1.  
    2.   ERROR: SymGetSymFromAddr64, GetLastError: 'Es wurde versucht, auf eine unzulässige Adresse zuzugreifen.' (Address: 000007FEF87D2CFE)
    3. 0x000007FEF87D2CFE (RealtimeCSG[1.512]) (function-name not available)
    4.   ERROR: SymGetSymFromAddr64, GetLastError: 'Es wurde versucht, auf eine unzulässige Adresse zuzugreifen.' (Address: 000007FEF87F487E)
    5. 0x000007FEF87F487E (RealtimeCSG[1.512]) (function-name not available)
    6.   ERROR: SymGetSymFromAddr64, GetLastError: 'Es wurde versucht, auf eine unzulässige Adresse zuzugreifen.' (Address: 000007FEF87F0979)
    7. 0x000007FEF87F0979 (RealtimeCSG[1.512]) (function-name not available)
    8. 0x000007FEF881ACEC (RealtimeCSG[1.512]) GetBrushOutlineSizes
    9. 0x000000004A1A2837 (Mono JIT Code) (wrapper managed-to-native) RealtimeCSG.NativeMethodBindings:GetBrushOutlineSizes (int,int&,int&,int&,int&,int&,int&)
    10. 0x000000004A1A1435 (Mono JIT Code) [C:\Users\User\Documents\ProceduralTest\ProceduralTest\Assets\Plugins\RealtimeCSG\Editor\Scripts\Control\Bindings\NativeMethodBindings.cs:1563] RealtimeCSG.NativeMethodBindings:GetBrushOutline (int,UnityEngine.Vector3[]&,int[]&,int[]&,int[]&,int[]&,int[]&)
    11. 0x000000004A1A26A3 (Mono JIT Code) (wrapper delegate-invoke) RealtimeCSG.GetBrushOutlineDelegate:invoke_bool__this___int_Vector3[]&_int[]&_int[]&_int[]&_int[]&_int[]& (int,UnityEngine.Vector3[]&,int[]&,int[]&,int[]&,int[]&,int[]&)
    12. 0x0000000044D21F2C (Mono JIT Code) [C:\Users\User\Documents\ProceduralTest\ProceduralTest\Assets\Plugins\RealtimeCSG\Editor\Scripts\View\Scene\Rendering\BrushOutlineManager.cs:91] InternalRealtimeCSG.BrushOutlineManager:GetBrushOutlines (int[])
    13. 0x0000000044D218D6 (Mono JIT Code) [C:\Users\User\Documents\ProceduralTest\ProceduralTest\Assets\Plugins\RealtimeCSG\Editor\Scripts\View\Scene\Rendering\CSGRenderer.cs:56] RealtimeCSG.CSGRenderer:DrawSelectedBrushes (RealtimeCSG.LineMeshManager,RealtimeCSG.LineMeshManager,int[],UnityEngine.Vector3[],UnityEngine.Color,single)
    14. 0x000000000E5CDF2B (Mono JIT Code) [C:\Users\User\Documents\ProceduralTest\ProceduralTest\Assets\Plugins\RealtimeCSG\Editor\Scripts\View\GUI\EditModeGUI\EditModes\EditMode.Clip.cs:1096] RealtimeCSG.EditModeClip:OnPaint ()
    15. 0x000000000E5C4E90 (Mono JIT Code) [C:\Users\User\Documents\ProceduralTest\ProceduralTest\Assets\Plugins\RealtimeCSG\Editor\Scripts\View\GUI\EditModeGUI\EditModes\EditMode.Clip.cs:1213] RealtimeCSG.EditModeClip:HandleCreatePointEvents (UnityEngine.Rect)
    16. 0x000000000E5C4097 (Mono JIT Code) [C:\Users\User\Documents\ProceduralTest\ProceduralTest\Assets\Plugins\RealtimeCSG\Editor\Scripts\View\GUI\EditModeGUI\EditModes\EditMode.Clip.cs:999] RealtimeCSG.EditModeClip:HandleEvents (UnityEngine.Rect)
    17. 0x0000000044CAD80A (Mono JIT Code) [C:\Users\User\Documents\ProceduralTest\ProceduralTest\Assets\Plugins\RealtimeCSG\Editor\Scripts\View\GUI\EditModeGUI\EditModeManager.cs:514] RealtimeCSG.EditModeManager:OnSceneGUI (UnityEditor.SceneView)
    18. 0x0000000044C8802D (Mono JIT Code) [C:\Users\User\Documents\ProceduralTest\ProceduralTest\Assets\Plugins\RealtimeCSG\Editor\Scripts\Control\Managers\SceneViewEventHandler.cs:54] RealtimeCSG.SceneViewEventHandler:OnScene (UnityEditor.SceneView)
    19.  

    I know that crashes like that are really really hard to track down.

    But I'm hoping that eventually we'll find something that all those stack-traces have in common.
    Maybe a method that all of the methods call (at least the last ones we can see before the stack trace goes into "no file name or line number available" mode.

    If that doesn't help, or if you need different information, let me know!
     
    Last edited: Jan 6, 2018
  7. matteumayo

    matteumayo

    Joined:
    Jul 25, 2016
    Posts:
    164

    Thank you so much! Amazing support as always. :)
     
    logicalerror likes this.
  8. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    700
    @logicalerror
    Good news! I figured out a guaranteed way to reproduce an instant the crash.

    - Add cylinder
    - Subtract another cylinder
    - Add sphere, set to intersect
    - Try to apply clip to sphere, and move the clipping points around

    I recorded two videos of it.

    https://streamable.com/og34u

    https://streamable.com/kqfv1

    Happens every time. Hopefully that will make it much easier to figure out whats going wrong here :)

    The stack trace in the editor log always ends in those methods:
    Code (csharp):
    1.  
    2. 0x000007FEE520ACEC (RealtimeCSG[1.512]) GetBrushOutlineSizes
    3. 0x00000000376F3777 (Mono JIT Code) (wrapper managed-to-native) RealtimeCSG.NativeMethodBindings:GetBrushOutlineSizes (int,int&,int&,int&,int&,int&,int&)
    4. 0x00000000376F2375 (Mono JIT Code) [C:\Users\User\Documents\ProceduralTest\ProceduralTest\Assets\Plugins\RealtimeCSG\Editor\Scripts\Control\Bindings\NativeMethodBindings.cs:1563]
    5.  
    Do you think I should invest more time to also find a way to reproduce the crash that is related to "ApplyAnyChanges"? Or do you think that they're essentially the same bug?
     
  9. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    162
    I just released version 1.513 it has more bug fixes and some ui optimization. Edges should be easier to select now, especially on retina displays. (turned out divisions and multiplies are not the same thing!) The crash bug may have been fixed since during some refactoring work I rewrote the code from which the crash seemed to originate.. https://prenominal.nl/forum3/showthread.php?tid=101
     
  10. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    700
    As of right now I didn't get any crash! And I tried all sorts of crazy stuff...
    The edge selection is better as well!

    Do you think it is worth it if I invest some time to make a simple "hollow" and "repeat" modifier/brush component for my project? Or is the parametric modelling workflow that was mentioned a few pages back something that is coming relatively soon?

    Or if the basic API will change a lot in the near future, then I'll just wait until that has stabilized a bit.
     
    Last edited: Jan 9, 2018
  11. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    162
    I will start on the parametric modeling workflow foundation 'soonish', right after the basic API has stablized yeah.. and I wouldn't try to use whats there right now because there's going to be a lot of changes ..
    you could make something that replicates existing brushcomponents though .. that should be safe I suppose
     
    matteumayo and dadude123 like this.
  12. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    700
    1)
    I'm getting some holes in the geometry whenever there are cylinders/spheres inside some other brushes.
    Not sure if this has to do with some internal optimization, but creating a cube and a sphere and then moving them into each other (both addtive), then rotating them around a bit will cause this.
    Not as strong as it is in the video, but it's always there when you look around the "rim" where the sphere intersects the box.

    Video to show it off here, maybe how the holes are formed gives you some information? Let me know if it helps or what I can do to give you better information.
    - https://streamable.com/pjvgs
    - https://streamable.com/aufca

    Sometimes the gaps get pretty large when the model gets more complex.
    If it helps: When rotating an element (a sphere or cylinder) the gaps seem to "snap". So maybe its some kind of rounding error thing? Or some grid snapping?

    2)
    Maybe this is related to (1), or maybe there are two different things at play here.
    Freeform shapes + Intersection brushes have two types of holes.
    The first one is where there are simply some faces missing on the "wave" in the video.
    The second one is at the left and right end of the wave, it looks like there are some triangles cut out of the shape.
    Almost as if the top of the shape is smaller than the bottom, but since I drew it using the grid, that should be impossible.
    https://streamable.com/t9ivl


    3)
    It feels like I'm getting less crashes with 513, but there are still some remaining.
    Here is a trace from the last crash. Maybe it helps that it shows how many functions there are are after the last method where the name is known.

    Code (csharp):
    1.  
    2.   ERROR: SymGetSymFromAddr64, GetLastError: 'Es wurde versucht, auf eine unzulässige Adresse zuzugreifen.' (Address: 000007FEF7AF7FC3)
    3. 0x000007FEF7AF7FC3 (RealtimeCSG[1.513]) (function-name not available)
    4.   ERROR: SymGetSymFromAddr64, GetLastError: 'Es wurde versucht, auf eine unzulässige Adresse zuzugreifen.' (Address: 000007FEF7AF65D4)
    5. 0x000007FEF7AF65D4 (RealtimeCSG[1.513]) (function-name not available)
    6.   ERROR: SymGetSymFromAddr64, GetLastError: 'Es wurde versucht, auf eine unzulässige Adresse zuzugreifen.' (Address: 000007FEF7AE70B7)
    7. 0x000007FEF7AE70B7 (RealtimeCSG[1.513]) (function-name not available)
    8. 0x000007FEF7B0B055 (RealtimeCSG[1.513]) RayCastIntoModelMultiCount
    9. 0x0000000010F5B666 (Mono JIT Code) (wrapper managed-to-native) RealtimeCSG.NativeMethodBindings:RayCastIntoModelMultiCount (int,UnityEngine.Vector3&,UnityEngine.Vector3&,bool,intptr,int)
    10.  
    4)
    There is a bug where when you export to a unity model, the whole model just turns invisible.
    I haven't been able to create a reliable way to reproduce it yet, but I'm looking into it and will try to debug it tomorrow.
     
  13. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    162
    @dadude123 the next time you have a crash, can you look at the path of the dmp file that unity creates and sent it to me + unity version number & realtime-CSG version number? I should be able to debug it then

    1,2,3 I haven't seen before .. it might help if you send me test scenes that contain those issues, my email can be found in the top right corner of realtimecsg.com

    4. ok, well let me know if you find a pattern .. this is the first I've heard of it?
     
  14. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    700
    1) will do. I'll send you an email within the next hour! :)

    2) The repro project I'll send you has the "wave" form as well, but it would be best if you draw it yourself as well (seeing as it is a pretty simple shape that has a variety of issues I mean).

    3) Ok, I'll look into it and try to get a crash dump. I'm using 2017.3.0f3 and rcsg 513, but I'll also write that down when I send a crash dump.

    4) I figured out that it 100% has something to do with culling.
    Video: https://streamable.com/rlbzz
    The mesh suddenly becomes visible in some cases and hides in other cases.
    Adjusting the pivot mode / recentering the pivot also changes things.

    Maybe the model bounds get calculated wrong so the model gets culled?
    But how is that even possible, isn't that 100% done inside Unity?


    edit: Email sent! :)
     
    Last edited: Jan 11, 2018
  15. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    162
    dadude123 likes this.
  16. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    700
    514 is not usable, you can't move any brush, it moves it really far away.

    Edit: also you still can not select all the brushes.
    If you have a few subtractive and additive brushes, some surfaces just dont register.

    In this video you should be able to select "Brush (1)", right?
    But you can't click through the subtractive brush by using selection-cyling /depth-clicking.
     
    Last edited: Jan 11, 2018
  17. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    162
    *sigh* sorry! I'm not having a good run with the latest versions, I blame trying to refactor code while trying to fix bugs. I'm going to separate these development lines to try to avoid this in the future. In the meantime, I quickly made a version 1.515 that should fix your issues
     
  18. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    700
    No problem, don't worry about it!! :) Any programmer (well, semi-experienced at least) will completely understand!

    Refactoring can often be really troublesome to work with as it is. And when you want to publish other releases in the meantime its even worse. (And forward-porting fixed from an older branch isn't all that appealing either, I know, haha).

    The only real usability issues right now are:
    - depth-clicking
    - selecting edges while rotating (has slightly improved in some recent version, maybe 512 I think?), but can be worked around easily by rotating the camera a bunch of times.

    As long as the brushes persist and there's no full breaking change, then everything else can be fixed later.
    That is mesh holes, unity model bounds, ... and crashes will likely be fixed through the refactoring as well.
    So no point really in working on any of that yet I guess.


    Quick question though:
    You mentioned in an earlier post that the foundations for parametric modelling will be layed out soon.
    Do you think now is a good time for us users to make a list of scenarios/features that we'd like to see in the future version?


    I'll test 515 right now :)

    Edit: actually never mind about the depth clicking, as it is, I think it is pretty ok right now.
     
    Last edited: Jan 11, 2018
  19. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    162
    The gaps issue should be fixed in 1.516. It happened when multiple brushes had surfaces that where almost aligned, but not completely .. the algorithm then flip-flopped between deciding if they where aligned or not, depending on which surface from which brush it was working on, causing some surfaces to be shown/removed when they shouldn't o_O

    Regardless, if you purchased it you can download it here https://realtimecsg.com/updates/

    @dadude123 yes! please tell me what kind of scenarios you'd like to use realtime-CSG for, and what features you'd like to see. That'll help me a lot
     
  20. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    700
    516 definitely fixed a problem where there were "phantom-planes" visible inside complex meshes.

    This is how it looks now: https://i.imgur.com/HZaPs4M.png
    And this is how it often looked in earlier versions: (excuse MSPaint skills) https://i.imgur.com/MjHAug2.png

    Cool! I'll prepare a list of modifiers I imagine, scenarios I'd use them in, etc.
     
  21. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    700
    Any updates?
     
  22. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    162
    Hi, sorry for being so quiet this week I've been working hard refactoring all kinds of low level code to be able to make a good solid low level API for realtime-CSG that is easy to understand, use & is performant.
    (I should've replied to your messages before, sorry!)
     
    dadude123 and matteumayo like this.
  23. DragonRider

    DragonRider

    Joined:
    Jul 19, 2012
    Posts:
    9
    Hey, this tool looks fantastic!

    I've been toying around with the eval version and it's a lot snappier and more stable than SabreCSG. It also seems more flexible in general. One thing I really love is the ability to quickly carve out spaces using complex brushes such as spheres. I could never get Sabre to do that without causing Unity to hang for forever ( and I know Sabre is open source now, so I could probably fix it myself, but I'd rather find a tool that just works right out of the box - the intent here is to save time, after all ).

    A few odd little things I've noticed that stand out: Texturing complex surfaces such as spheres and hemispheres feels a little unintuitive ( but then again I'm not an artist so I wouldn't know an intuitive way to texture spheres if it hit me in the head :p ).

    It's hard to get spheres/hemispheres to share the same number of "sides" ( or, edges at the equator ) as cylinders of the same radius. Most of the time they won't quite line up, so if you have a hemisphere sitting on top of a cylinder, there's usually lots of little seams that don't look quite right. Probably not a big problem once properly textured and lit in a "real" game environment, but that just stood out to me.

    Overall, RealtimeCSG looks like it could save me a lot of time in the long run. I look forward to exploring its capabilities in greater depth!
     
  24. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    162
    @DragonRider thanks for the kind words! :)
    I guess I never considered the need to make cylinders and spheres 'match' .. I'm definitely going to add more types of generators soon-ish, a polar sphere is definitely one of the ones I want to add (and I'll make sure it'll match the cylinder perfectly!)
     
    DragonRider likes this.
  25. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    700
    Are circular stairs part of that? :D
     
  26. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    162
    yes, circular stairs are part of the plan. Also stairs that follow a spline
     
  27. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    700
    Wow that sounds awesome!
    So I guess I won't have to jump through hoops to get things like this anymore: (just a quick mockup) https://i.imgur.com/zeAauYw.jpg and stairs like that can be more rounded as well.

    Code-wise, stairs following a spline sounds pretty complicated to do! (so kudos for attempting that already)
    Does that mean that the much easier cases will be possible as well?
    I'm thinking a rectangle, extruded, following a spline to easily make a circular ramp.

    In any case, I can't wait for the new version, those are awesome news :)
     
    Last edited: Jan 25, 2018
  28. mousa3d

    mousa3d

    Joined:
    Jul 9, 2017
    Posts:
    2
    hi
    possible work in other platform after publish ,with code only create and CSGMode.Subtract?

    if possible, how?
     
    Last edited: Jan 25, 2018
  29. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    700
    Do you mean doing CSG operations at runtime? That is not supported.
    This tool is editor only (for now, but there are plans to add a runtime mode eventually).
    You build your scene/model and then export it to a real model (Unity model, or .FBX).
     
  30. mousa3d

    mousa3d

    Joined:
    Jul 9, 2017
    Posts:
    2
    Tnx dadude123 dear
    i am working package booleanmesh and worked for me
     
  31. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    162
    Just a little update;
    For the last week+ I've been working on refactoring the code and building a simpler, easy to use low level native API.
    I'm far along but It'll take a little while longer before it's in a state that I feel I can release that. I also have a couple of bug fixes in the pipeline.

    On top of this low level native API I can then more easily build the component based "generators".
    In the old way the generators would simply create hand editable brushes, in the new way, for example a cylinder created by a generator, will stay a cylinder and you can keep changing all the parameters for as long as you like. There will still be a way to convert these back into editable brushes like before, of course.
     
    matteumayo and dadude123 like this.
  32. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    700
    By editting you mean "mesh editting"? So scaling will still work?
    So I guess clipping, moving edges/verticies, ... will only be possible for "commited" brushes.

    Will we be able to curve the created geometry from generators with splines without converting them to an edittable brush?
     
  33. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    162
    Brush mesh editing, with which I mean modifying the shape of a brush, would only work with editable brushes.
    You'd still be able to move/rotate/scale them of course.

    Clipping on generated geometry would require realtime-CSG to 'remember' all the splits and re-apply them every time the geometry has changed .. which would get messy real quick.
    A possible solution would be that clipping becomes some sort of operation on it's own .. but I have no plans for that at the moment

    The generators would essentially behave like the generators that exist right now, but just that when you re-select your generated objects it still will be 'a generator'.

    So yes, if you have a 'drawn shape' with curved edges etc. you'd still be able to modify that exactly like you can now .. (or have more functionality)
     
  34. terrivellmann

    terrivellmann

    Joined:
    Mar 10, 2015
    Posts:
    21
    Is there a way to snap a face to another face, or a vertice to another vertice without relying on the grid?
     
  35. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    162
    @terrivellmann Not at the moment no .. so you're saying you need vertex snapping with brushes?
     
  36. terrivellmann

    terrivellmann

    Joined:
    Mar 10, 2015
    Posts:
    21
    It could be useful at times! Though I usually stick to the grid and that works out.
    Was mostly wondering if its already there though
     
  37. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    162
    Well it's not a bad suggestion :) I'll add a feature request to the list
    I want to add support for "grid objects" at some point though, which should also help with this.
    You'd basically be able to set a default grid for certain groups of objects in the scene.
    That way, when you, for instance, rotate a building, you could have a local grid within that building (or even in a room in that building) that will make it easy for you to align everything inside it to the grid, relative to that building/room. (if that makes any sense)

    Also; making progress on the low level API, adding lots of automated tests to ensure that it works correctly, is robust and stays robust. Probably going to release it as 'beta' first so that I can have some feedback + have a bit of time to iron out the kinks in the API design. I hope to be able to release a version next week
     
    Last edited: Feb 6, 2018
    matteumayo likes this.
  38. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    700
    That is an awesome idea! I wanted to mention it in the past but I wasn't sure if maybe that would be a ton of work / somehow incredibly complicated. Good to know that this is on the horizon :)

    Can't wait for it :)
    RCSG has become my default tool for quickly creating some geometry for prototyping.
     
  39. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    162
    I'm not going to be able to release a new version this week, still need to fix some issues that popped up (I guess that happens when you start to write automated tests!)

    And regarding the news today about pro-builder being part of Unity now;
    I work at Unity so I've known about this for quite some time now, don't worry, I'm not going to quit working on Realtime-CSG ;p
     
    Adam-Bailey and Petethegoat like this.
  40. Petethegoat

    Petethegoat

    Joined:
    Jun 12, 2013
    Posts:
    36
    Haha, I was going to inquire about it.
    Slightly disappointed they didn't go with realtime CSG instead, I think the CSG model can be a little less fiddly for level design, but a nice addition nonetheless.

    Hopefully their progrids integration will be generic/extensible enough that you'll be able to use it instead of maintaining your own grid implementation!
     
    dadude123 likes this.
  41. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    162
    Actually, I talk to the world-building team (=probuilder) guys often. I'm actively helping to ensure that Unity's grid solution in the future will kick ass :)
     
  42. terrivellmann

    terrivellmann

    Joined:
    Mar 10, 2015
    Posts:
    21
    have you ever talked about what you do at Unity? just curious
     
  43. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    700
    I think so as well. :(
    In my opinion being able to easily change geometry to iterate is the most important feature. And pro builder simply doesn't allow for that (sure you can move vertices, but its way harder to do than moving a "hole", and the geometry often gets broken in tons of ways)
     
  44. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    162
    @terrivellmann until recently I was working on some internal code architectural stuff. But now working on some stuff that I can't really talk about yet, sorry ;)

    @dadude123 well I'm obviously not impartial here, I obviously think csg is a better technique for level design ;p especially when you want to do procedural stuff .. it's hard to procedurally create, for instance buildings, when you have no concept of solidity.
     
    Petethegoat likes this.
  45. Ziboo

    Ziboo

    Joined:
    Aug 30, 2011
    Posts:
    275
    Hi,

    I tested the demo and I'm really impressed, your asset is really awesome.
    You've got the best CSG algorythm on the asset store, I guess you don't use CSG.js like others.
    I would like to use that for a project, but I would need runtime support...
    I know it has been ask before, but do you have plan and maybe an ETA for runtime support ?
    Congrats again, I'm sad that Unity didn't integrated your asset instead of ProBuilder... :(
     
  46. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    162
    Hi @Ziboo, thanks :)

    The algorithm in Realtime-CSG is a unique self developed algorithm, written in C++, so not CSG.js no
    I'm currently laying the foundations of what is going to become runtime support, but I still have some work to do
    I should have a low level editor API to release soon, which will become the runtime API after a bit of real world testing.

    I'm a bit slowed down a bit at the moment due to some unforeseen hardware issues though :(
     
    AFrisby and Ziboo like this.
  47. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    162
    Another quick update, I'm at the point where I'm just writing tests and documentation. Hopefully it doesn't take too much time before I'm done with that.

    Code (CSharp):
    1. // First we create a BrushMesh, which describes the mesh for a brush.
    2. //   For this version you'll still be required to feed it the old controlMesh format.
    3. //   New utility functionality to generate brushes will be added in subsequent versions
    4. BrushMesh brushMesh = BrushMeshLegacyUtility.GenerateFromControlMesh(...);
    5.  
    6. // Then we create a brushMeshInstance, which is essentially a reference to that
    7. //   particular BrushMesh. this allows us to share brush-meshes between multiple
    8. //   brushes.
    9. BrushMeshInstance sharedBrushMeshInstance = BrushMeshInstance.Create(brushMesh);
    10.  
    11. // We can then build our CSG-trees
    12. CSGTreeBrush brush1 = CSGTreeBrush.Create(Matrix4x4.TRS(...),
    13.                                             operation: CSGOperationType.Additive,
    14.                                             brushMesh: sharedBrushMeshInstance);
    15. CSGTreeBrush brush2 = CSGTreeBrush.Create(Matrix4x4.TRS(...),
    16.                                             operation: CSGOperationType.Subtractive,
    17.                                             brushMesh: sharedBrushMeshInstance);
    18. CSGTreeBranch branch = CSGTreeBranch.Create(operation: CSGOperationType.Additive,
    19.                                             brush1, brush2);
    20. CSGTree tree = CSGTree.Create(branch);
    21.  
    22.  
    23. // This array describes the types of meshes we want to generate ..
    24. //    (I'll post more about this another time)
    25. static MeshQuery[] requestedMeshTypes = new MeshQuery[]
    26. {
    27.     // MeshRenderers
    28.     new MeshQuery(LayerUsageFlags.CastShadows, LayerUsageFlags.RenderReceiveCastShadows, LayerParameterIndex.None),
    29.     new MeshQuery(LayerUsageFlags.Renderable, LayerUsageFlags.RenderReceiveCastShadows, LayerParameterIndex.RenderMaterial, VertexChannelFlags.All),
    30.     new MeshQuery(LayerUsageFlags.RenderCastShadows, LayerUsageFlags.RenderReceiveCastShadows, LayerParameterIndex.RenderMaterial, VertexChannelFlags.All),
    31.     new MeshQuery(LayerUsageFlags.RenderReceiveShadows, LayerUsageFlags.RenderReceiveCastShadows, LayerParameterIndex.RenderMaterial, VertexChannelFlags.All),
    32.     new MeshQuery(LayerUsageFlags.RenderReceiveCastShadows, LayerUsageFlags.RenderReceiveCastShadows, LayerParameterIndex.RenderMaterial, VertexChannelFlags.All),
    33.  
    34.     // MeshColliders
    35.     new MeshQuery(LayerUsageFlags.Collider, parameter: LayerParameterIndex.PhysicsMaterial),
    36.  
    37. #if UNITY_EDITOR
    38.     // Debug surfaces
    39.     new MeshQuery(LayerUsageFlags.None, mask: LayerUsageFlags.Renderable), // hidden surfaces
    40.     new MeshQuery(LayerUsageFlags.CastShadows),
    41.     new MeshQuery(LayerUsageFlags.ReceiveShadows),
    42.     new MeshQuery(LayerUsageFlags.Culled)
    43. #endif
    44. };
    45.  
    46. // optional, performs all the CSG for all the trees that have been modified
    47. bool haveChanges = CSGManager.Flush();
    48. if (haveChanges)
    49. {
    50.     // optional, check if this particular CSG tree has changed
    51.     if (tree.IsDirty)
    52.     {
    53.         // Retrieve the kind of meshes that the tree can generate ..
    54.         //   Note that we might end up with multiple unity meshes,
    55.         //   for instance, for a particular material if the vertex count is above 64k.
    56.         //   Realtime-CSG will then return multiple meshes for the same material.
    57.         //   If you haven't performed a flush above, this method will perform the
    58.         //   CSG for this tree only.
    59.         GeneratedMeshDescription[] meshDescriptions = tree.GetMeshDescriptions(requestedMeshTypes);
    60.         if (meshDescriptions != null) // see if we have any meshes at all
    61.         {
    62.             foreach (var meshDescription in meshDescriptions)
    63.             {
    64.                 // Check if this particular mesh has actually changed
    65.                 //    since the last time we retrieved it ...
    66.                 //    (in which case we don't have to retrieve/update the mesh)
    67.                 if (meshDescription.geometryHashValue == prevGeometryHashValue... &&
    68.                         meshDescription.surfaceHashValue == prevSurfaceHashValue...)
    69.                     continue;
    70.  
    71.                 // If it has, we retrieve it from Realtime-CSG
    72.                 GeneratedMeshContents generatedMesh = tree.GetGeneratedMesh(meshDescription);
    73.  
    74.                 // Generate a Unity Mesh from the retrieved data ...
    75.                 Mesh mesh = new Mesh();
    76.                 generatedMesh.CopyTo(mesh);
    77.  
    78.                 // go wild ..
    79.             }
    80.         }
    81.     }
    82. }
    83.  
    Also, during all the refactoring I optimized some pieces of realtime-CSG that improved performance by 50% on a heavy test scene of mine. Iterative changes (like moving brushes) are even more improved.

    csg_test_optimized.gif

    Short version, for this scene CSG is done in under a second.
    It has 3879 brushes, in a complicated hierarchy where lots of brushes overlap.
     
    Last edited: Feb 27, 2018
    Flurgle, Petethegoat and matteumayo like this.
  48. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,140
    Are curved edges disabled in the demo? I had to create a curved arch by clipping a cylinder in half and make it subtractive. In the full version, can I just make a freehand square, then curve the top edge?
     
  49. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    162
    Hi @Stardog , if you double click on the points or edges of the 2d drawn shape you toggle between different curve line modes (broken curve, continuous curve, straight)
    Hmm .. I noticed part of the UI in the helper window is disabled when it shouldn't be, I'll fix that in the next release
     
  50. anatomi

    anatomi

    Joined:
    Jan 9, 2016
    Posts:
    4
    First off, thanks for creating a great tool. I hope it, or at least some of its features, will be incorporated into Unity one day.

    Two questions: Can tool-tips be disabled? And I've nothing particular in mind when asking this (mostly curious), but would it be conceivable to add some kind of functionality that allows a developer to distribute/link to a game-specific, pared-down version of the plugin for modding?