Search Unity

[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:
    207
    @cjacobwade sorry for the late reply! Things have been super busy for me lately.
    Is there a way to use Unity's built-in rotate and scale tools for an entire brush without having to do additional selection
    I'm not sure what you mean with additional selection? In object mode, yes, with rotation the edge selection is the only way at the moment (sorry). As for scaling, you should be able to easily scale the entire brush in object mode when using the rect tool for instance ... no selection of vertices necessary

    Is there a way to vertex snap brushes to vertices on other brushes (as is the default when you hold V before clicking an object)?
    Sadly, no. Chisel (realtime-CSG's successor) is planned to have this though

    Is there a way to surface snap brushes to the surface behind your mouse position including other brushes (as is the default when you hold Ctrl + Shift before clicking an object)?
    I'm not entirely sure what you mean here? You already mentioned the ctrl+shift dragging, which is what I think of when you say "Is there a way to surface snap brushes to the surface behind your mouse position", so I'm not sure what you mean..


    Edit/Shortcuts doesn't exist in all versions, realtime CSG development started in 5.3 and still supports a lot of older versions. Hopefully at some point I can deprecate some older versions so I can remove some old stuff and replace it with new stuff.
    Chisel, realtime-CSG's successor that's in the work, will have 2019.1 as the base version and uses the shortcut manager


    @hippocoder yeah, 2020 is not yet supported since it's in alpha mode. The offset is likely because of sceneview.position returning a different window size than before, which has _never_ properly reflected the actual size of the sceneview area .. but you already know that since we talked about this on the discord :)
     
  2. PartyBoat

    PartyBoat

    Joined:
    Oct 21, 2012
    Posts:
    97
    Is Chisel equivalent to Realtime CSG 2 with run time support and the other improvements that have been in the works for awhile?
     
  3. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    @PartyBoat yes, I've teamed up with the SabreCSG community, and we're working on an open source realtime-CSG successor called Chisel
    The link to the Chisel discord is here: https://discord.gg/zttNkPQ

    I've been working on a new CSG algorithm for a long time now, that will be part of Chisel. It's written in C# and can work at runtime and will work on any platform
     
  4. cjacobwade

    cjacobwade

    Joined:
    Jun 8, 2013
    Posts:
    10
    @logicalerror appreciate the response. Looking forward to Chisel!

    'Additional selection'
    Here I was referring to having to mouse over an edge as additional selection. Hopefully there can be an option to use the regular rotation tool in the future!

    Regarding scaling by using the Rect Tool
    I'm on 2019.1.14f1 and seeing when Realtime CSG is active the regular scale and rect tool aren't available (pressing the shortcuts has no effect).

    'Is there a way to surface snap brushes to the surface behind your mouse position'
    This is referring to the surface snapping you can do by holding Ctrl + Shift and dragging something around, which aligns the transform pivot to the surface under your mouse. It's similar to vert snapping but uses the object pivot instead of vert aligning.
     
  5. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    Stardog likes this.
  6. anton88pro

    anton88pro

    Joined:
    Jul 20, 2017
    Posts:
    61
    Hi!
    Why is it free now? Are you abandoning this asset development or is there still business model behind it?
    I was checking your asset for a long time now, so I was shocked when I didn't see the price tag these time. I'm happy of course, I can try it now, but also a bit worried.
     
  7. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    If you read above... he is working on another project (Chisel) that will be better than RealtimeCSG in the future... until then people have this for free now. Can't see what business model is for it, its just being made free and open sourced so people can learn from it or contribute any fixes.. as his time is better invested in Chisel... no point in selling something you see less reason in fully supporting anymore. Think more asset developers should consider the same if they no longer have time for the asset (many do though actually)
     
  8. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    @anton88pro I'm still supporting Realtime-CSG, but not going to add more features to it (although I will keep accepting PRs on github). Like @Player7 mentioned, I'm working on it's successor Chisel which is also open source, together with the SabreCSG community.

    The plan is that there will be a path to import Realtime-CSG created content into Chisel.
    One of the reasons is that I've regretted some architectural decisions in Realtime-CSG & it was only possible to fix those by rewriting a very large chunk from scratch. At that point it made more sense to have this be a separate project, otherwise I'd have to maintain two code bases that at some point needed to converge.

    I made it open source because, frankly, I wanted help with these projects since they take a lot of my spare time and there's still so much more I still want to do on these tools that I never have time for.

    However, if anyone feels inclined to support my efforts (esp since I gave up my sales), I set up a github sponsor page here: https://github.com/sponsors/LogicalError
    Note that github will match any contribution in the first year :)
     
    anton88pro and Falagard like this.
  9. Lork

    Lork

    Joined:
    Jul 12, 2013
    Posts:
    79
    Is there no way to instantiate a prefab of a CSG mesh at runtime? No matter how I try to do it, they always lose the reference to the mesh unless they were in the scene before the game starts for some reason.

    I'm using 2019.2.6f1.
     
  10. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    @Lork So I'm not entirely sure how much you know about how realtime CSG works, and I'm not sure what you mean with mesh (since different people might mean something different when they say "CSG Mesh")

    So just to make sure we're on the same page, let me explain:
    The model creates Unity meshes and puts them into meshrenderers that are hidden (but can be optionally shown with a property in the CSG Model called "Show Meshes")
    At build time all the models, brushes, operations are removed because realtime-csg doesn't work at runtime, only at editor time. But the MeshRenderers with the meshes remain.

    So if you knew all this, how are you referencing this mesh? and are you talking about a MeshRenderer or a Unity Mesh? or do you mean a reference to the gameobject holding a CSG model?
     
  11. Lork

    Lork

    Joined:
    Jul 12, 2013
    Posts:
    79
    I'm talking about the generated mesh(es) that are used by the MeshRenderers, Colliders, etc. I've tried: the whole CSG model, the provisionally generated meshes (from the show meshes option) and the exported Unity mesh (I know the documentation says this method doesn't work with prefabs, but I had tried everything else I could think of).

    All three of these work if you save them as prefabs, place them in a scene before runtime and then hit play, but if you instead hit play first, then drop them into the scene or instantiate them via script, the references to the generated meshes are lost and the various components throw null reference exceptions.



    I've also tried exporting to an FBX file, and in that case the mesh survives, but the texturing doesn't.
     
  12. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    @Lork Are you using the asset store version, or the latest github version? There have been some prefab related fixes in the latest github version. Not sure if it might be related to some bugs I already fixed
     
  13. Lork

    Lork

    Joined:
    Jul 12, 2013
    Posts:
    79
    I'm using the latest (as far as I know) github version.

    Edit: I'm able to reproduce it in an empty project with Unity 2019.2.13f1. Create a simple CSG model and save/export it as a prefab, then hit play and drag the prefab into the scene - the generated mesh will disappear from all the components that reference it.
     
    Last edited: Nov 26, 2019
  14. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    @Lork what happens when you open up that prefab in isolation mode & save it first?
     
  15. Lork

    Lork

    Joined:
    Jul 12, 2013
    Posts:
    79
    That fixes it, thanks!
     
    logicalerror likes this.
  16. anton88pro

    anton88pro

    Joined:
    Jul 20, 2017
    Posts:
    61
    I got glitchy cylinders.
    Seems like whenever I create a cylinder with high amount of sides it makes a very glitchy looking mesh. The glitch look becomes even stronger when I try to use manipulation (like subtraction cylinder inside another cylinder or a box).
    I also don't want to have a cylinder with a small amount of sides, as it doesn't look smooth enough.
    I'm using Unity 2019.2.10f1
    I tried pressing "rebuild your CSG meshes" button, reopening Unity, but it didn't help.
    Screenshots are attached.
    ex1.png ex2.png ex3.png
     
  17. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    @anton88pro Hmm .. that looks like a quantization effect, I'm guessing your transformation position is a fairly high number?
    Can you send me that part of your scene so I can take a look at it? thanks
     
    Last edited: Dec 2, 2019
  18. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
  19. anton88pro

    anton88pro

    Joined:
    Jul 20, 2017
    Posts:
    61
    I've created new scene to test it and glitches are still here. Scene file:
    https://drive.google.com/open?id=1pbaDy_QwipcfmmtVHBnhqxgK0InLPOlF

    One more bug report. Here in the screenshot in two upper windows the CSG UI looks out of place. It gets back into right place, when the related window is focused again. Is there way to fix it? This bug is present in all of my scenes.
    Снимок экрана (942).png
     
  20. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    Hi @anton88pro I have a fix for the precision issues on the github repository of realtime-csg
    The other problem you mentioned was already fixed there
    I'll publish this version on the asset store after I've fixed a prefab related issue
     
    anton88pro likes this.
  21. nikitatishin5

    nikitatishin5

    Joined:
    Nov 10, 2019
    Posts:
    1
    Hello!
    I really apologize if I missed some details, but I won’t sleep peacefully if I don’t ask. Is it possible to use CSG during program execution? (My graduation project is dedicated to creating a digitalized VR simulator for a stamotologist, if I don’t find a way to “drill” then I’m done =))
     
  22. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    Hi @nikitatishin5 , realtime CSG is editor time only, sorry
    Chisel (realtime CSG's eventual successor) will have runtime support, but it's not ready to be used yet
     
  23. ZiadJ

    ZiadJ

    Joined:
    Sep 3, 2011
    Posts:
    62
    Is the editor dll open source? I'm asking because I couldn't find the code for RealtimeCSG[1_559].dll on github.
     
  24. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    @ZiadJ It's open source, but I didn't open source the c++ dll. At least not yet
    The source code is hard to read, especially if you don't know how the whole algorithm works in the first place.
    I'm working on a managed version of a new algorithm that's easier to understand for Chisel, and I'll backport this to realtime CSG
     
  25. david_kay

    david_kay

    Joined:
    Jul 25, 2017
    Posts:
    22
    Hi there, I'm trying out the realtime CSG tool and I have stumbled upon this: the csg brushes can only be selected when there is no other object behind the brush. If there is another (non brush) object behind it will be selected instead. clicking multiple times will not help, it will toggle between mutliple non brush objects but the brush in front of them will never be selected. Any ideas what might be the problem? I'm using realtime csg from asset store on Unity 2019.2
     
  26. LogicalError-Unity3D

    LogicalError-Unity3D

    Unity Technologies

    Joined:
    Aug 7, 2015
    Posts:
    58
    @david_kay the latest github version should fix (most of) the selection issues
     
    Mark_01, Petethegoat and atomicjoe like this.
  27. ZiadJ

    ZiadJ

    Joined:
    Sep 3, 2011
    Posts:
    62
    Ok, I'm particularly concerned about security when using DLLs actually so I'll be eagerly waiting for the open source version. I know Unity itself is not open source so it kind of defeats the purpose so it's just about minimizing risks of abuse. Thanks for the awesome work you did so far :p
     
  28. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    @ZiadJ it's a native dll for performance reasons. Realtime CSG was created against Unity 5.4 and still supports all the way back to 5.6. The C# compiler (esp. in 5.6) simply isn't fast enough

    However, Chisel (It's successor that's a WIP) will take advantage of the new Burst compiler and the entire CSG algorithm will work in C#. This will also enable runtime support and it'll work on any platform
     
  29. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    1.559 has been released on realtimecsg.com
    It has also been submitted for the Unity asset store
    I'll post a message when it's accepted

    This version has fixes for:
    • Lightmap UV generation
    • Helper surfaces not showing up correctly
    • Selection not working well when other, non CSG, meshes are behind mouse
    • Selection issues when two editor windows overlapped
    • Lots of (nested) prefab related issues
    • Non CSG child objects of CSG brushes/operations/models being removed when they shouldn't on build
    And some other changes:
    • Removed evaluation version specific code
    • Modified license to MIT (same as github version
    • Added in-scene stats window that can be turned on/off in Settings/Realtime-CSG/Show Scene Info (created by Daniel Cornelius)
    Website * Source code * Discord * Sponsor
     
    Last edited: Feb 1, 2020
    muzboz, Mark_01, Petethegoat and 2 others like this.
  30. yeagob

    yeagob

    Joined:
    Jan 27, 2014
    Posts:
    18
    Hi!

    First of all, thanks for your amazing work is an impressive asset.

    Now my question: I need to apply a sustractive operation to an object i have that is not generated b realtime-CSG. Is this posible? What would be the workflow?

    Thanks in advence!!

    Santiago.
     
  31. LogicalError-Unity3D

    LogicalError-Unity3D

    Unity Technologies

    Joined:
    Aug 7, 2015
    Posts:
    58
    HI @yeagob , realtime-CSG has no way to import existing meshes, sorry
     
  32. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    do you work for Unity now?
    Any chance to see CSG implemented internally??
     
  33. LogicalError-Unity3D

    LogicalError-Unity3D

    Unity Technologies

    Joined:
    Aug 7, 2015
    Posts:
    58
    @atomicjoe I've been working at unity for about 5 years now :) As for CSG being implemented in Unity, lets just say I'm still waiting
     
    muzboz and atomicjoe like this.
  34. StefanJV

    StefanJV

    Joined:
    Jun 2, 2020
    Posts:
    9
    Hi, good day. Is intersection only possible with the objects created with this asset? I want to apply intersection to my 3D mesh objects but they were not created with this asset.
     
  35. LogicalError-Unity3D

    LogicalError-Unity3D

    Unity Technologies

    Joined:
    Aug 7, 2015
    Posts:
    58
    Hi @StevanJV boolean operations will only work on brushes created with RealtimeCSG, sorry
     
  36. doodlinbee

    doodlinbee

    Joined:
    Feb 15, 2020
    Posts:
    31
    Hi, fantastic job on that one ! It's really fun to make levels with this, also is there any way to do some vertex/face coloring ? Making a new material for every color variation can be quite messy
     
  37. LogicalError-Unity3D

    LogicalError-Unity3D

    Unity Technologies

    Joined:
    Aug 7, 2015
    Posts:
    58
    @doodlinbee Sorry, realtime CSG doesn't support that ... :(
     
  38. AkamaruDesign

    AkamaruDesign

    Joined:
    Dec 17, 2016
    Posts:
    13
    Hi, great tool, is there any support for runtime? im trying hard but no luck on this one
     
  39. ratking

    ratking

    Joined:
    Feb 24, 2010
    Posts:
    350
    TheGabelle likes this.
  40. Maldaro

    Maldaro

    Joined:
    Jul 29, 2016
    Posts:
    3
    Hello , congratulations for a wonderful plugin. Have been playing around, trying to model some gears with it. What is missing for my goal is the ability to make a model from points from script. Like a free-draw tool, but from script. I have searched your API methods, but I can only find a way to do cubes. So is there a way to do it? Thanks
     
  41. giotta

    giotta

    Joined:
    May 31, 2015
    Posts:
    48

    can i post this ?
     
    LogicalError-Unity3D likes this.
  42. LogicalError-Unity3D

    LogicalError-Unity3D

    Unity Technologies

    Joined:
    Aug 7, 2015
    Posts:
    58
    @giotta of course you can :) that looks interesting, I guess you're using it to simulate a cnc machine or something?
     
  43. Josh_He

    Josh_He

    Joined:
    Nov 19, 2013
    Posts:
    14
    Hi, Unfortunately, I experience a lot of crashes whenever I use lightmap baking and RealtimeCSG in combination. I am using the 1.562 version from the asset store as there seems to be no newer version on the website.
    Unity 2020.3.5f and HDRP.
    Any help is appreciated.
    I absolutely love the plugin and for a lot of things, it is much better than Probuilder. The only downside is the crashes atm for me. Thank you!
     
  44. ratking

    ratking

    Joined:
    Feb 24, 2010
    Posts:
    350
  45. DavidJayIndie

    DavidJayIndie

    Joined:
    Aug 17, 2015
    Posts:
    70
    Hi, I'm using the latest github version, and the UVs are flipped on the x axis when using the subtraction mode (I'm using an inverted world model btw). I can technically flip the UVs manually for each object, but is there a way to have both addition and subtraction operations have the same UV direction automatically?

    Great tool btw, it's saving me so much time, it's amazing :)

     
    Mark_01, NeatWolf and atomicjoe like this.
  46. EJSainz

    EJSainz

    Joined:
    Mar 24, 2015
    Posts:
    30
    Hello! And thanks for a fabulous tool.
    I'm trying to create spheres with more than 7 splits, but as soon as I set splits to 8 the model won't draw anymore. I've been looking for some option that could allow it (32 bit index meshes?) but to no avail.
    Is there a way to do it?
    Thanks a lot!
     
  47. pfassett

    pfassett

    Joined:
    May 28, 2021
    Posts:
    4
    Hey, I have a question. Hopefully this hasn't been answered before. I used RCSG before, and I had this problem that made us restart our project. I recently went back to RCSG because it was just too good a tool to let go of, but the problem has come back. The issue is, when I build up my level, it looks like this. upload_2021-10-24_18-51-10.png

    Then I hit the play button, everything is fine, but after I exit playmode, it does this.
    upload_2021-10-24_18-52-11.png
    All the csg brushes disappear. To get them back, I have to move a brush out of it's parent and put it at the root of the scene.
    upload_2021-10-24_18-53-32.png
    Then the geo comes back.
    upload_2021-10-24_18-53-54.png
    It only started happening when I gave parents to the brushes. How can I avoid this in the future because now, even though I unparented every brush, the geo still disappears and I can't get even new brushes to stop doing it. Has anyone had this happen to them and is there a reliable way to make it stop?
     
  48. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    207
    Hi @pfassett , are you using the latest github version?
    I've not seen or heard about this particular problem, so this is weird ..
    When you toggle "show meshes" on the model you can see the meshes generated by realtime CSG, can you compare them to the meshes you see when you hit play? I wonder what's different
     
  49. doodlinbee

    doodlinbee

    Joined:
    Feb 15, 2020
    Posts:
    31
    Hi @logicalerror, is there a way to select all surfaces that share a same material for a given model? That would be cool to be able to quickly cycle through materials and change the look of a whole level instantly
     
  50. Krueg82

    Krueg82

    Joined:
    May 29, 2017
    Posts:
    6
    Hi @logicalerror, I'm really liking the tool so far. I had a question about applying materials using the G key. Not the smear feature but "grabbing" a material and then clicking on surfaces to apply that material. How do I tell it to stop using the old material and grab a new one? I've tried deselecting everything first but it still wants to continue applying the old material when I click on surfaces holding G. The only way I get it to grab a new material is to apply the old one and then undo, which seems to "clear" the old material and I can now grab a new one. Is there a cleaner way to say "I'm done applying the previous material, let me grab a new one?"