[solved] Graphics slowdown when changing a uniform variable

I recently switched to using the new rc2 sdk and notice some changes in the behavior of the game I am working on. I am using a slightly modified version of the base lighting material and have only added one more uniform which for now just changes the color. This worked fine before I switched to the rc2, however, now that I’ve upgraded it looks like every time I modify this uniform float variable it causes jmonkey to load more shaders into memory. Once this maxes out (at around 400 or so on both my osx and windows boxes) the game speed returns to normal.

Did something change in the engine for rc2 in how shaders and materials are handled? I’ve been trying to trace through the source code and figure out whats changed but I haven’t been able to tell so far. Thanks for any help you guys can give!

Can you provide more information? Like the j3md file or something?

For example, is the new color uniform also linked to a define?

1 Like

Are you setting it to a new color object? try modify the existing one instead

1 Like

Oh man, now I feel stupid. I accidentally added the float uniform I was using to the defines list when I was updating to the latest lighting shader code. That makes sense that, that would cause jmonkey to create a new shader and cause the slowdown.

Thanks for the help!