Search Unity

[RELEASED] Realtime CSG - level design for Unity

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

  1. CrazeDevelopment

    CrazeDevelopment

    Joined:
    Nov 26, 2010
    Posts:
    20
    YES, THIS YES. I would really really love to have this feature. It would make, for instance, a pit of lava a lot easier. I won't have to build a collider to manually fit my shape or hackily place collider planes all over the place to define where I might kill the player.

    Also do you have a discord for RealtimeCSG? I would love a simple place to just drop cool images in regards to CSG stuff. Happy to make RealtimeCSG a discord! Always good for a little community to have an area to chat and support itself. I made Bolts original discord, with much convincing of the author. It's pretty big now, I handed off all ownership to Ludiq. If you don't like discord, totally get it! Just an idea.
     
    Last edited: Jan 5, 2019
  2. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    175
    @tarahugger yeah I'd love to be able to debug unity line by line as well .. maybe some day ...
    the idea is that in the next version there will be a low level API that does all the good stuff and the editor UI basically works on that API. So anything you can do in the editor, you could, by definition, also do in the API

    And if you want to work straight on the API and forego the UI entirely because you just want to procedurally generate something, you'll be able to

    Brushes can only be convex, so you'd only be able to join shapes if they're both convex. This is for algorithmic complexity reasons.. convex shapes are just so much easier to deal with, it's not even a contest. I may add generators that internally have multiple brushes, yet pretend to be one shape though. So from the UI it could potentially look like it's a generic shape & that it's actually something more complex underneath would be hidden from the user. (at least it's something I've been thinking about, probably not a v1 thing because I already have so much to do for v1)

    I'm definitely not going to put all options in the in-scene generators for that very reason, it would be such a mess of handles that it would be more likely that you do the wrong thing than the right thing & visual clutter would drive you wild.
    There will be an optional thing where you can see the measurements of the generators so you can see lengths, heights, depths, angles etc. etc. in case you need to be super precise about what you're making. This should help when you want to make sure doorways are traversable, ceilings are at a reasonable height etc. etc.
     
  3. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    175
    @CrazeDevelopment The runtime part of realtime CSG will have some sort of API that allows you to raycast into the world to find surfaces and their additional data. This will be available even if you baked the model to a mesh at build time.

    I just created a Realtime CSG discord: https://discord.gg/Aq8meZF
    I didn't make any channels yet, and I'll be traveling the next couple of days, but it's there :)
     
    CrazeDevelopment likes this.
  4. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,287
    Yeah I tend not to use it other than having setup one custom one, I guess I just hadn't seen something like a script where you can setup two or more layouts and toggle/cycle them with a hotkey? I'm sure it exists just not seen in it or looked into it.

    "I'm considering the edge approach, but there might be some caveats, we'll see"
    It seemed like a good way in my head but implementation and problems with doing it that way is a totally different thing :)
     
  5. Quakeulf

    Quakeulf

    Joined:
    Mar 26, 2013
    Posts:
    40
    Ok, so no composite colliders?
     
  6. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    175
    Realtime CSG creates meshColliders if the csg model is 'static'. It doesn't create composite colliders for dynamic objects though .. which should be do-able with a bit of elbow grease though
     
    Mark_01 likes this.
  7. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    175
    So over the last couple of weeks I've been busy with the new CSG algorithm I thought up. I got the start (cutting) and end (triangulation) of the algorithm working, now I need to put the stuff in middle that makes it a full CSG algorithm. No mesh optimizations/fix-ups needed!
    cutting_without_optimizing.gif
    ---------
    Join the Realtime CSG discord: https://discord.gg/Aq8meZF
     
    Last edited: Feb 4, 2019
    Stardog, tarahugger and Mark_01 like this.
  8. giotta

    giotta

    Joined:
    May 31, 2015
    Posts:
    39
    Sorry for my english, it's really bad.
    Can I ask you if you're implementing some kind of mesh modification in runtime?
    I have not yet figured out if you can do something like this with your asset:
     
  9. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    175
    @giotta There will be runtime support in realtime csg 2 yes. The final mesh is generated from a CSG tree structure, where you can define which shapes (brushes) are added and removed to create a final shape. It doesn't work directly on a mesh, it creates a mesh. So if you wanted to do something like this, you'd have to basically constantly add new brushes to the tree or modify the shape of existing brushes.

    Actually, looking at this video, you could probably do this using some sort of height-field, which would be a lot simpler
     
    Last edited: Feb 5, 2019
  10. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    175
    I have an announcement to make!

    I've teamed up with the SabreCSG community to start building RadicalCSG, which will basically be a combination of the best parts of RealtimeCSG and SabreCSG, build from scratch using the lessons learned from what didn't work so well in both CSG tools to do better this time

    It'll be open source and it'll be free

    Note however that not a single line of code has been written yet!
    (although it'll most likely use parts of what I've already written for Realtime CSG 2.0)

    You can find the discord server for Radical CSG here: https://discord.gg/tqwmKrc

    Also, I will obviously keep supporting Realtime CSG. And there will be a way to import Realtime CSG and SabreCSG models into RadicalCSG
     
    atomicjoe, Regularry, Stardog and 3 others like this.
  11. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,287
    Very cool.. yeah I could see it being tough doing it as a one man job, tools like this need more people involved at different parts to move things forward, or more funding to go fulltime It is a shame Unity never took it on internally, CSG tools are great and one like this was really good, but lacks features to compete with outside 3d modelling tools, at which point it's just another exporting/importing process you'd have to do to get more refinements on geometry etc, when ideally you want to be able to do as much if not everything in one engine.

    So I look forward to the progress on RadicalCSG :D
     
    logicalerror likes this.
  12. giotta

    giotta

    Joined:
    May 31, 2015
    Posts:
    39

    Thank you for your answer.
    When you say that I should not modify a mesh but create it through a brush tree, do you mean this? (I try to attach an image to make it clearer) giotta.png



    The problem is that once you have overcome the 40 brushes, everything slows down.
    Do you think it is possible with the changes you are making for the runtime that this becomes possible?
    At present, however, it is not possible to do anything?
    Thanks again
     
  13. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    175
    @giotta the realtime csg algorithm works iteratively, so it only updates what changed. If you overlap brushes, all these overlapping brushes will be updated every time. So the performance will be determined by how many brushes you overlap on a particular spot you're working on.

    You could however, join brushes together (in your code), when moving in a straight line, to avoid issues like this
    You could also just have a sort of heightfield where you just change the height..
    If you really need CSG, you could make a heightfield out of small cubes, and change the heights of those (not sure how accurate this needs to be)
     
  14. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    175
    Just released version 1.545 on https://realtimecsg.com , you can download it from the updates page if you bought it
    I'll update the asset store version soon (it takes a while before unity updates it after it's submitted)

    It fixes the following bugs
    • Fixed Changing ray snapping behavior would not be undoable / would not auto save in prefab mode (issue #289)
    • Fixed that if top gameObject didn't contain a CSGBrush/CSGModel or CSGOperation, but a child contained a CSGBrush, drag & drop would fail (issue #288)
      keep in mind that in order for placement of brushes to work properly, it still needs a CSG component on the top most GameObject, but at least now it won't fail
    • Fixed that a child gameObject of a CSG element would be removed on play (issue #286)
    • Fixed that a generated MeshRenderer or MeshCollider could get left behind sometimes when rebuilding the model
    It also has the following improvements:
    • Added support for two sided shadows (request #290)
    • Added an option in preference window called "Snap Non-CSG Objects to the grid" that, when enabled, allows you to snap non CSG objects to the grid when in Place mode (issue #202)
     
  15. logicalerror

    logicalerror

    Joined:
    Jan 2, 2013
    Posts:
    175
    Just released version 1.546 on https://realtimecsg.com , you can download it from the updates page if you bought it
    I'll update the asset store version soon (it takes a while before unity updates it after it's submitted)

    It fixes the following bugs
    • Drag & dropping a mesh in the scene will no longer place it under a model (issue #291)
    • Fixed mac build being a debug build (fixes crash on a debug assertion being triggered)