Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

[Released] Burning Building - Runtime building mesh generation framework

Discussion in 'Assets and Asset Store' started by burningmime, Apr 18, 2023.

  1. burningmime

    burningmime

    Joined:
    Jan 25, 2014
    Posts:
    845
    Burning Building on the Unity Asset Store
    Editor Demo | Hiding Demo | Online Documentation | Tutorial Video (turn on subtitles)





    Burning Building is a powerful building mesh generation framework. You can use it in the editor for rapid prototyping, use it for procedurally generated/random levels, build or destroy walls, or extend the editing tools to the player (see the demo here!).

    You can use any prefab for doors and windows, and any material for walls/floors -- this is a tool not a content pack! Burning Building is about empowering users to use their own content without needing to spend much time adapting or modifying it. The included content is just examples*. It should work just fine in all 3 render pipelines or even a custom SRP.

    It intentionally does not cover all the same use cases as ProBuilder or Blender. It's a runtime generation framework first, and the easy-to-use editor tools are an extension of that. A major focus has been on providing powerful but discoverable C# APIs. Buildings are defined by 3 arrays plus some metadata, and the mesh is generated from that. Meshes are regenerated as needed in a burst job, allowing you to modify them at any time.

    If you have any questions, feel free to ask here or email support@burningmime.com

    * If you need free content, there are thousands of PBR materials at AmbientCG, and hundreds of free doors/windows to choose from at TurboSquid and CGTrader). I also have a free tool to import AMbientCG materials. Using your own door/window prefab is as easy as modifying the pivot point.
     
    Last edited: May 2, 2023
    DrMeatball and Arkade like this.
  2. burningmime

    burningmime

    Joined:
    Jan 25, 2014
    Posts:
    845
    I'll give it a bump; but also to add that Burning Building actually supports light mapping. It generates a packed UV2. This is nice for static buildings, and it's stable when meshes are re-generated (as long as the layout doesn't change), so you can use it with runtime hiding.



     
    Last edited: May 2, 2023
    DrMeatball likes this.
  3. burningmime

    burningmime

    Joined:
    Jan 25, 2014
    Posts:
    845
    One of the features of Burning Building is the ability to partially "cut out" walls letting the camera see into rooms. Most games with this feature have fixed camera angles and fixed sets of objects which can be on or off, but Burning Building will do so based on camera angle and will re-generate the mesh, including transition segments. I needed this feature for my game, otherwise I probably wouldn't have spent so much time on it, but it ended up looking pretty spiffy:

    upload_2023-4-21_10-10-19.png

    In action:
    Hiding Demo
     
    DrMeatball likes this.
  4. burningmime

    burningmime

    Joined:
    Jan 25, 2014
    Posts:
    845
    One of the biggest implementation hurdles was the ability to cut holes in walls for doors, windows, ventilation shafts, or other shapes. But check it out:

    upload_2023-4-23_23-36-36.png

    Burning Building cuts a hole in the mesh for the prop to fit into, places the prop (with the correct scale and transform), and applies the correct UVs/materials to the surrounding walls. Any prefab will work as a prop, so you can use your own doors and windows. Note the hole-cutting is still fairly experimental and only works for convex shapes -- but most windows, doors, arches, and other architectural elements will work just fine.

    BTW, sale ends in about a week!
     
  5. burningmime

    burningmime

    Joined:
    Jan 25, 2014
    Posts:
    845
    Version 1.1.0 - Colliders and roofs

    The newest version has just been accepted to the Asset Store! This version resolves a couple issues people had with the initial release...
    • Allows you to create (flat) roofs by using the double sided ceiling mode.
    • Allows automatic creation of a MeshCollider based on the building geometry
    • Minor UI improvements
    Collider generation can be slow, and the colliders themselves can end up being quite complex with a lot of extra detail. So if you want to optimize your game to run on low-CPU platforms (mobile VR in particular), you may want to manually place box colliders instead of relying on the building object to generate them. However, for most users, these should be sufficient.
     
  6. eagleeyez

    eagleeyez

    Joined:
    Mar 21, 2013
    Posts:
    406
    Hi, just bought and tried out your burning buildings asset from Unity.

    This is a very promising idea and concept of building interiors quickly in Unity. I understand that it is the first version and is very basic at this moment and I do very much hope you continue to improve this asset making it totally awesome later on down the road.


    This asset definitely needs a Forum or even better a Discord. This price is very high and even on sale I was on the fence about buying this asset as you have no forum or discord and help just over Email is very frustrating and we get no feedback or help from others in the community.

    So please at least make a forum but even better would be discord.


    Oh wait…. there is a forum if you google for it. On the asset page you do not mention the forum or even have your contact information. You need to update that or people will not know about this forum. Which is why I am most probably going to be the only one posting here.


    I have had not much time to go in depth but there are already some small things that should be a must in this asset.

    You can only build walls at 1 meter apart from each other. I need an option to build walls inside next to each other at 50cm apart from each other or even 40cm and be able to also change the thickness of the walls.

    Also change height of the walls during building. For example, I build a room with a door and this door goes into a big hall with higher walls or maybe even within the room I add in some lower walls. So height variability would be a big plus.

    Also different ceilings in rooms, so be able to change the ceilings and not just the floor tiles.



    You need some more videos on setting pivot on doors and windows (other prefabs) how to get other models to work with your wall stamping. I used a free asset called adjust pivot.


    For later different roof options, proper house roofs, industry roofs

    More asset content for doors and windows should be included.


    I will let you know as I go on further with more ideas and suggestions.

    I look forward to your response.


    Just a thought! Just think about if you could start in a room in VR and then within VR start building out a complete interior pushing out walls, adding windows and doors, change the materials and different ceilings. You could then have a floating menu in front of you and add predefined props to your rooms and decals.


    All the best

    Chris.
     
  7. burningmime

    burningmime

    Joined:
    Jan 25, 2014
    Posts:
    845
    There's no forum; just this thread :). I'd be more than happy to help here.

    I don't think there's enough active users to expect people to help each other there. It hasn't exactly sold very well. But if someone wants to set up a Discord or whatever, I'd be happy to log on and help.

    You can change the "1m apart" thing by modifying the scale of the entire building. For example, if you want your walls 50cm apart, simply set the scale of the building to 0.5 in X and Z. Of course, this will impact wall thickness.

    For your other suggestions, I will consider them. However, these types of things add complexity to UI and API and of course they take some time to develop. They also aren't commonly required for runtime editing functionality or procedural generation, which is really where the "meat" of Burning Building is. That's closer to the functionality you'd expect from like ProBuilder. Right now, I'm happy to have feature parity with The Sims 1.

    If you only need the editor-side functionality, you can block out the basics using Burning Building, then export to FBX, and make additional adjustments in Blender or other 3D software. Sadly, Unity's FBX exporter does not export material tiling correctly.

    I'll consider adding a new tool for that in the next version. It shouldn't be super hard.

    Good idea. I will try to put together a simple video on setting up custom props next week.

    Adjusting pivot in Unity is easy; you shouldn't need a separate asset. Just create an empty GameObejct and put it at the origin. Then add the GameObject you want to adjust as a child. Move that object how you want it positioned relative to the origin. Make a prefab out of the parent and use that as the prop root. Done :)!

    There's some discussion of algorithms in this paper. The issue for me, though is this is a very non-trivial problem with a lot of edge cases. Let's say I spend 100+ hours implementing this. If I knew I could get 100 more sales, then sure I'd do it in a heartbeat. If I could get 50 more sales, then I'd do it because it's an interesting problem to me. But the reality right now is that I might get 5-10 sales (if that) unless I could find some way to market it. And it's not a feature I need for my game.

    If you don't need any runtime generation, you can export to FBX and use Blender or other tools to make your roofs exactly how you want them.

    The goal is to allow users to use their own. The ones provided are just examples. There's loads of free ones to choose from at https://www.turbosquid.com/3d-model/free/door and https://www.turbosquid.com/3d-model/free/window . I don't think I can legally distribute them or else I'd add them to the example assets.

    That sounds like a really cool idea for a project! The API of Burning Building should have all that functionality except for the ceiling material thing.
     
    Last edited: Apr 30, 2023
  8. eagleeyez

    eagleeyez

    Joined:
    Mar 21, 2013
    Posts:
    406
    Thanks for your reply, changing the scale did actually help me to get walls 40cm apart from each other.

    Regarding your poor sales which you mentioned. It probably has a lot to do with your asking price. Even at half price I was on the fence about buying this asset as there was no conversations about it meaning no forum or Discord or a proper publisher website.

    I bit the bullet at half price and bought your asset as I thought the idea to be very original and easy to use. Which it is.

    There is a lot of potential in this concept and no it does not have to be like pro builder but could still get a lot of the ground work done with future improvements. So it would be nice if you stick at this and you should drop the price to get more sales and more people interested.

    Flush out your demos too. I could not add doors or windows in your standalone demos, you forgot to add that.

    I do have more suggestions and ideas. I will get back here soon about that.

    Keep up the good work
     
  9. burningmime

    burningmime

    Joined:
    Jan 25, 2014
    Posts:
    845
    Thank you!

    Which were you trying? The "runtime hiding" demo should allow you to add doors/windows to the example in the editor.

    There are no API examples for how to add walls or doors. I'll see if I can add it to either the player editor or dungeon generator one. This is a good idea.
     
    Last edited: Apr 30, 2023
  10. burningmime

    burningmime

    Joined:
    Jan 25, 2014
    Posts:
    845
    New tutorial on how to set up a custom door or window prefab. You an find lots of free ones at TurboSquid or CGTrader.



    If you'd rather see it in screenshots, it's basically just you create a prefab at (0, 0, 0) and then add the model you want as a child of that prefab with whatever positioning you want. As an example, here is the default door prefab root. Note the root prefab has transform (0, 0, 0).

    upload_2023-5-1_10-13-56.png

    And then the child objects have their scale/position/rotation adjusted:

    upload_2023-5-1_10-15-15.png

    This isn't specific to Burning Building -- you can use this trick of "lowering" a mesh in the hierarchy to change the pivot point of any mesh!
     
    Last edited: May 1, 2023
  11. eagleeyez

    eagleeyez

    Joined:
    Mar 21, 2013
    Posts:
    406
    Hi, Why can I not create a Prefab after making a Proxy? And thanks for making new videos
     
  12. burningmime

    burningmime

    Joined:
    Jan 25, 2014
    Posts:
    845
    Probably the proxy mesh is not saved correctly.

    I can make it so it exports a mesh to an FBX or something in the next version. Maybe I will add a "disconnect proxy" button that will just turn it into a regular MeshRenderer.
     
  13. burningmime

    burningmime

    Joined:
    Jan 25, 2014
    Posts:
    845
    Version 1.2.0 - Export mesh

    The newest version has just been accepted to the Asset Store! There are a few minor fixes (eg scroll bars now show up properly if you have like 200 materials to choose from). But the big change is that it's now possible to export the building mesh to FBX. While it was technically possible to do this before manually via a static proxy, there's now just one button to click on and you'll have a mesh you can edit and tweak manually. Note this functionality only works in the Unity editor.

    The result is just a plain MeshRenderer in your scene. Once you've exported, you lose the ability to edit the building, but it functions just like any other GameObject; nothing special about it. You can tweak the FBX file in Blender, Autodesk(R) software, or other tools, allowing you to fine-tune the resuling mesh.

    As I move forward with Burning Building, I'll be doing a bit more to support the edit-time scenarios. The initial release focused very much on runtime/player-driven editing scenarios and runtime building manipulation APIs. However, I get the impression that this isn't actually that important a feature for many users, and a lot of people would just like a tool to make buildings inside Unity and do basic level design. While it'll never achieve feature parity with ProBuilder, I'll keep in mind the editor-only users with new features.

    I'm aware of a couple bugs with custom props -- wide props don't slot correctly into the hole when placed near corners, and the convex hull isn't being properly calculated when dealing with some complex multi-part meshes. I'll take a look at these next weekend.
     
  14. ElSheriff

    ElSheriff

    Joined:
    Apr 12, 2014
    Posts:
    9
    Hello, I did find a bug with my version of Burst.
    Unity: 2022.2.0b16
    Burst: 1.8.2
    Run any of the provided demos I get:

    Code (CSharp):
    1. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'Try_000000B3$BurstDirectCall' threw an exception. ---> System.InvalidOperationException: Burst failed to compile the function pointer `Int32 Try(IntPtr, Block ByRef)`
    2.   at Unity.Burst.BurstCompiler.Compile (System.Object delegateObj, System.Reflection.MethodInfo methodInfo, System.Boolean isFunctionPointer, System.Boolean isILPostProcessing) [0x0015a] in .......\Library\PackageCache\com.unity.burst@1.8.2\Runtime\BurstCompiler.cs:470
    3.   at Unity.Burst.BurstCompiler.CompileILPPMethod2 (System.RuntimeMethodHandle burstMethodHandle) [0x0003a] in ......\Library\PackageCache\com.unity.burst@1.8.2\Runtime\BurstCompiler.cs:231
    4.   at Unity.Collections.AllocatorManager+StackAllocator+Try_000000B3$BurstDirectCall.Constructor () [0x00000] in <3f25ba8b10834b6ea1e4b844db5bcdce>:0
    5.   at Unity.Collections.AllocatorManager+StackAllocator+Try_000000B3$BurstDirectCall..cctor () [0x00000] in <3f25ba8b10834b6ea1e4b844db5bcdce>:0
    6.    --- End of inner exception stack trace ---
    7.   at $BurstDirectCallInitializer.Initialize () [0x00000] in <3f25ba8b10834b6ea1e4b844db5bcdce>:0
    8.   at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
    9.   at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <8f06425e63004caf99a79845675f751e>:0
    10.    --- End of inner exception stack trace ---
    11.   at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00083] in <8f06425e63004caf99a79845675f751e>:0
    12.   at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <8f06425e63004caf99a79845675f751e>:0
    13.   at UnityEditor.EditorAssemblies.ProcessInitializeOnLoadMethodAttributes () [0x000a5] in <d5cfe1b7a8b8455dae78439447671342>:0
    14. UnityEditor.EditorAssemblies:ProcessInitializeOnLoadMethodAttributes ()
    Code (CSharp):
    1. InvalidOperationException: Burst failed to compile the function pointer `Int32 Try(IntPtr, Block ByRef)`
    2. Unity.Burst.BurstCompiler.Compile (System.Object delegateObj, System.Reflection.MethodInfo methodInfo, System.Boolean isFunctionPointer, System.Boolean isILPostProcessing) (at Library/PackageCache/com.unity.burst@1.8.2/Runtime/BurstCompiler.cs:470)
    3. Unity.Burst.BurstCompiler.CompileILPPMethod2 (System.RuntimeMethodHandle burstMethodHandle) (at Library/PackageCache/com.unity.burst@1.8.2/Runtime/BurstCompiler.cs:231)
    4. Unity.Collections.AllocatorManager+StackAllocator+Try_000000B3$BurstDirectCall.Constructor () (at <3f25ba8b10834b6ea1e4b844db5bcdce>:0)
    5. Unity.Collections.AllocatorManager+StackAllocator+Try_000000B3$BurstDirectCall..cctor () (at <3f25ba8b10834b6ea1e4b844db5bcdce>:0)
    6. Rethrow as TypeInitializationException: The type initializer for 'Try_000000B3$BurstDirectCall' threw an exception.
    7. $BurstDirectCallInitializer.Initialize () (at <3f25ba8b10834b6ea1e4b844db5bcdce>:0)
    --------------
    Additionally, can you provide documentation on how to create the mesh at run time similar to the maze generation demo. For Example:
    #1 Vector3.y
    In the Maze demo you created:
    Code (CSharp):
    1. SparseTileArray tiles = _building.tiles;
    2. SparseWallArray wallsX = _building.wallsX;
    3. SparseWallArray wallsZ = _building.wallsZ;
    Each one being a vector3. where the access is (example) : wallsX[x, 0, 0] what is the y value?
    In Building Prop Set:
    Wall Height is the height of the generated wall.
    What is partial Height?
    If I wanted several floors like an apartment building, how do I adjust the Y? Is Y = 0 ground floor y = 1 floor 1?

    If I want two floors:
    _building.resize(WIDTH, 1, DEPTH);
    is the Y (1) indicating only one floor? so I would need 2 for a second story?

    # double sided floor

    In the maze example the floor only is one sided. How do I make it two?

    # remove floor

    If I populated an entire floor with:
    Code (CSharp):
    1. private void generateMazeFloor(int floorMaterial)
    2.         {
    3.             // While there are prettier maze generation algorithms; the point here is to demonstrate the building API
    4.             // and not to make a nice maze! So, I'm going to make the maze fully dense. Start by setting every single
    5.             // tile to the carpet material
    6.             SparseTileArray tiles = _building.tiles;
    7.             for(int z = 0; z < _building.sizeZ; ++z)
    8.             for(int x = 0; x < _building.sizeX; ++x)
    9.                 tiles[x, 0, z] = new TileSegment { materialId = floorMaterial };
    10.         }
    11.        
    How do I remove a floor piece as say tiles[5,0,5]. In a generation step after the generateMazeFloor is run?

    # room select set floor / wall color
    If I created a room by placing walls into the SpaseWallArray is there an API call to "Paint" the entire floor and entire wall to the "room" created by the connected walls. For example my walls enclose a 3X3 tiled area. I want to change the material of the walls and floor to a bathroom specific tile set. How do I do this from a script?

    How do I change the exterior color of the entire building?

    # Placing Doors / Windows
    If I wanted to place a door / window at the center of the wall at say wallsX[10,0,10] in a previous step I placed the wall at that cell. How do I place door / window piece there via a script?

    Thank you for your assistance!
     
  15. burningmime

    burningmime

    Joined:
    Jan 25, 2014
    Posts:
    845
    Ouch! I'll download 2022.2.0b16 tonight and see what I can do about it.

    Each of those things (wallsX, wallsZ, and tiles) can be thought of a voxel grid (for example, Minecraft). The wallsX are the walls running paralell to the X direction, and wallZ are the walls running paralell to the Z direction. By layering these together, you get the building grid. For example... um... hopefully this diagram is readable (I made it in Paint.NET):

    upload_2023-6-5_14-55-26.png

    Partial height is used when there are camera cutaways for the "runtime hiding" feature. If you're not using runtim hiding, it doesn't matter.

    Yes; exactly.

    Hmmm.. so by double sided floor, do you mean the building is floating in the air, and you want to look up from below and see a floor? You could make that happen by using ceilings and the tile flags. Basically just make a "dummy" floor below your current floor, and set all the tiles to be ceiling-only. I can show you how to do that in code, but just want to make sure that's actually what you need.

    Code (csharp):
    1. tiles[5,0,5] = default; // setting a tile or wall to "default" will remove it
    Not exactly -- you need to generate the walls or tiles with the materials you want. If you want to change them after they've been generated, you'll need to loop through them. However, you can take a look at how the FloodWallsTool and FloodTilesTool do it. For example, to flood fill walls starting at a specific location...

    Code (csharp):
    1.  
    2.  
    3. WallPosition startPosition = /* wherever you want to start the flood fill from */;
    4. WallSegment startSegment = readSegment(startPosition);
    5. Assert.IsTrue(startSegment.exists);
    6. int oldMaterial = (startPosition.isFront ? startSegment.front : startSegment.back);
    7. int newMaterial = editorContext.material;
    8. Assert.IsTrue(oldMaterial != 0 && newMaterial != 0);
    9.  
    10. // if the clicked segment is already the destination material, don't do anything
    11. if(oldMaterial == newMaterial)
    12.     return;
    13.  
    14. FloodFill.walls(building, startPosition, true, true, currentPosition =>
    15. {
    16.     WallSegment oldSegment = readSegment(currentPosition);
    17.     if((currentPosition.isFront ? oldSegment.front : oldSegment.back) != oldMaterial)
    18.         return false;
    19.     WallSegment @new = currentPosition.isFront ?
    20.         new WallSegment(newMaterial, oldSegment.back, oldSegment.propId) :
    21.         new WallSegment(oldSegment.front, newMaterial, oldSegment.propId);
    22.     writeSegment(currentPosition, @new);
    23.     return true;
    24. });
    25.  
    26.  
    27. // helper functions
    28. protected WallSegment readSegment(WallPosition p) => (p.isX ? building.wallsX : building.wallsZ)[p.pp];
    29. protected void writeSegment(WallPosition p, WallSegment value) => (p.isX ? building.wallsX : building.wallsZ)[p.pp] = value;
    30.  
    Similarly, to flood tiles starting at a specific location (note this is a really bad/slow algorithm, but it's good enough for the editor and should be fine if doing it on level load):

    Code (csharp):
    1. protected void floodFill(PackedPoint pStart)
    2. {
    3.     SparseTileArray tiles = building.tiles;
    4.     SparseWallArray wallsX = building.wallsX, wallsZ = building.wallsZ;
    5.     int y = pStart.y;
    6.     int oldMaterial = tiles[pStart].packedValue;
    7.     if(oldMaterial == 0) return;
    8.     int newMaterial = /* whatever the new material is */;
    9.     if(newMaterial == oldMaterial) return;
    10.     Queue<PackedPoint> q = new Queue<PackedPoint>();
    11.     HashSet<PackedPoint> v = new HashSet<PackedPoint>();
    12.     q.Enqueue(pStart);
    13.     v.Add(pStart);
    14.     while(q.Count > 0)
    15.     {
    16.         PackedPoint p = q.Dequeue();
    17.         TileSegment ti = tiles[p];
    18.         ti.materialId = newMaterial;
    19.         tiles[p] = ti;
    20.         int x = p.x, z = p.z;
    21.         floodTile(wallsZ, tiles, q, v, newMaterial, y, x - 1, z    , x    , z    ); // left
    22.         floodTile(wallsZ, tiles, q, v, newMaterial, y, x + 1, z    , x + 1, z    ); // right
    23.         floodTile(wallsX, tiles, q, v, newMaterial, y, x    , z - 1, x    , z    ); // up
    24.         floodTile(wallsX, tiles, q, v, newMaterial, y, x    , z + 1, x    , z + 1); // down
    25.     }
    26. }
    27.  
    28. [MethodImpl(MethodImplOptions.AggressiveInlining)]
    29. protected static void floodTile(SparseWallArray w, SparseTileArray t, Queue<PackedPoint> q,
    30.     HashSet<PackedPoint> v, int mNew, int y, int tx, int tz, int wx, int wz)
    31. {
    32.     if(!t.inBounds(tx, y, tz))
    33.         return;
    34.     PackedPoint pp = PackedPoint.fromXyzFast(tx, y, tz);
    35.     if(v.Contains(pp))
    36.         return;
    37.     v.Add(pp);
    38.     TileSegment tiOld = t[pp];
    39.     if(tiOld.materialId == mNew || !tiOld.hasValue)
    40.         return;
    41.     if(w.exists(wx, y, wz))
    42.         return;
    43.     q.Enqueue(pp);
    44. }
    Having everything as just arrays you edit provides maximum flexibility, but of course means that a lot of stuff is fairly low-level.

    Code (csharp):
    1. WallSegment segment = wallsX[10,0,10]; // get the old segment value
    2. segment.propId = 2; // set the prop ID
    3. wallsX[10,0,10] = segment; // set it to the new segment value[/quote]
     
    ElSheriff likes this.
  16. ElSheriff

    ElSheriff

    Joined:
    Apr 12, 2014
    Posts:
    9
    Yes I noticed in the Maze Demo, that looking down at the "Building" there is no floor. And Looking up there is no ceiling.
    So yes, how do I make a "Dummy" floor below current floor.

    Does this detach the floor and ceiling logic? When I run:

    Code (CSharp):
    1. tiles[5,0,5] = default; // setting a tile or wall to "default" will remove it
    2.  
    This removes both the floor and ceiling in the demo version.

    Also in the Maze demo there is no setting to change the ceiling material. Does this "Dummy" floor method allow for the modification of this material? If not, how do I change the material?

    Finally, can I add props like doors and windows to the floor / ceiling? Like a moon roof or a "hole" to above / below. Can this be done in the same way you added doors / windows in the demo videos?

    Thank you!
     
  17. burningmime

    burningmime

    Joined:
    Jan 25, 2014
    Posts:
    845
    By default, the ceiling mode is set to down only. But you can change that at runtime the same way you would in the editor:

    Code (csharp):
    1. building.ceilingMode =BuildingCeilingMode.DOUBLE_SIDED;
    I assume most buildings will be on the ground, and players won't be looking up at them from underneath, so the default is just to draw meshes single-sided. Since there's a cost to every triangle, especially on mobile/VR, the meshes are optimized and don't generate the downward-facing parts of floors. However, here might be buildings built over water, porches held up by beams, space stations, etc, where the building will be floating and the camera could go underneath. So I can maybe add something in the future to make this a bit easier. But for now it can be hacked in easily enough...

    Set up your main building on y=1 instead of y=0. If you have a 2-story building, you'll want to have it like...

    <upstairs>
    <downstairs>
    <dummy floor>

    The dummy floor should have the same floor plan as the downstairs, but set each tile to have the hideFloor flag. If you want to automate copying floor 1 to floor 0, you could do something like...

    Code (csharp):
    1. // copies the tiles from floor 1 to floor 0, then sets those tiles to be ceiling-only
    2. // this lets the camera "look up" at the bottom of the building if they're below the building
    3. // this might be useful for example if the player is underwater and the building is built on a pier
    4. //
    5. // WARNING: this function deletes everything that was on floor zero before!
    6. public static void createDownwardFacingFloorZero(Building building)
    7. {
    8.     if(building.sizeY < 2)
    9.         throw new Exception("This only works if there are at least 2 floors");
    10.     SparseTileArray tiles = building.tiles;
    11.     for(int z = 0; z < tiles.sizeZ; ++z)
    12.     for(int x = 0; x < tiles.sizeX; ++x)
    13.     {
    14.         TileSegment segment = tiles[x, 1, z]; // load the segment on floor 1
    15.         if(segment.hasValue) // if there is a tile there...
    16.             segment.hideFloor = true; // set hideFloor = true, which means that it will only render the ceiling
    17.         tiles[x, 0, z] = segment; // apply it to the floor below
    18.     }
    19. }
    There is one material used for all ceilings and one material used for all roofs. Maybe someday I will add the ability to have different ceiling materials, but it's maybe not as much a priority. These are configured here:

    upload_2023-6-6_12-4-36.png

    Not directly. You can hide some of the floors or ceilings using the tile flags thing, and then place the moon roof at whatever position you want it to go as a separate GameObject.
     
    ElSheriff likes this.
  18. burningmime

    burningmime

    Joined:
    Jan 25, 2014
    Posts:
    845
    I couldn't repro any Burst problems in 2022.3.0f1 on Windows. I can try Linux if you were having issues there. I don't have access to a mac.
     
    ElSheriff likes this.
  19. ElSheriff

    ElSheriff

    Joined:
    Apr 12, 2014
    Posts:
    9
    I upgraded my project to the 2022 LTS and I am no longer having any issues.
     
  20. valentinwinkelmann

    valentinwinkelmann

    Joined:
    Nov 3, 2014
    Posts:
    186
    This looks extremely promising, but I only see topdown demos in the videos that show a very limited level of detail. What about walls that are not just a texture but a mesh, e.g. wall paneling? In a topdown lowpoly game this would certainly not be necessary but in a first person game a simple flat wall is sometimes not enough. Also, what about stairs and roofs from the outside? are there plans to expand the system?
     
  21. burningmime

    burningmime

    Joined:
    Jan 25, 2014
    Posts:
    845
    If all you want is wall paneling, most games - even modern AAA games - use materials for that. Older games used normal mapping, with new games, you see parallax displacement mapping or tessellation. In HDRP, tessellation is fairly straightforward to set up.

    There are technical advantages to using tessellation for repeated patterns like paneling, because the GPU can decide how to allocate triangles based on viewing angle and size on screen, instead of the mesh always being high-poly. There are also authoring advantages because it's just a set of textures, which is generally easier to edit.

    You'll need to make stairs yourself and place them into the building. Delete the floor tiles around where the stairs come up and you should be able to fit them in.

    You can make flat roofs fairly easily. If you want hipped, gabled, mansard, etc, those are not supported. However, you can always use Burning Building to block out the basics, then export to FBX, and build your own roof in Blender or other tools. Roofs come in many shapes and sizes, so even if I were algorithmically generating them (for example with a technique like this), they definitely wouldn't satisfy every use case.

    Honestly, sales haven't been great. I will continue to update (I'll probably do one this Friday to integrate AmbientCG, and to make the UI easier to use for people who like to right-click-drag camera rotation in the scene view). But I don't have plans for major new features right now.
     
  22. burningmime

    burningmime

    Joined:
    Jan 25, 2014
    Posts:
    845
    Version 1.3.0 - Fix right click drag camera!

    A couple people mentioned that right clicking and dragging wasn't working to rotate the camera orientation. Originally, I thought it was necessary to disable it so that right clicking can be used for other things. But it tuns out I was wrong and it's possible to use right click for both selecting material and dragging the camera :) ! So that's been fixed.

    Also...

    • Added the ACG material importer to the base package. You can delete it easily enough if you don't need it, but since it's mentioned in the tutorial videos, this just makes it an easier transition. This is an editor-only component; won't affect runtime anything.
    • Added the ability to generate separate colliders for walls and for floor which will get their own layers. This is required for Top-Down Engine, but can be useful for other things. Add the Building_TDEIntegration component to the GameObject the building is on, select a layer for the walls physics object, and a layer for the floor physics object.
     
    ElSheriff likes this.
  23. Nyahahahaha

    Nyahahahaha

    Joined:
    Aug 24, 2021
    Posts:
    2
    @burningmime, thank you for the amazing asset! I have a few questions:
    1. Is possible to not show props (doors, windows, etc) on upper floors with floor cutout enabled. Ex.: When I stay on the first floor I don't want to see doors and windows on second and third floors (I want to completely hide them).
    2. Is there any way to place items on floors in the editor with drag&drop? Seems like in editor mode (scene view) there are no coliders so unity thinks that I place items on ground. So the only way to place items on different floors is to use a move tool or edit position cords.
    3. Is it possible to hide rooms with some "fog of war" or like black boxes? I found only the possibility to hide rooms completely, but this is a little confusing for me as a player that I can’t see the entire structure of the building I’m in.
    4. Is there an auto detection of the current floor or I need to write my own script that detects on which floor player currently stays and change Floor for Building Runtime Cutout?
    5. I saw limitations in source code for max floors and rooms, are there some performance issues or I can remove limitations and create a large shopping mall with 6-7 floors with 100 rooms on each floor?

    Your asset will be a god blessing for my game if i can realise these points)
     
    Last edited: Oct 3, 2023