MackeyK24 Posted December 5, 2016 Share Posted December 5, 2016 I got a question about "Common Game Practices"... I am NEW so I don't know how the industry handles something like this. I am creating a BabylonJS Toolkit For Unity (If you have not heard already )... One of the features i have i using the Unity Built-in terrain data to Generate native babylon grounds (using createGroundFromHeightmap). But can't get REALLY smooth hills and mountains (without ALOT of tessellation ). So as an experiment, instead of just using the metadata to store terrain metadata that is created on client side with createGroundFromHeightmap... I make 2 meshes from the terrain... The first one I scale down to about 5000 verts i was intending to use this as a 'Collision Mesh' that you can walk around on... No materials on it with a REALLY low visibility of 0.000001 is REALLY blocky BUT at least follow the outline of the original mesh for the purpose of the camera collisions so you can walk on smoothly... Then i render out a much more detailed terrain mesh (MAX 65000 Verts) to use as more of a "Visual Effect" mesh that actually has all smooth mesh contours... I just OVERYLAY them in exact same position and rotation of parent HOLDER mesh object. My hope was to provide a Detailed Terrain Mesh so it looks good (BUT YOU CANT WALK AROUND ON MORE THAN 10000-12000 verts without MAJOR FPS drop) and much lower poly version of the terrain with its collisions set to true so you don't fall thru ground and you still go up and down to follow the contour of the terrain. But as long as i don't make that detailed mesh collisions true... The dual mesh approach seems ok on my machine with NOT TOO BAD frame drop. Now granted its not the whole game yet with all the other game assets and logic... But seems ok so far. My question is (because I'm new to game programming concepts)... SHOULD i be doing shit like that... or is that too much for a HTML WebGL based games (or a string of babylon scenes put together to be a game) I am OLD SCHOOL... from the days of 'KISS' programming (Keep It Simple Stupid) and i want to put kool and useful features in the toolkit. But i am wondering if some of the stuff i am just 'Making Up' over hear (Token On Maui ) is too much and if my new Dual Collision/Detailed Terrain mesh system is going too far and 1 single mesh (as best you can get it to look is enough). Please let me know what you guys think Quote Link to comment Share on other sites More sharing options...
Wingnut Posted December 6, 2016 Share Posted December 6, 2016 Hiya M! May I throw another monkey wrench into the gears? There is also "The Boys From Dynamia". Endless dynamic terrain. Here's one from @NasimiAsl. Pryme8 has one, too... but I couldn't find a demo. Start by backing-away from Naz's "home tube" (cursor down)... and just keep backing, and backing, and backing, until your finger falls off. (if you wish). Endless lakes and mountains (actually, "fjords", I suppose), and high performance, and fine surface-following cam/player. hmm. Makes a guy think, eh? Careful. It is easy to get lost in Naz's terrain... so keep Naz's "tube" in-sight... for your first adventure into the mountains. Everyone over at Air Rescue is drunk on spiked egg nog, so you are on your own... if you get lost in NasimiLand. Notice the player/cam moving up/down when player is floating in water? Pretty cooooool. Held cursors, multiple held cursors... nice. How do you like his code? Sort of like arc welding on your eyeball, eh? Yeah, it' off-topic... but it's still pertinent. Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted December 6, 2016 Share Posted December 6, 2016 i think he want make hight map not infinity terrain. am i right ? Quote Link to comment Share on other sites More sharing options...
xaero59 Posted December 7, 2016 Share Posted December 7, 2016 @MackeyK24 I think your approach is good, it's common to use simpler mesh to create collisions with high poly mesh, personaly this is how I do it for pretty much everything that needs to collide ( except for stairs cause I'm lazy ). You need to define not too bad frame drop though, the performance will depend of how much textures/meshes/vertices your scene will have. Currently I'm working on a scene ( no terrain involved ) that has about 200 000 vertices/111 meshes and 161 textures and the frame rate drop from 60 to 40 on some area , especially when the meshes first appear on the screen. Many focus on low poly meshes but it's important to keep in mind that textures have also a big impact on performances, before, I used 450 textures on the scene and the performances were so horrible that my entire computer was freezing for several minutes leading to webgl crashing. Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted December 7, 2016 Author Share Posted December 7, 2016 If you guys got a little time check out where I'm out so far: U3D - BabylonJS - Terrain and Navigation Concepts Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted December 11, 2016 Author Share Posted December 11, 2016 On 12/6/2016 at 4:20 PM, xaero59 said: personaly this is how I do it for pretty much everything that needs to collide Hey @xaero59 ... Does this impact performance for ALL meshes that nee to collide ... even if mesh is a simple box or sphere itself... would that still be "GOOD" to have a separate mesh just for the collisions ??? The reason i am asking is because in my Unity Toolkit... There is a Box Collider Component (capsule, sphere and mesh as well) and it looks to me that NO MATTER the original mesh geometry is, if you want collision, you NEED one of the collider components which creates a simplified mesh... So i think you end of with two meshes for everything that has to collide... That is apparently kool for unity, but do you think that approach of a separate collider mesh for every piece of geometry (game object mesh) that needs collision is kool for babylon ??? @Sebavan or @Deltakosh Please weigh in if you any info Quote Link to comment Share on other sites More sharing options...
xaero59 Posted December 12, 2016 Share Posted December 12, 2016 It seems that the simpler is your mesh that is set to collide , the better , basically a 4 vertex box sets to collide seems to have no impact on performances at all. On the other hand, my stairs has 9200 vertex and when the character collides with it, I have a 1-2 fps drop , if I had used two planes to collide , I think I would not have any fps drop here but the stairs are located in an area where the draw calls are the lowest so that's fine for me. Regarding your hidden terrain, can't you simplify it even more ? Maybe if you can keep the faces only and merge almost everything else you would get better performances. If I remember well, in your video , you get 40 fps when your mesh collide with your terrain, I think if you add a lot of meshes into the scene with textures/bones animations etc.., it may not work very well :/ Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted December 12, 2016 Author Share Posted December 12, 2016 4 hours ago, xaero59 said: Maybe if you can keep the faces only and merge almost everything else you would get better performances. @xaero59 What do you mean... Keep faces only and merge everything else ? Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted December 12, 2016 Author Share Posted December 12, 2016 Note: I was able to use LOWER ground tessellation and BOOST the heights to get even lower polys on the terrain collision mesh... down to between 1600 - 2600. Works even better BTW... that 40 fps was using a much heavier collision mesh and on my XBOX ONE. ALSO NOTE: When previewing content inside the Unity Browser (Basically the asset store window) you only get a max 45 FPS. I don't think i have much if any drop in fps when using the version of the toolkit that has the ground tessellation level and height map strength boost value... Is a bit BLOCKY on sharp points, but it works well ... so far I am very curious to know what you are talking about 'Keep Faces Only' and merge everything else... Sounds Interesting. Quote Link to comment Share on other sites More sharing options...
xaero59 Posted December 12, 2016 Share Posted December 12, 2016 I don't use Unity so I don't know if you can edit your terrain mesh geometry, but in Blender for example, you can select two faces and join them , or dissolve edges so you would end up with a less complex mesh but the geometry would still be correct to use as a collider. Well I suppose that would be quite some work for possibly minimal performance improvement since you already get 60 fps on a pc browser. Quote 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.