OBJ - allow MTL file to be set outside of the obj and change it on the fly

  • In the aggstein demo, the obj files in the tour are loading multiple textures to visualize the model, so using texurl is not possible.
    In the tour, we showcase different renderings of the model with different textures (daylight, sunset and original).
    The models used in the scenes are basically the same models, but with different MTL files for the material. However, currently we have no option set the MTL file outside of the .obj and since we cannot switch the material, we have to swtich the whole scene and specify a new .obj. This results in a new download of the (rather big) .obj file. It would be nice if we could simply change the MTL file with a new one and krpano loads the MTL and applies the textures to the current model. Would also be nice if we can get an event when all textures are ready to be shown and/or have been switched.

    Possible solutions:
    - allow texurl to have the MTL. Then we could a) use scripting to change the texurl and update the scene or b) change a scene with the same .obj but a custom MTL (and hopefully the browser caches the obj and only downloads the MTL/texturs)
    - a new attribute mtlurl ?
    - ... ?

    As a bonus: when this is implemented, we could also have the use case of a "shoe" with multiple textures. When different areas of the shoe need to be replaced, we load different MTL files and only the textures that are new are replaced (eg, model with 3 textures and MTL 1 holds TEXTUREA1/TEXTUREB1/TEXTUREC1 and MTL2 holds TEXTUREA1/TEXTUREB1/TEXTUREC2). In this case, when changing MTL, only TEXTUREC2 is downloaded and applied to the model (replacing TEXTUREC1), while the other textures remain the same.

  • Hi,

    yes, good idea!
    Is added as feature request!

    Possible solutions:
    - allow texurl to have the MTL. Then we could a) use scripting to change the texurl and update the scene or b) change a scene with the same .obj but a custom MTL (and hopefully the browser caches the obj and only downloads the MTL/texturs)


    A new scene with a different texurl might be the better solution here (or a loadpanoimage call with a modified texurl) - this way it would be possible to use blending and the load-state is automatically available.

    And caching existing models and textures of course! *wink*

    Best regards,
    Klaus

  • Quote

    If the obj file is cached, then it will be possible to use it in all panoramas as a depth map so that it would not be reloaded when moving through scenes?

    The 3d-models (in all formats, obj, stl, depth) are already cached and reused. That means you use use the same .obj for multiple scenes, then there is no additional loading or processing. That works also when using the obj once with textures and once with a depthmapped-pano-image.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!