EGG file size and Panda3D rendering

I’ve been posting a series of newbie questions, so thanks in advance for the help. I have just finished reading through the forums and re-reading several Blender/Chicken tutorials, with no luck.

Here’s my issue:

I created a 128x128 mesh grid in Blender, added a few hills and fractals. My goal was to create just a simple egg file to load in to Panda. I was able to export the terrain file to an EGG file with no issues.

My EGG file is well over 65MB in size… absolutely huge. I understand from the forums that large EGG files are normal, but this is only a 128x128 mesh. Now, I am able ot load my EGG in to Panda. However, my starting camera view is FAR away from my terrain. It appears ot be a large virtual space with my 128x128 terrian floating out in the middle.

Does the huge file size and the results of my EGG load in Panda mean that I somehow exported a much larger space (possibly empty space surrounding my 128x128 mesh) from Blender, and this would explain the results I have?

Does Blender know to only export my 128x128 mesh grid, or do I somehow need to reduce the “workspace size” in blender? I searched Blender and the Blender tutorials/forums but don’t see much in the way of setting dimensions to the 3D work space.

I know this is a Blender question more than a Panda question, but I wanted to confirm with the Panda community that this is normal behavior? I’m a little lost as to what I do with all of that empty space that was loaded in to Panda from my EGG file.

Thanks again for the help.


things like “empty space” usualy are empty enough to not contain any data,so exporting data where nothing is makes no sense. so generaly its not done.

the size of your file is pretty easy to explain. a 128x128 grid consists of:
128x128 vertices = 16384
since the egg file is human readable each vertex results in ~100characters text.
each triangle adds another 150 characters
since each sqare part between 4 vertices is made from 2 triangles… you’ll get (128*2)^2 triangles.
you can see where this ends :smiley: many millions of bytes. for such terrains you’r better off converting them to BAM format(but always keep a backup of the egg since only egg files are compatible between panda-versions). your bam-file should be about 2MB.
if your camera is standing far away from the terrain. then you either positioned your terrain far away from blenders world-center. or you set the position of your camera or terrain quite off.

First, be assured: the large size of your egg file is indeed perfectly normal, and does not indicate large amounts of empty space have been converted. Empty space, in fact, takes up no space in your egg file, so that 65 MB must be the space required to represent your 128x128 mesh.

You can do model.analyze() after you’ve loaded it (or press shift-A in pview) to list the number of vertices and triangles to reassure yourself that you’ve converted as much model as you thought you did.

As to why it’s so far away: I suspect it is most likely a problem of scale. Scale is classically difficult to get right when converting from a modeling package like Blender into a rendering engine like Panda. I bet you accidentally modeled your mesh very, very tiny–for instance, 2.5cm x 2.5 cm–so then when you load it in Panda, it appears very small (which looks very much the same as very far away).

You can also do model.getBounds() to get an idea of how big it is in Panda (or press shift-B in pview). This will say something like “bsphere, c (0 0 0), r 1.73205”; the last number is the radius of your bounding sphere, or an estimate of half the object’s size. For a terrain, you’d probably expect this to be on the order of 1,000 or so. If it’s not big enough, you can make it bigger in panda with model.setScale().

For that matter, if it’s really not a problem with scale, but a problem with it being too far away, well, you can bring it closer in panda with model.setPos().


I verified that in blender my camera and my light are both right above my mesh grid, and I re-exported just to make sure. No change.

I’ll try to create a much bigger mesh grid to see if in fact I created something “tiny” by accident, although it doesn’t look tiny in blender :slight_smile:

camera in blender does not = camera in panda3d. As far as i know blender does not exports cameras. You can position a smallish cube or some thing there and move your camera to that location when you start the game.

Thanks, Treeform. That does help.

I guess where I am confused at this point is in how you determine where your terrain will be drawn (what the position will be). How do you know what scale/position to use in your app if you can’t predict where your terrain will be drawn?

I understand the use of the empty mesh object and searching for that name, and then setting position to that location. Is it common practice, for example, to create the empty mesh object in the center of all of your terrain maps, and then always using that as a reference point to know where the center of your terrain is located? Or is this over thinking the problem and there is an easier way?



No i think you got it right. Creating empty meshes is not advasible because blender might not export it properly or the egg loader would junk them because they have to have an some sort of importance tag or some thing. I would just create a 1x1x1 cube and remove it when i load the level.

I never had problems with blender scales. 1 unit in blender = 1 unit in panda3d. You can create a 1x1x1 cube and use that as a “ruler.” I bet thats why blender starts with it. Or if you are so pro you can use some of the blender measurement tools.

And that concludes my push for 1x1x1 cubes.

Ok, so where would i create this 1x1x1 cube? I would guess that I would create it in the same location in every terrain file as a reference point, but I’m a little confused as to how I would place it in relation to the 128x128 grid in Blender?

Well, there should be no reason to not place the cube wherever seems useful to you at the time, and move it about as you please. You should already have Blender’s origin as a reference point, for the most part, and you can always import previous models if you want to place something relative to an already-created model.

Are you sure? I seem to recall that I’ve done this with no ill effect a number of times now (using the R44 version of Chicken, at least). Specifically, I generally create a default cube, delete the vertices, and then work with the resultant “dot”.

However, it may be that it gets factored out if you employ such speed optimisations as flattening before you access your empty mesh.

yea i think Thaumaturge is right.

My problem was that my point was at the center with 0,0,0 pos and it would get removed if there was stuff parenting it. There is a command to disable that egg-flatten …

Quite possibly - I don’t think that I’ve had a point that was actually at (0,0,0).

Ok, so it sounds like I could use the empty mesh object as a reference point, as long as I place it at the same location on every terrain map. Using the cube sounds a little more difficult than the empty mesh so I hope this works out.

I’m just learning Blender, so I’ll dig around for a tutorial or something that can walk me through the use of these empty mesh objects.

I was able to load my EGG file and have it appear close to the camera by using a scale of (100,100,100) and then setting the Y and Z axis of the camera. So, I believe my previous issues with it being “small” and “way off in the distance” was indeed a scaling issue. (I’m hoping that it’s normal to have to scale a terrain map like this, otherwise I’m doing something wrong.)

I’ll give it a whirl and let you know how it works out. Thanks for the help.

Wasn’t the point of the cube to give a reference size, as opposed to a reference position, which the point gives?

If you turn out to indeed be having scaling issues, perhaps do create a 1x1x1 cube, and use it as a source of comparison, taking whatever scale you prefer - Treeform’s “1 Blender unit = 1 Panda unit” seems reasonable and straightforward, for example.

If you’re not sure of how to check your cube’s size, in a 3D view open the “Transform Properties” panel (either via the “Object” menu or by pressing ‘n’), and, with your cube selected, check (and change if called for) the dimension values (DimX, DimY and DimZ) - they should all read 1 for a 1x1x1 cube. Alternatively, if the cube is aligned to the axes (which should help, I would think, and should be most easily accomplished, I think, by creating it from one of the top, left, right or their opposite views), just enter edit mode and make sure that the vertices are at either -0.5 or 0.5 in each direction. I think that the default size is 2x2x2.

As to having scaled your terrain, surely it would appear “closer” after scaling whether the original problem were that it was too small or that it was too far away?