Jump to content

Scott Richmond

Members
  • Posts

    422
  • Joined

  • Last visited

Everything posted by Scott Richmond

  1. Ok. So I've put together the below demo that spawns 25,000 barrels. Playing with the demo on its own let me see that it does sort of work well - View range culling to nothing still seems to take up a fair bit of time at 10ms for 25k barrels. I suppose at this point the aim is to find further optimisations such as culling groups, or any other ideas? // Leadwerks engine: #include "leo.h" using namespace LEO; int main (int argc, char *argv[]) { // Set graphics mode Engine engine("3DF",1024,768); engine.AddAbstractPath( "./Data" ); Framework fw(CREATENOW); fw.main.world.SetAmbientLight(Vec3(0.13,0.14,0.17)); fw.main.world.SetCullRange(20.0F, 250.0F, 500.0F); // Near, Medium and Far view ranges DirectionalLight lig2(CREATENOW); lig2.SetShadowmapSize(1024); lig2.Turn(5,0,0); OcclusionCulling(false); SetWireframe(false); SetStats(2); // Detailed stats for(int x = 1; x < 50; x++) { for(int y = 1; y < 50; y++) { for(int z = 1; z < 10; z++) { Model *model = new Model(); model->Load("abstract::oildrum.gmf"); model->SetViewRange(VIEWRANGE_NEAR, RECURSIVE); model->SetShadowMode(false); model->Move(x, y, z); //model->Hide(); } } } Body player = CreateBodySphere(); //Create the player object Camera playerCamera = CreateCamera(); // Create the player camera object MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2); // Initialize variables: TVec3 camRotation = Vec3(0); float mouseX = 0; float mouseY = 0; float playerMove = 0; float playerStrafeUD = 0; float playerStrafeLR = 0; HideMouse(); player.SetMass(1); player.SetGravityMode(0); // Sets whether player should be affected by gravity. player.SetDamping(1.0F); player.SetType(3); player.SetPosition( Vec3(0,0,0) ); playerCamera.SetPosition( Vec3(0, 0 ,0) ); playerCamera.SetRotation( Vec3(0, 0, 0) ); playerCamera.SetParent(player); // Sert the player object as the parent. playerCamera.SetRange(0.1F, 20.0F); //Game game; while( !Keyboard::I****() && !engine.IsTerminated() ) { fw.Update(); if( !engine.IsSuspended() ) { /****** Update player camera ******/ //Camera look mouseX = Curve( MouseX() - GraphicsWidth()/2, mouseX, 6); mouseY = Curve( MouseY() - GraphicsHeight()/2, mouseY, 6); MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2); camRotation.X = camRotation.X + mouseY / 10.0F; camRotation.Y = camRotation.Y - mouseX / 10.0F; RotateEntity(player, camRotation); playerMove = KeyDown(KEY_W)-KeyDown(KEY_S); playerStrafeLR = KeyDown(KEY_D)-KeyDown(KEY_A); // Double movement speed with shift if (KeyDown(KEY_LSHIFT)||KeyDown(KEY_RSHIFT)) { playerMove*=20.0; playerStrafeLR*=20.0; } // Make the player travel for slightly longer after keypress: TVec3 playerForce = Vec3(playerStrafeLR*10.0, 0, playerMove*10.0); playerForce = TFormVector(playerForce, player, 0); player.AddForce(playerForce); fw.Render(); engine.Flip( 0 ); } } return engine.Free(); }
  2. Fair enough. I'll put together a c++ demo program tonight for us to play with.
  3. Well, I sort of need to worry. If I have 20,000 model entities I need to know how best to render them. If LE2 simply cannot handle that number of objects I need to know so I can start writing some sort of method that does a hide() when objects are out of viewing range.
  4. josh, understood. So 'occlusion culling' includes viewrange culling? If so, can I use occlusion groups to group entire regions of my map? That would greatly speed up.
  5. No that does not appear to have helped. The entity cull time is still quite high, driving FPS down. I'm guessing hide() rips the entity all the way out of the engine whereas culling on camera distance only prevents it from being drawn.
  6. Ok so I've just tried it. Unfortunately its not giving me the speed-up I thought it would. I would have thought that objects outside the set distance would do a hide(), but they don't. I don't get nearly the speed I would if I did a hide(). Why is that? Is it because the models still take up time when the engine has to check each one and do a distance calc? How can I avoid that? Would be good if I could extend the distance culling function to get it to hide models as well.
  7. Gah! WHat a bloody stupid mistake! *slaps head* You're a champ Metatron. Thanks mate.
  8. I'm developing something that requires creation and destruction of entities at runtime, so I've just been doing some tests and getting my framework going and I've noticed that when I call Model->SetViewRange() on a pointer to a Model entity it crashes! I thought for awhile that maybe its simply bad coding on my part like some sort of pointer out-of-scope issue, but the following fairly simple code does not work. Can someone browse over it and confirm I'm not doing anything silly before I officially put in a bug request? int main (int argc, char *argv[]) { // Set graphics mode Engine engine("3DF",1024,768); engine.AddAbstractPath( "./Data" ); Framework fw(CREATENOW); fw.main.world.SetAmbientLight(Vec3(0.13,0.14,0.17)); //fw.main.world.SetCullRange(...); Cube box1(CREATENOW); box1.Move(0,0.3,4); box1.SetColor(Vec4(0,0,1,1)); //Blue box1.SetViewRange(VIEWRANGE_NEAR, RECURSIVE); Sphere ball1(CREATENOW, 16); ball1.SetColor(Vec4(1,0,0,1)); //Red ball1.Move(-1,0,4); ball1.SetViewRange(VIEWRANGE_NEAR, RECURSIVE); Sphere ball2( ball1.Copy() ); ball2.Move(2,0,0); ball2.SetColor(Vec4(0,1,0,1)); //Green ball2.SetViewRange(VIEWRANGE_NEAR, RECURSIVE); Cube ground(CREATENOW); ground.SetPosition(0,0,0); ground.Move(0,-1,5); ScaleMesh(ground,Vec3(100,1,100)); Model *leModel = new Model(); leModel->Load("abstract::crates_small.gmf"); leModel->Move(3,0,0); leModel->SetViewRange(10, RECURSIVE); /* <----- CRASH: Comment this line out and it will run fine */ DirectionalLight lig2(CREATENOW); lig2.SetShadowmapSize(1024); lig2.Turn(5,0,0); OcclusionCulling(false); SetWireframe(false); SetStats(2); // Detailed stats PlayerController playerController; Game game; while( !Keyboard::I****() && !engine.IsTerminated() ) { fw.Update(); char msg[256]; sprintf( msg, "Camera Pos: %fx%fy%fz", playerController.getPosition().X, playerController.getPosition().Y, playerController.getPosition().Z); if( !engine.IsSuspended() ) { playerController.update(); fw.Render(); DrawText(0,250,msg); engine.Flip( 0 ); } game.updateMessageQueue(); } return engine.Free(); }
  9. Whatever you decide to do, don't let them go to waste. I'd be happy to host them for you if you like.
  10. How does Dave do it here on his barracks brick walls?
  11. The map matrix is made up of tiles/blocks. So at its heart I suppose its minecraft, if you want a visual reference. However I'm running it through an algorithm that outputs the surface and smooths it. So the output is a polygonal volume. I then need to paint it. I just got a reply from Josh regarding this and he said the following: As Josh mentions, surely this work has been done before? If not for LE specifically but in shaders in use elsewhere?
  12. Thanks for your input Paramecij. Are you suggesting I manually create transitions between all the different types of tiles? I do not like the sound of that at all. Surely there is a more modern approach - The article I linked in the original post sounds really nice.
  13. Just a polygonal mesh. I iterate over my terrain matrix, get the 'outside shell' and place all the vertex's I need and draw polys over them. It works really well, but I have as yet worked out how to texture such a mesh in LE.
  14. Hrm. I'm not using the LE 'terrain' stuff - I don't use a heightmap. I generate a vertex mesh myself.
  15. I'm currently working on a small isometric RPG concept and I'm having a bit of trouble working out how I'll do the terrain. What I'm working with is basically a 3D matrix database of cubes that make up the map. To draw the terrain I'm currently going to render out a big mesh from the data, which I've got sorted. But I'm unsure how I'm going to blend together the various terrain types. I've done some limited research and found a few nice articles: http://www.m4x0r.com/blog/2010/05/blending-terrain-textures/ How would I apply this to LE? Has anyone had any previous experience with this?
  16. Ah great! I'll keep doing tests then I suppose.
  17. By the way, just tested the Copy method. Works really well! 10FPS to 70FPS. Would this method apply to models as well?
  18. Agreed. And that approach can be taken further by stitching the cubes together and generating an outer shell as well. It is something I have thought about. But, I may yet still choose to go for a model approach if I'm not getting the quality I want with simple primitive cubes. And if thats the case, then I won't be able to apply such optimizations. The game concept is fairly open-ended at this point.
  19. I'm prototyping a small 3D isometric game and I'd like to have the ability to drop in, for example, 30,000 cubes as a floor. Or really, any number of models and assorted items. But the point is - There would be lots over a large area. The question is, how can I cull unseen objects in an efficient manner from the render pipeline? Using an isometric camera I'd only ever be looking at maybe 10% of the total amount of entities out there. Would I: 1. Render all entities on the map and then try to cull them by: 1a. Using the LE2 OC - I've tried this and it appears very inefficient in general. I think the time its taking to traverse the entity list is larger than just rendering the primitive cubes I'm testing with. I also have heard that if I group entities together into larger chunks, it would help a lot. However I don't know how? 1b. Try to organise the entities into some form of octree and .hide() .unhide() them based on region. 2. Don't render everything in the first place. Only create and render the objects the player is looking at by keeping track of camera position. Delete entities as they fall out of range. But would this create lots of stutter as the player scrolls around? Addendum: I also heard that, for example with these cubes I'm testing with, if I copy instead of create for each cube that helps? Any documentation on this? Any other ideas? Tips on how to render faster?
  20. Its time to move Josh, seriously man. How can you continue to pay these people who give you seemingly zero actual support. Thats just nuts. YOu might want to take a look at Dreamhost - These guys really know their stuff. They don't use cPanel (They do have an importer however). They built up their own seriously awesome management system themselves.
  21. So right now you should be asking your host for free weekly full backups. If they're not giving you anything for telling you everything is A-OK when its not AND not performing backups anyway (What the hell happens if the DC your server is in is destroyed, or the storage hardware dies?) then you're seriously being ripped off. I'm also not sure why you're, again, taking it upon yourself to come up with a backup solution - This stuff should be completely automated.
  22. Just as an addendum to Michael Betke's comment about a 'dark theme'. Whilst I don't disagree with Michael's point please, for the love of god, do not create some odd-assed custom GUI that doesn't conform the the global theme of an OS. Based on the screenshot it looks like you've already thought of that, but I just want to be sure.
  23. Just wanted to pipe and say I just hit this problem as well. Thanks for the fix notes.
  24. Agreed! I hate it so much some a developer decides they need to break your entire theme by forcing some non-standard UI. *shakes head*. Stupid.
×
×
  • Create New...