A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Now in Beta! Get 1:1 live lessons on any Unity topic or help troubleshooting your project – Connect with an expert on Unity Live Help
Discussion in 'Assets and Asset Store' started by LogicalError-Unity3D, Aug 24, 2016.
EPIC. You are a CSG god. Can't wait for that run-time API!
Hi @anatomi !
I made a ticket for the tooltip thing: https://github.com/LogicalError/realtime-CSG-for-unity/issues/243
I'm currently working on support for a low level API, that at some point will become the runtime API, which would allow anyone to make a tool at runtime for level editing
At the moment I have no plans to fully build a runtime level editor though ...
@PartyBoat just FYI; the next version will be editor-only, just want to test the API in the real world for a couple of iterations before I turn it into a runtime API (just want to make sure that anything anyone relies on for actually shipping their game will be solid)
I'm aiming to release a new version this week, I'm basically just working on website annoyances and documentation at this moment.
So I released version 1.517!
You can find it on the new site https://realtimecsg.com/ which has an API documentation section: now https://realtimecsg.com/api/index.html
I will polish it a bit over the next couple of iterations.
I didn't want to wait releasing this version since there are a lot of important fixes in this release, and the documentation can easily be added separately later.
The changelog for 1.517
Fixed statistics in model component showing the number of triangles in the last mesh, instead of the total triangles in all meshes
Fixed gaps appearing in brushes when multiple sides where almost aligned with each other
Fixed random triangles appearing in brushes when they shouldn't
Fixed the CSG hierarchy being built incorrectly, causing shapes to look incorrect until full rebuild
Fixed all the meshes of all models being recreated on any change to any model
Fixed dots being wrong size after moving camera in edit mode, until hovering over brush
Fixed UI in free-draw mode to choose between line modes being disabled
Fixed UV fit in surface window
Performance improvements for CSG algorithm (50% + improvement in worst case scenarios)
Performance improvements for ray-casting (clicking, moving mouse over surfaces)
new low level API (see https://realtimecsg.com/api/index.html )
Note: the low level API is quite fresh, and should be considered in beta. I might make some, hopefully minor, modifications to it. I'll be sure to communicate that here though.
The low level API talks directly to the CSG algorithm and doesn't work with components, a new layer that works at the component level will be built on top of this. All of this will then be moved to runtime to allow for runtime-CSG.
I released a quick hotfix, version 1.517B
Aapparently the .meta files for CSGBrush/CSGOperation and CSGModel had (somehow) changed in 1.517, making it impossible to load these components from previous versions. Sorry!
Thanks for creating a ticket.
I guess I was imagining a scenario where the modder is using the Unity Editor to create levels and asset bundles.
The new update looks great, by the eay!
Will the next version have permanently edittable objects and circular/bending stairs?
Any rough estimates when that will happen?
@anatomi thanks problem with the asset bundle approach is, how would that work with realtime-CSG? users would need access to it, and I don't think this would work if they would be required to purchase realtime-CSG .. yet if you include it with your game, then why would anyone buy realtime-CSG anymore? :-/ If you see a solution, I'm all ears ..
@dadude123 right now I'm still finishing up on the details for the low level API, I still have some work left. After that I need to build a layer on top of the low level API that helps with serialization, so that it's easy to store (sub)hierarchies, and the ability to build a complete hierarchy from components. This should make it possible for me to make components that contain whole sections of a CSG hierarchy, not just a single node. Then I can start working on moving the generators in their own components. It's hard to say how long this will take. Right now I'm entering a period with lots of things like GDC, which will eat away a lot of the time I usually have to work on this.
Having a problem with the evaluation version:
DllNotFoundException: RealtimeCSG[1.517] after creating a brush.
(Unity2018.1b10, Windows 10)
I just released version 1.518
CSGTree.IsValid -> CSGTree.Valid
CSGTree.IsDirty -> CSGTree.Dirty
CSGTreeBranch.IsValid -> CSGTreeBranch.Valid
CSGTreeBranch.IsDirty -> CSGTreeBranch.Dirty
CSGTreeBrush.IsValid -> CSGTreeBrush.Valid
CSGTreeBrush.IsDirty -> CSGTreeBrush.Dirty
CSGTreeNode.IsValid -> CSGTreeNode.Valid
CSGTreeNode.IsDirty -> CSGTreeNode.Dirty
BrushMeshInstance.IsValid -> BrushMeshInstance.Valid
CSGTreeNode.BrushToTreeSpace -> CSGTreeNode.LocalTransformation
Creation of BrushMeshInstance now has optional userID
Fixed bug where CSGTreeNode.InsertRange accepted duplicate nodes
Fixed issue with errors getting generated when selecting lots of brushes and too many lines need to be rendered
Added option to set lightmap scale per model ("scale in lightmap")
Added option to turn off tooltips in Edit/Preferences/CSG Options ( https://github.com/LogicalError/realtime-CSG-for-unity/issues/243 )
@ravey_451 : Fixed the evaluation version, thanks for letting me know!
I just released version 1.519
Fixed tiny cylinders ending up with surfaces with scale 0 ( https://github.com/LogicalError/realtime-CSG-for-unity/issues/246 )
@ravey_451 version 1.519 should work fine (I tested it manually), there was a problem in my tool chain, sorry about that!
Any progress on the Source importer?
I'm experiencing some issues with groups.
Create one or more brushes
Then group them by pressing ctrl+g
Then delete that group
The brushes will still be rendered until the model gets updated in some way. (What is the quickest way to do that without starting the game by the way?)
Group one or more brushes
Duplicate either a brush inside the group or the whole group by pressing ctrl+d
The new brushes won't be rendered
Unity also crashed on me when i made a group out of around 6 simple cubes and then duplicated that group.
I'm on RealtimeCSG 1.519 with unity 2017.3.0p4
@cmckelvy I think it's still one or two months before I can start working on that..
@2dgame you can rebuild everything using:
Next time you have a crash, can you send me the crash .log/.dmp file that's generated by unity?
If I remember correctly, if you press preview you can see the files generated by the crash and you should be able to find the location of the .dmp file etc. if you could send that to me that would be a really big help since that would allow me to find the exact location of the crash
@2dgame can you check 1.520? I think I may have fixed your issues, let me know if you still have problems
Unfortunately, I found that around 50% of the time what I tried above does work as expected. The other times it's still as I described earlier. I am not sure if anything has changed.
I also found that when it works as expected,e.g. deleting a brush inside a group actually makes the brush disappear, when I then press ctrl+z to recreate the brush it will again not be rendered. Similar to duplicating a brush.
Updated to 1.520 and strangely everything works when I play in editor, but in builds there is no level geometry (meshes or colliders)
No errors or anything.
Any ideas on what might be causing this?
@terrivellmann No I'm not sure why that would be happening :-/ I'll look into it, also into your problems @2dgame
Unfortunately this week I'm tied up because of GDC, so please have patience ... in the meantime you might want to go back to a previous version, sorry
Ok, so I found some time in the cracks between GDC sessions and meetings to fix some bugs & just released version 1.521
Fixed build not outputting meshes ( @terrivellmann !)
Fixed brushes not showing up when created because hierarchy not being updated correctly (@2dgame !)
Fixed generating brushes on a model that's moved not working correctly
Fixed crash bug due to uninitialized data
You can, of course, find it here: https://realtimecsg.com/updates/index.php
@logicalerror Thanks, I just tried out version 1.521
I found that deleting brushes in groups now correctly update the model. At least I could not reproduce that issue in a quick test. The other issue still persist for me:
Create a cube (or multiple)
Group the cube(s)
Duplicate either a brush inside the group or the whole group by pressing ctrl+d
The new brushes won't be rendered
I was wondering if you can reproduce this one?
I also noticed one other thing that isn't a problem for me but might be related or of interest to you.
If you delete the last brush inside a model, the brush will still be rendered. Likewise, if you delete multiple brushes at once which results in no brush being left, all those brushes will still be rendered.
Hi @2dgame , could you try 1.522 ? It should solve that last issue that you're having
Looking good so far
Thank you! Definitely have mesh rendered in builds now, I did find that some don't have their colliders enabled. Those seem to work fine in editor.
I'm not sure if relevant, but in this case I have multiple CSGs for each floor of a building, and this happens once I get to level 3. Lower floors seem fine. Maybe not the best practice but its a way I found to be able to work on lower floors without having the top ones in the way
EDIT: nevemind, new build works, no idea what caused it earlier
I've tried 522 and its crashing a lot for me.
Just simple stuff like drawing a box and then extruding it. Its a random crash of course, nothing that can be easily reproduced.
The earlier version worked fine (not sure if it started with 522 or earlier)
I made some progress on the mesh-bending I planned and it is working pretty well for now.
I was wondering if the new API would allow us to directly post-process the final mesh (modifying vertices).
What I'm currently doing is isolating the parts I want to bend into a new CSG model, exporting it to FBX, and then applying my modifier component on that.
That workflow is ok for simple things but it quickly becomes a hassle when I want to change the CSG model (in the example below that'd be adding more steps).
The best thing I can imagine is being able to modify the output mesh of a CSG Model directly. Obviously there's a "UnityEngine.Mesh" being used somewhere in Realtime CSG to display the final CSG model in the scene, but I was unable to find it.
I imagine something like adding my bending component to the same gameobject as the CSG model, and then when it is toggled on, it would grab the output of the CSG model, transform it, hide it, and display the modified model instead.
@logicalerror Do you think something like that is easily doable? All I'd need is some way to get the output, and hide the default output of the CSG model (and also a callback once someone exports a model to UnityModel or FBX)
Personally I really love the combination of easy CSG modelling to create the mesh and then applying "softer" deformations.
In the image above, it's a cubic-bezier spline deformation, but other fun stuff like taper, noise, skew, wave, ripple, ... are super easy to add as well later. I think I'll make the modifier components open source when I'm done.
I can't really imagine a better workflow than this + the upcoming "always edittable" CSG shapes
Since RealtimeCSG generates very efficient models, some models have to be processed a bit more, adding more vertices. In the screenshot below the bridge is built using tons of 0.5m wide blocks so there are enough vertices.
I'm planning to automatically add more vertices automatically later (which should be more efficient because at that point it is known where the sharpest bends are and where more vertices are actually needed)
Hi, I just released version 1.523
Fixed edges sometimes being hard to select when hovering mouse over them
Fixed some situations where meshes would be rebuild when they shouldn't, causing lighting data to be lost
Fixed scale operator having giant cube in center, and cones, instead of cubes, on its axis scalars?
Fixed drawing shape on moved model would not align correctly
Fixed surfaces not being selectable but cast shadows was turned off (there's still something odd going on here, I'll investigate more)
Fixed gaps being created when triangles where merged that shouldn't be merged (not sure when this was introduced, it seemed to appear out of nowhere somewhere in the last couple of versions?)
Fixed crash bug due to uninitialized data (this is probably what you where experiencing @dadude123 !)
Improved vertex snapping (button in mesh edit mode), sometimes it wouldn't snap when the snap movement was too small (note: vertex snapping works on all selected vertices as a group, it doesn't snap each vertex individually .. this is to avoid vertices snapping to the same position and changing the shape of what you're snapping. At some point I need to revisit this and find a better solution)
@dadude123 That looks great! Eventually I was planning to add some generators that work over a spline. Like copying the children of a generator a number of time over a path (spline). Or stairs that follow a spline. I haven't thought about post processing like that though, it looks interesting
The API allows you to create a GeneratedMesh that contains all the vertices etc. created by the CSG algorithm, this in turn can be used to update or create a UnityEngine.Mesh. See here for an example. (yes I know, I need to work on the documentation)
Nice, I love the fixes, will try it later today!
As for the spline stuff: I was thinking about directly creating generators that make use of an existing spline as well for some time. But I realized that doing it as post processing gives you a lot more flexibility.
A spline-generator can only bend stairs, or a box, or whatever, but if you want to bend some crazy user made thing (bridges, towers, ...) that's not possible. But with post-processing-bending it is.
sure you could, you could have a generator that takes its child brushes, splits them into slices and then warps those segments over a spline .. there are some caveats when it comes to twisting over the spline, but should be doable?
I don't believe I posted my works using Realtime CSG so I can spend the opportunity showing what I've made!
The first is this puppy in a raincoat, in the rain. The brick wall next to him and the floor were made using RTCSG! Same goes for the kitty variant.
I recently made a downloadable human size reference model and showcased it in this relatively bland scene.
There is something wrong with the "depth" of the cursor when you want to create shapes inside a subtractive shape.
This video shows what I mean: https://streamable.com/eflqf
I see, I didn't think that was possible. Those are great news.
Building "brush-bending" right into RealtimeCSG should definitely be the best way to do it.
Because then we can directly keep working with the bent stuff which makes editting much easier.
Imagine this scenario: A castle wall that is bent around a castle in a smooth curve, and now you want to have a stair-case inside that wall as well. With the method I'm currently applying it would be a little hard to reliably have a "straight" room inside the wall because the inside-walls of the room will be bent as well (the whole model gets bent). But if we could bend only specific brushes/operations/brushes then the user could actually chose if they want to have the inside room follow the curvature of the outside wall or not.
When I have more time, I will try to wrap my head around your explanation and maybe even try to implement the bending directly like you mentioned.
@Emerald_Eel_Entertainment heh, it looks nice! I hope you're doing more than just make cubical rooms with realtime-CSG though ;p
@dadude123 yeah it seems to be blocked by invisible surfaces, there's something funky going on there. I'll take a look.
Just a quick update; for the last couple of days I've been working on some low level stuff that will make it easier to turn all the generators into separate components, which will make it possible to keep editing cylinders, stairs etc. even when you come back to those later. This work is also an important step towards the runtime support of realtime-CSG.
I've also been spending a bit of time on the test scene, that I hope to re-release separately on realtimeCSG.com soon-ish.
It's still very much a WIP, but I'm kind of starting to like it. Texturing is non-existent obviously, mostly because I have no textures that I own that I could release with it ..
Also seem to be some lighting artifacts, at the front. I think this is simply because I'm working in an older Unity version, 5.6.4. (it's easy to upgrade a scene, the reverse .. not so much)
And yes, indirect lighting is very much exaggerated
Somewhere in between this all I'll make sure to update the documentation
Just to make sure I didn't misunderstand, this indeed sounds like the actual CSG model gets modified, so after bending there can be even more CSG operations stacked on top of that, right? Like bending a cube, then subtracting a sphere out of the bent object, like this:
(standard CSG Box brush ; how it would look bent through a spline; subtracting a CSG sphere from that )
I tried to see how that could be done based on your quick description, but I'm afraid I'm stuck before I can even really begin.
Since everything is moving away from GameObjects towards some kind of internal nodes, where would I even apply my modifier to? It would have to be a type of CSGNode, or not?
If not, how could I possibly specify the order of operation? Like bending things multiple times or something like that...
How would I even go about splitting a box into slices?
I know how to do it using a normal UnityEngine.Mesh; taking a Mesh and generating two meshes that have been split by a plane is no problem. But how would one go about doing the same thing using CSGBrush?
Is it the same approach even?
My standard mesh-cutter simply detects what side a vertex is on, and then rips the model apart that way (creating additional vertices along the edges where the model was cut: https://i.imgur.com/uEwIFik.png )
Do you think you could write a quick guide on how to do that stuff using CSG? Is it even possible with the current state of the API? What methods do I use to get vertices and edges? Does my code have to be a monobehaviour? If not, what else would it be?
Also how would I deal with invalid (non-convex) stuff? Do I have to care about that?
Or is that not a problem because RealtimeCSG would just subdivide the model for me somehow, like the freeform tool does?
@dadude123 the CSG nodes are not going away, the new API is just something that sits below that. So if you want to do CSG yourself (for procedural generation for example), you can do it without needing to create GameObjects etc.
At least that's the idea ;p
But yes, the whole splitting and curving thing would work in CSG land and you use it in combination with other CSG objects. As for how to splitting brushes, remember, there is a splitting tool in realtime CSG. The same tech could be repurposed for that.
That's what I'm working towards in the short term actually, once I finish moving the existing generators to generator components my plan was to create these generalized 2D shapes and 3d paths that can be combined to create swept volumes. It'll essentially be: "create an extruded 2D shape, cut it, rotate & place it for each segment"
Ah, yes that would already remove a large amount of work from getting this done.
However I'm still quite confused how the actual workflow would look like.
I'm still not quite sure where exactly the code would actually go, and how the end result would look in the hierarchy.
I mean after applying a spline to a group of brushes, you'd still be able to modify the original brushes, but the resulting model would look different. How would that even work/look like in "mesh edit" mode? Would all spline bending be disabled then so the user can easily work with the source brushes?
1) Where does my code go, do I inherit from CSGOperation?
2) How exactly do I select what to bend? Do I just bend all children (assuming the bending code would be a CSG operation?
3) Bending a box will generate more brushes, will they be shown in the hierarchy?
4) If yes, then will the original box be shown as well? Will the original box be replaced by the new meshes?
That'd be bad because then it would be a destructive workflow (bending replaces the original brush or set of brushes with a new object/set of objects) Can that be avoided? After all, the whole point is to being able to edit and fine tune stuff continously.
5) If the workflow is still non-destructive (as intended), then how do I prevent the user from being able to modify the mesh in "mesh-edit" mode. I mean the user should be able to modify the original box, but the bent version of the box cannot be editted as it is procedurally generated (from source box + spline)
I hope you can shed some light onto all of this.
@dadude123 well you're basically now getting to all the issues I was encountering .. the exact kind of issues I'm now in the process of fixing in order to create all the monobehaviour based generators I'd like to be able to add
But essentially, the idea is that at some point there will be a way to create new generator monobehaviours that wouldn't contain just one node, but could contain a whole sub-tree of brushes and operations (using the lower level stuff I released before)
I'd also like to be able to have monobehaviour generators that basically take its child nodes (in the hierarchy you visibly see in unity), and do something with those without those specific child nodes actually directly being used in csg tree ..
That would allow for 'generators' (really need a better name) that could mirror the objects that are contained in it, or repeat it multiple times over a spline, or bend several brushes over a spline.
Downside is that the internal brushes of these generators (the brushes that are inside the generator monobehaviour) will not be directly editable, but I suspect that's not that much of an issue. It makes sense to make it possible to convert a 'generator' into regular CSGBrush/CSGOperations. That would be a one way thing though.
I see. That is pretty enlightening.
Yeah, that sounds awesome.
I honestly don't think that is a real downside at all.
It works exactly like you described in blender as well, and everyone is happy with that. "Modifiers" (that's their name in blender) have an "Apply"-Button removes it and leaves the generated mesh as a real, edittable, mesh.
Alright, it sounds like there are still a few minor things for you to do before I can implement all those things correctly (ie not faking Array-Modifier by copying gameobjects, and not faking Spline-Bending by working on exported meshes).
I can't wait, this stuff will be great
Realtime CSG is looking really good. The updates are terrific. I got Realtime CSG a few months back, but have not really
used it a lot. The question was asked a bit back and I am just asking if it is still planned ..
" Yes, once extruding over a spline is implemented, revolving extrudes would be easy to implement "
Is revolve or lathe still planed or is it in already ?
Splines are not implemented yet, neither is bending but if @logicalerror won't have time for it, then I'll definitely implement it as a part of the CSG system once I understand the basic classes are there and I understand the concept of modifiers inside RealtimeCSG more.
As for lathe/revolve (rotate-extruding from a 2D shape), I think that is definitely planned by @logicalerror
If it ever gets added, it would be nice if the "extrude along spline" also supported your edge selection, rather than requiring drawing of a spline each time. This is how Sketchup/Umodeler do it.
I just uploaded version 1.524 1.525
Fixed model "inverted mode" causing an error because method was named incorrectly
Fixed sometimes brushes not having their operation set correctly (additive when it should be subtractive)
Fixed raycasts not returning correct planes when planes needed to be inverted, making it sometimes impossible to 'draw' on top of brushes. (should fix your issue @dadude123 !)
@Mark_01 things like revolve will be relatively easy to implement once all the work is done for splines and generator components Same goes for the "edge selection" thing @Stardog mentioned, which would essentially just be a path created from the edges
Thank you so much.
The test scene above you are working on looks really good. Any kind of building(s) can be done. And with the coming splines will set this far on top as far as I am concerned.
Where you are taking it, Totally awesome!!!
I just uploaded version 1.526
Fixed dragging material over surface without dropping + undo changes material
Fixed model mesh not being rebuild when model has no brushes in it
Unwrapping settings are now exposed in model, making it possible to tweak UV generation
More UV charting controls are added to the model as well
Anyway, back to working on the future stuff ;p
I'm noticing a problem with the position numbers; they aren't 1.0, 0.5, etc. I tried clicking on the fields and editing them but nothing happens. The models don't like up nicely.
In addition It seems that every time I generate a mesh the textures don't fit neatly with, say, a box that is 2 metres long, 5 metres wide and 4 metres tall.
I'm not sure I understand .. do you mean you can't edit the values at all?
I just released version 1.529
Fixed triangulation issue that could end up with triangles orientated in the wrong direction
Fixed loading a scene for the first time since startup would 'forget' lightmap information
Still working on refactoring the code to enable component based brush generators / runtime support!
The values can't be edited, no. They're also not whole numbers, which is odd.
Are you running any other plugins at the same time? Also, what version of unity are you on?
I first downloaded an asset called Realistic FPS Prefab before importing RTCSG. I downloaded other packages afterwards but it was acting strangly even before the other packages. I'm using the current version of Unity.
Current as in 2018.2 beta? or 2018.1 beta? or 2017.4?
What version of realtime CSG are you on? I can't seem to reproduce it in 2018.1 / 2017.4 or 5.6