tipforeveryone Posted February 2, 2020 Share Posted February 2, 2020 I have a plan to put a building into game, I wonder which is the best way to do that, I thinkabout some solutions but doubt about physics performance as well 1. Import a whole building model in blender (rooms, walls, stairs, roof etc), then create a physic mesh to apply to it. my character will move around inside the building with its physic mesh. 2. Create each elements of building in blender (stairs, walls, columns, roof as sperated meshes), import into game, reposition those elements to construct whole building, each element has it own physic mesh 3. Import whole building model then use premitive shape to construct the building's physic. I will assign invisible material on those shapes to hide them later. Quote Link to comment Share on other sites More sharing options...
cassius Posted February 2, 2020 Share Posted February 2, 2020 whichever way you do it you need to set the physics to polymesh ( in model editor and then select model and go into scene panel and make the pysics scene mode etc. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
reepblue Posted February 3, 2020 Share Posted February 3, 2020 Your physics mesh will be very high poly as it does 2 triangles per rectangle face. I would guess this would be expensive, but I'm interested in how it works out. The correct way to do this would be to make the gameplay walls/floors out of brushes and do the roof, railings and such as models. But with vsync enabled/low frame rate, brushes will pop in upon spinning the camera. If your plan doesn't work out, I suggest you make your building layout with brushes, and force disable vsync. Forcing a frame rate via the graphics driver (like what you have to do with Nivdia Linux drivers) produces better results anyway. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Marcousik Posted February 3, 2020 Share Posted February 3, 2020 I can remember I had this problem: if the building is too complex, the poly mesh could be correctly generated but not entirely be saved by the engine, and that's why I had to use your solution described under (2). But if the house is not too complex, it should be ok with using (1) Other solution is to build your own collision shape with a mesh named "collision" that will be recognized as such by the engine - I do not know exactly how to proceed but this should be best solution because it minimizes cost I think. That will be used on the Leadwerks tree to build a simple box shape on the trunk, without shaping the leaf 1 Quote Link to comment Share on other sites More sharing options...
gamecreator Posted February 3, 2020 Share Posted February 3, 2020 Leadwerks doesn't seem to be very good at creating even simpler collision meshes (as per my thread) so I think you'll need to use Marcousik's suggestion and make them in your modeling program yourself. Edit: just realized that the thread is in the LE5 beta forums though it discusses LE4 so I don't know who will have access. Quote Link to comment Share on other sites More sharing options...
Marcousik Posted February 3, 2020 Share Posted February 3, 2020 Yes and that would be the part: Quote Link to comment Share on other sites More sharing options...
gamecreator Posted February 3, 2020 Share Posted February 3, 2020 I saw that and had several comments on that page. It seemed to me like a longer way to do what you can do directly in the modeling program (create and label a collisionmesh or collisionhull). Quote Link to comment Share on other sites More sharing options...
reepblue Posted February 4, 2020 Share Posted February 4, 2020 With my method though, you get the exact results you want. It's only really good for concave stuff. (pipes, frames, etc) Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
gamecreator Posted February 4, 2020 Share Posted February 4, 2020 I guess I don't understand the difference. What can you do with your method that you can't do by exporting the models together (one as the visible mesh, one as the collision model)? Quote Link to comment Share on other sites More sharing options...
reepblue Posted February 4, 2020 Share Posted February 4, 2020 If you export a model with it's collision mesh as a child, you'll run into issues if you give the model mass. Plus the final result like looks sloppy to me. I personally like to collapse all my static models upon importing. This might also help performance, but I'm not 100% on that. 1 Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
tipforeveryone Posted February 14, 2020 Author Share Posted February 14, 2020 Thanks guys, by I figure out the best way to get the goal. 1. Only create model of whole structure 2 Create another version with only basic shapes the use it as physic mesh 3. Create other elements of building as sperated models with their own physic mesh 4. Put them together. Here is the result Quote Link to comment Share on other sites More sharing options...
cassius Posted February 14, 2020 Share Posted February 14, 2020 I don't understand. Why create basic shapes when there are physics options in the model editor. Or am I missing something? Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
gamecreator Posted February 15, 2020 Share Posted February 15, 2020 8 hours ago, cassius said: I don't understand. Why create basic shapes when there are physics options in the model editor. Or am I missing something? The automatic physics options don't work very well for most shapes and certainly not for complex ones. Even something relatively simple like the scene below (a single FBX), the various options either overdo it or give horrible results. The final one is convex decomposition with the maximum (6) iterations. Quote Link to comment Share on other sites More sharing options...
cassius Posted February 15, 2020 Share Posted February 15, 2020 I always use polymesh option for enterable buildings. I have a huge castle model tht works fine.. interesting though, thanks. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
reepblue Posted February 15, 2020 Share Posted February 15, 2020 It should be noted that 1000 collapsed brushes will run much faster than 1000 models. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Marcousik Posted February 16, 2020 Share Posted February 16, 2020 16 hours ago, reepblue said: It should be noted that 1000 collapsed brushes will run much faster than 1000 models. What is the concrete application of this? Quote Link to comment Share on other sites More sharing options...
reepblue Posted February 16, 2020 Share Posted February 16, 2020 Test screenshots on my system: Intel i5 7600k and a AMD RX 480. 1000 sphere brushes (400-500fps!) Here's the app drawing 1000 boxes that are models. (108 polys per model; 250 - 280fps) It should be noted that the sphere example took really long to load, but the end result is basically free geometry. We are told in other engines that brushes are expensive and should be replaced with models before you ship. However, in Leadwerks 4, the opposite is true - Models are more of a cost than brushes. The issue is that we have no vertex tool so we are limited with building things with simple shapes. There is also a nasty rotation issue with faces in which the editor will auto apply the rotation of 0 upon loading a map. I've reported this, but it's not something Josh can't really track without knowing what's causing it. So in-conclusion, I see that you should be using collapsed brushes (brushes without scripts) for buildings. Just disable vsync to prevent the walls popping in/out and you should be set. With the upcoming engine, this shouldn't be an issue, and hopefully there will be a vertex tool for brushes in the new editor. 3 1 Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Marcousik Posted February 17, 2020 Share Posted February 17, 2020 This is really interesting and weird... I read somewhere that csg are converted to models after the start function. I would really enjoy to know why so much fps difference, like where/for what goes/is used this "fps*energy" ? Quote Link to comment Share on other sites More sharing options...
Ma-Shell Posted February 17, 2020 Share Posted February 17, 2020 The difference comes from the fact that the entire thing is collapsed to just a single model. This means that every piece of code, which iterates over all instances only walks over this object once instead of 1000 times. Also there is only one transformation matrix which is getting updated and pushed back and forth from CPU to GPU and which takes much less space (which can be used for caching again) Quote Link to comment Share on other sites More sharing options...
Marcousik Posted February 17, 2020 Share Posted February 17, 2020 Yes okay, I understand, so this would mean when using a ray cast with pick(), the PickInfo.entity:Hide() on this would hide all the 1000 spheres. Well should try this, but I am not sure about this. Quote Link to comment Share on other sites More sharing options...
gamecreator Posted February 17, 2020 Share Posted February 17, 2020 2 hours ago, Ma-Shell said: The difference comes from the fact that the entire thing is collapsed to just a single model. This means that every piece of code, which iterates over all instances only walks over this object once instead of 1000 times. Also there is only one transformation matrix which is getting updated and pushed back and forth from CPU to GPU and which takes much less space (which can be used for caching again) Does this mean that if reepblue combined all of those boxes into a single mesh that it would be the same speed? Because that's probably how you would want to export the house in the original post anyway. Quote Link to comment Share on other sites More sharing options...
Ma-Shell Posted February 17, 2020 Share Posted February 17, 2020 I suppose, that would be the case. There might be some other optimizations for brushes (e.g. if you want to have a sphere, you can simply transfer the center and the radius to the GPU instead of multiple vertices and again save some bandwidth and RAM real estate) but I believe that these differences would be only minor. I should say though, that I have never done any comparison nor do I have any specific knowledge of how this is implemented. Everything I'm saying about that topic is just derived from things I gathered in different forum posts here over the years and using my own logic Quote Link to comment Share on other sites More sharing options...
reepblue Posted February 17, 2020 Share Posted February 17, 2020 My concern is the collision mesh and how many buildings you want. If every building was its own model with it's own shape, you'll most likely get the same performance as The Zone. (40fps on my system) Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
gamecreator Posted February 17, 2020 Share Posted February 17, 2020 I had to try this myself. I added textures but the results were what you would expect: Brushes: Models: I then combined all boxes into 1 mesh and all collision boxes into 1 collisionmesh in 3DS Max and exported it. The speed was again good: I think the lesson is that limbs slow Leadwerks down a lot and yet individual brushes don't. 3 Quote Link to comment Share on other sites More sharing options...
reepblue Posted February 18, 2020 Share Posted February 18, 2020 Yeah, figured much. Issue is that it may not be possible or ideal to collapse all your models into one for a real game. I guess when it comes to detailing, you need to find out what chunks you're allowed to combine. Again, the new engine makes this issue go away, but I really wish that a group feature was implemented to auto merge your models for you so you didn't have to do each combination yourself. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.