Jump to content

render_manager_load_shaders and render_manager_warm_shaders


photo

Recommended Posts

Hi Unigine,

 

I've made a simple scene out of few nodes from heaven world (4 buildings) and while moving camera away from those buildings - rendering freezes for a while. It happens only once after loading a world, and always at the same camera position.

 

With process monitor I can see it is loading some shaders from disk and this probably is a reason, but it happen even if I have:

<item name="render_manager_load_meshes" type="int">1</item>

<item name="render_manager_load_shaders" type="int">1</item>

<item name="render_manager_load_textures" type="int">1</item>

<item name="render_manager_warm_shaders" type="int">1</item>

in a config file.

It looks like materials used for lower LODs are still loaded only when they are needed - not at startup.

 

Is there a way to force engine to load all materials on startup?

 

And second, with only core materials and 'render_manager_load_shaders' enabled - engine startup takes few minutes, is there a way to make it faster?

Link to comment

And second, with only core materials and 'render_manager_load_shaders' enabled - engine startup takes few minutes, is there a way to make it faster?

 

Which render system are you using ? DirectX9/10/11 support compiled shader caching (have a look for a file shader_d3d9/10/11.cache) which should reduced startup times after initial boot with 'render_manager_load_shaders' enabled. OpenGL unfortunately has no support for shader caching.

Link to comment

Which render system are you using ? DirectX9/10/11 support compiled shader caching (have a look for a file shader_d3d9/10/11.cache) which should reduced startup times after initial boot with 'render_manager_load_shaders' enabled. OpenGL unfortunately has no support for shader caching.

 

I'm using dx11 and shader caching is working - when I enable 'load_shaders' the initial startup of sanctuary demo takes more than 10 minutes (!) and every next - about 3. It's still a long time, but even with this option enabled - unigine is loading some shaders in runtime. What I'm trying to achieve is a smooth rendering of cinematic with predefined camera path, but there always is a freeze at the same moment (only during first pass of path after startup).

Link to comment

What I'm trying to achieve is a smooth rendering of cinematic with predefined camera path, but there always is a freeze at the same moment (only during first pass of path after startup).

 

For sure interesting point for further UNIGINE examination, as render stalls due to shader compile, resource loading etc. is always a bad thing.

 

Just as a hint for your smooth cinematic rendering requirement: you can configure UNIGINE for fixed frame time delta rendering for video recording via engine.game.setIFps(). More details here and here

Link to comment

When render_manager_load_shaders is enabled engine just compiles each shader into the cache file. This options is useful only for shaders debug purpose only.

render_manager_warm_shaders preload all shaders from material libraries which are presented in the .world file. You will have a shaders compile stall if you have some node references with unique materials which are not presented in the .world materials.

Link to comment

Thanks for replies,

 

Just as a hint for your smooth cinematic rendering requirement: you can configure UNIGINE for fixed frame time delta rendering for video recording via engine.game.setIFps(). More details here and here

It's a good hint, but I'm afraid we need to render 'cinematics' in realtime, so even with fixed framerate this problem will still occur.

 

When render_manager_load_shaders is enabled engine just compiles each shader into the cache file. This options is useful only for shaders debug purpose only.

Ok, so all I need is render_manager_warm_shaders and startup time is not a problem anymore (with render_manager_load_shaders enabled).

 

render_manager_warm_shaders preload all shaders from material libraries which are presented in the .world file. You will have a shaders compile stall if you have some node references with unique materials which are not presented in the .world materials.

I do not have any node references with unique materials. I've made some tests and even in heaven demo most of materials are 'warmed' on world load, but then some are loaded during first few seconds of animation (ruins_border_tesselation, dragon_body_tessellation_reflection, building_tessellation_wall_corner and many other) and some are loaded after changing camera path (airship_steam_boiler_tesselation). You can break at Material::create_shader(MaterialShader *shader) or in D3D11Shader::loadVertex(const char *name,const char *defines) or add some logging to see when materials are being loaded. Is this possible that not all materials used in scene are loaded with render_manager_warm_shaders?

Link to comment
×
×
  • Create New...