Rick Posted January 23, 2012 Share Posted January 23, 2012 Is there any way to get ForEachEntityInAABBDo to work with hidden entities because it seems like it's not and I'm trying to use it to find entities around the player that are hidden so I can show them. Quote Link to comment Share on other sites More sharing options...
Josh Posted January 23, 2012 Share Posted January 23, 2012 No, these get removed from the octree and will not be iterated through. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Rick Posted January 23, 2012 Author Share Posted January 23, 2012 What kind of options do I have with a 128x128 terrain with a bunch of trees, grass, and bushes on it and get reasonable speeds because right now it's pretty slow? I had a program generate the placement for the trees, grass, and bushes and it doesn't seem like it would be to overwhelming population wise. I don't know anything about poly count and what's to high but you can see below the kind of speeds I'm getting. Quote Link to comment Share on other sites More sharing options...
Clackdor Posted January 23, 2012 Share Posted January 23, 2012 Thats a lot of shadow polys. It's weird that you say that the engine is rendering models not in your camera field of view, though. Quote Link to comment Share on other sites More sharing options...
Rick Posted January 23, 2012 Author Share Posted January 23, 2012 Yeah, not sure why 3888 entities are being drawn because there aren't that many on that screenshot so it's probably drawing them all for some reason. Quote Link to comment Share on other sites More sharing options...
Josh Posted January 23, 2012 Share Posted January 23, 2012 Something is wrong if 4000 entities are being drawn. The Zone only had about 1000 at any given time. Perhaps you have large numbers of models that have complex hierarchies. I can't diagnose this further without seeing the scene files. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Rick Posted January 23, 2012 Author Share Posted January 23, 2012 There are the 3 models only (minus the character since when I just have the character it runs fine). Nothing out of the ordinary besides the bush having a bone (forgot to take that out), but I rendered without bushes and got the same result so that can't be it. They seem pretty normal to me. These are from Dexsoft. I move the camera to that character models position, then offset it back and up and point at that character. Not sure if that would have anything to do with it. I assume the model viewer would show the hierarchy you are talking about. Quote Link to comment Share on other sites More sharing options...
Clackdor Posted January 23, 2012 Share Posted January 23, 2012 You have a small number of batches, at 20. I have over 200. Quote Link to comment Share on other sites More sharing options...
Rick Posted January 24, 2012 Author Share Posted January 24, 2012 Shouldn't Leadwerks be handling all this stuff for me? My models seem basic enough. Why would it be drawing everything if only a very small portion is visible on screen? Quote Link to comment Share on other sites More sharing options...
Pixel Perfect Posted January 24, 2012 Share Posted January 24, 2012 I'd have thought frustum culling should have been taking care of anything outside of the viewing area. Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
Clackdor Posted January 24, 2012 Share Posted January 24, 2012 Shouldn't Leadwerks be handling all this stuff for me? My models seem basic enough. Why would it be drawing everything if only a very small portion is visible on screen? I think it should be. Quote Link to comment Share on other sites More sharing options...
Rick Posted January 24, 2012 Author Share Posted January 24, 2012 So where does a person begin trying to figure out why frustum culling isn't filtering out the non visible models? Clackdor suggested trying the tree models that come with LE and I"ll do that tonight, but would seem odd if it was the models themselves. Quote Link to comment Share on other sites More sharing options...
Pixel Perfect Posted January 24, 2012 Share Posted January 24, 2012 Check their AABB box extents, see that you don't have anything silly which is really extending them. Are you really creating 3800+ entities Rick, have you done a count in your code? That does seem like a hell of a lot given your veg density looks to be small and its only a 128x128 terrain! Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
Rick Posted January 24, 2012 Author Share Posted January 24, 2012 128x128 with a grid size of 1x1 gives 16,384 tiles that could potentially have a tree, grass, or bush on it. All that information is stored in a sqlite table. I'll get the count in that table when I get home. I guess I didn't think 3800 was to high given how many tiles there are and the probability I gave for each tree, grass, bush to occupy a tile when generating the map. I'll double check the table count though when I get home just to make sure that matches. Some areas are heavier than others. I just moved my starting point to an open area and that's where I took the picture. I'll check the AABB of the models in the model viewer. Forgot to turn that on when I made those screenshots. The trees were larger and I did scale them down in UU3D so I would imagine the AABB gets scaled when I do that, but will double check that also when I get home. Thanks for the ideas guys. Quote Link to comment Share on other sites More sharing options...
Josh Posted January 24, 2012 Share Posted January 24, 2012 If all your entities are parented to one pivot, as they are when you load a scene, they will all be iterated through, at least. After loading a scene, the first thing to do is unparent everything from the scene root, which provides an easy way to keep track of what just got loaded. However, you should use the vegetation system for stuff like this, as it is specially designed to be very efficient for static objects. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Clackdor Posted January 24, 2012 Share Posted January 24, 2012 So the vegetation system is more than just a tool to quickly place a large number of models? Quote Link to comment Share on other sites More sharing options...
Josh Posted January 24, 2012 Share Posted January 24, 2012 So the vegetation system is more than just a tool to quickly place a large number of models? Much more. I think I have the ForEach... command working now with Lua, will upload tonight... Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Rick Posted January 24, 2012 Author Share Posted January 24, 2012 If all your entities are parented to one pivot, as they are when you load a scene, they will all be iterated through, at least. After loading a scene, the first thing to do is unparent everything from the scene root, which provides an easy way to keep track of what just got loaded. However, you should use the vegetation system for stuff like this, as it is specially designed to be very efficient for static objects. These aren't static objects. You can cut trees down, pick grass, and pick bushes for food. They will go away when harvested. Players can plant trees, bushes, and grass on any tile they want. With the top down view only a certain amount of models will be visible at any one time. These also are not loaded with the scene. My scene is an empty terrain. The terrain is logically split into 1x1 tiles and I made a small program that randomly picked tiles for trees, grass, and bushes to be placed and stores that in a database table. I then load the scene, then loop through this database table to get the tile positions (which I then calculate their actual 3D position) and model name to load. I load them, then place them. This also won't just be for trees, grass, and bushes. You'll be able to build walls, floor tiles, chairs, beds, and other things that snap to this grid. You do give me something else to look at though. At one point I did parent them all to a pivot because I was thinking I could hide the pivot then override the hidden child entities to show them (which of course didn't work). I'll double check that I don't still have that pivot in there. Quote Link to comment Share on other sites More sharing options...
Rick Posted January 25, 2012 Author Share Posted January 25, 2012 So my table that stores tile location and what model is on that tile there are 4182 records which means that's how many models there will be total on this 128x128, but as I said only 30-50 in camera view at any given time because of the top down view. I am not parenting anything. I simply loop through each record in this table, load the model, calculate the location based on center point of tile location and position the model there at load time. Here is a picture of one of the trees when I do show AABB in the model editor. Not sure how to read this as it has the outer orange line and outer blue line. I'm guessing the inner orange line is the actual AABB of the model and not sure what the other lines are. So did some tests but the issue still remains why does it say it's drawing so many entities if so few are actually visible. I did notice if I would move to one edge of the map the entities drawn number would go down. I have 746 trees and when they are just drawn I get 100 fps but it still says it's drawing all of them (15 were visible to camera) I have 240 bushes and when they are just drawn I get 140 fps but again it says drawing all of them (5 were visible to camera) I have 3196 grass and when they are just drawn I get about 30 fps and again it says it's drawing all of them (maybe 50 or so visible to camera) I tried switching the tree model to the LE tree model but it errors out on me. Guessing it's because I'm running it outside the editor and doesn't some of those have password stuff on them because they are from like Dexsoft or something? So I don't know how lights play into this all but if I remove all light sources in my scene it's much more reasonable and more accurate as to the number of entities the camera can see. So is this a bug of lights or just the reality of how LE works? I notice this in the editor also. This is exactly what I want, but with lights Quote Link to comment Share on other sites More sharing options...
Scott Richmond Posted January 25, 2012 Share Posted January 25, 2012 You should also consider grouping models into 'cells' of say 16x16 tiles. I notice your cull time is the same as it takes to render. It will probably increase the number of things its rendering but reduce the time it takes to iterate and cull entities. As your map scales or you include more models this might be a good options. Its a test and see what happens sort of thing. Quote Programmer, Modeller Intel Core i7 930 @ 3.5GHz | GeForce 480 GTX | 6GB DDR3 RAM | Windows 7 Premium x64 Visual Studio 2008 | Photoshop CS3 | Maya 2009 Website: http://srichnet.info Link to comment Share on other sites More sharing options...
Rick Posted January 25, 2012 Author Share Posted January 25, 2012 You should also consider grouping models into 'cells' of say 16x16 tiles. When you say grouping what specifically do you mean? Parenting them to a pivot every 16x16 tiles or something like that? Quote Link to comment Share on other sites More sharing options...
Scott Richmond Posted January 25, 2012 Share Posted January 25, 2012 Occlusion Culling: http://www.leadwerks.com/wiki/index.php?title=OcclusionCulling Its a pity the forum wiped because I sorted all this out in a thread once. Pretty sure the idea was that you group models together (model.group(parentmodel)? ) and then turn on OC for the group itself. What this would do its cut down on the number of objects OC had to iterate over massively. Quote Programmer, Modeller Intel Core i7 930 @ 3.5GHz | GeForce 480 GTX | 6GB DDR3 RAM | Windows 7 Premium x64 Visual Studio 2008 | Photoshop CS3 | Maya 2009 Website: http://srichnet.info Link to comment Share on other sites More sharing options...
Josh Posted January 25, 2012 Share Posted January 25, 2012 I can't comment on the scene without seeing it on my own computer. Something seems really wrong. I see about 20 models onscreen, not 300. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
gamecreator Posted January 25, 2012 Share Posted January 25, 2012 Yeah, not sure why 3888 entities are being drawn because there aren't that many on that screenshot so it's probably drawing them all for some reason. Any chance that there are multiple entities loaded right on top of each other? Quote Link to comment Share on other sites More sharing options...
Rick Posted January 25, 2012 Author Share Posted January 25, 2012 @Josh, if you look very closely you can see there are grass models like in the others scenes. Grass is making up most of the models so the count of 300 is accurate. Also, I'm using C++ now (got your msg just this morning). Was using Lua but switched the program to C++ because I was attempting the ForEachEntity function to see if I could work around this issue. I can create a zip file with this scene but remember that the actual LE scene from the Editor is just the terrain and the 1 character model. Everything else is loaded at run-time so not sure if you'll get the same debugging ability you are looking for with the scene. I'll package this up in a zip tonight. Any chance that there are multiple entities loaded right on top of each other? Not that I can see. 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.