Lags appearing once at game startup

plugin ??? didnt know, it is usualy insatlled with netbeans
I’ll check this out
[edit : not much to see, seems like the z sorting and actual render loop takes the most time, no surprise here]

I added preloadings but still the same
some objects once they enter the frustum for the first time just freeze the game… whatever, I’ll leave it like this…

If you don’t post code we can just use our crystal ball,the code may be under copyright but man,we’re here to help you and you should be more trusty.

Just check if you have too much shaders/filters and take a look at stats (http://wiki.jmonkeyengine.org/doku.php/jme3:advanced:statsview?s[]=performance).
You’re probably using a filter that generates data on mesh when it get “shaded” the first time.

Not sure how many other ways to explain it, frankly.

tried that too, I removed my glow filter(the only one i used), but still the same

I aksed you how do you setup mipmaps with jme

Do you have your textures in dds format? this one is GPU friendly since it contains mipmap data (if you need it). you can try converting them first and then test if it solves your issue.

ok, I’ll try that

well I see now a big improvement, no more lag

although I dont understand how bigger texture files give such a result, mipmaps are intended for texture filtering (from what I read)

and the size on disk, 5mb instead of 700k (some texture files are up to 20mb)

thanks for the help everybody

1 Like

Well the thing is, that it’s quite faster to simply copy 20MiB (it’s actually less then that) to the GPU Memory than having an algorithm create them.

MipMaps are (as far as I remember) to have different texture Qualities depending on the distance you view the object from.

Now see dds as a rar/zip/tar/…/Archive. It contains 10 different Images. Your texture in every needed size.

The GPU now loads the according one.
What happend is that it generated them once each game start.

DDS is a format for actual texture files, while the common ones we know (png, jpg, etc) are image files. A texture file contains data for mipmaps, cube maps, volume textures, etc, and also support color formats that can be optimal cor the GPU.

This means that when a dds file is loaded, the data is copied directly into the GPU without any extra step. While for a png image for example, the image data needs to be decompressed and converted to what the GPU can understand as a texture. These extra steps can delay the start of a game, specially if you have large files or too many of them, all that adds up.

The trade-off is that of course the file size is larger in dds, and in many small projects a switch to dds file won’t make a noticeable difference.

yes but it needs to load them all since the game can show them at close range or far away

but dds supports compression too (I use DXT5 so far)

yes the fact that it holds normal maps/cube maps and other stuffs is really cool

BTW: http://javadoc.jmonkeyengine.org/com/jme3/renderer/RenderManager.html#preloadScene(com.jme3.scene.Spatial)

yep that’s what I use, and also using DDS files seem to have improved the situation

only once in a while the game freezes, but not at each run at least