Jump to content

Change the Environment Texture in runtime.


Recommended Posts

Posted (edited)
The function to change the Texture of the Environment at runtime is being implemented.

 The file format is HDR extension. 

If it is loaded from the existing Editor, it can be changed by setting
the corresponding path,
but setting the path of the HDR file in an arbitrary folder outside the DATA folder
does not produce the desired result.

  Unigine::RenderEnvironmentPresetPtr preset = Unigine::Render::getEnvironmentPreset(0);
    preset->setTextureName("C:/Users/Michael/Documents/UNIGINE Projects/AddOn_Sample/data/christmas_photo_studio_07.hdr");

Various methods were tried, such as saving using the Unigine file system and Image, but failed.
It would be very helpful if you give a hint on which part to look at.
Thank you.


Edited by KOVIAHN
Link to comment


Sad to say but currently those feature does not available - that means in runtime you couldn't change environment texture which is located out of data folder

This is well know feature request and it is already in our internal task board, so we hope to add it in one of the next releases



Link to comment
  • 3 months later...

Not sure it can be "similar" to the same that we're discussing right there, but to me it will be also extremely important to have the ability to import streaming to texture.
In other engine there are some plug-in able to take streaming url, video and stuff like that, and render it to texture.
So basically you can put live content inside the game, that is something that I really looking for.

Link to comment


Starting with 2.15 SDK you should be able to set the DX11 / GL Texture directly to the environment (right now it's possible only to set from the file). In theory you should be able to write a custom code that will stream your video to the texture on GPU and read it back and convert to cubemap from inside the Engine.

You can convert equirectangular image to cubemap quite easily in realtime: https://learnopengl.com/PBR/IBL/Diffuse-irradiance.


How to submit a good bug report
FTP server for test scenes and user uploads:

Link to comment
  • Create New...