This is an old thread, but it’s the closest I can find to touching on my issue. I’m experimenting with my own take on a terrain/lod system (with it’s own strengths and weaknesses compared to every other terrain/lod system out there of course.)
Anyway, I’m dynamically loading a /lot/ of textures on the fly and noticing stutters.
I am doing the trick where I create a separate geometry/texture loader thread. In that thread I load the texture into a PNMImage() first and then make the texture (code snippets, pretend the file is always there):
with open(file, "rb") as f:
data = f.read()
p = PNMImage()
p.read(StringStream(data))
tex = Texture()
tex.load(p)
Then I attach that texture to my geometry and send the node back to the main render thread to attach to the scene graph (simultaneous to removing other lower level detail stuff.) The worker thread seems fine and doesn’t seem to hit the render thread update rate at all.
However, when I attach the new node to the main render graph, I get a stutter. My theory is that this is due to making the mipmaps. When I turn off mipmaps the stutter length drops significantly (but still can drop a frame or two).
I saw advice to make/load an egg file and the egg file loader knows how to keep the model/texture loading transparent to the render thread, but I’m creating some of my geometry on the fly. I saw somewhere else that it’s possible to create a memory-only egg file and attach it?
So my question is: Are egg file formats still the way to go? Will this address my issue, or am I just stuck with stuttering when paging textures over to the video card? If I can do egg files, I want to do these in memory only. I have found some low level egg file api documentation, but for the life of me, I haven’t found the higher level explanation of how to build the egg file in memory.
My needs are super simple. I have a pile of triangles (not even strips or fans), I have the texture, I have the texture coordinates and vertex normals. I just need some tutorial or example of how to make the egg file format in memory.
Or is there a way to make the mipmaps and page in the texture in my loader thread so all that work is already done and the render thread doesn’t have to take the performance hit?
Sorry if this is all dumb questions and explained somewhere already … I have been searching but not finding much. Thanks in advance for any thoughts, hints, or pointers to “for dummies level” documentation.