We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Replace all textures on runtime

Home Forums Programming Replace all textures on runtime

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #29829
    Avatarweb
    Licensee

    Hello guys,
    I’m working on some logic of replacing all scene textures on runtime.

    I found a code snippet here in the forum, which I tried to modify to fit my needs, but the textures are not getting updated. Maybe someone can give a hint?

    This is the current code:

    #29871
    Avatarweb
    Licensee

    Okay, I think I know whats the issue.

    The “material.map” doesnt apply to “MeshNodeMaterial”. In the api its mentioned that its better to use the “replace Texture” puzzle for this material types.

    I wonder if it is possible to execute the puzzles from the “main” js file, instead of the “visual_logic.js” without wrapping it in a external function?

    #29910

    Hi,

    Yep, setting material.map is not applicable for MeshNodeMaterials.

    You can add custom logic to the main js file of your application. Simply put it inside the runCode() function.

    Co-founder and CTO at Soft8Soft
    FB | Twitter | VK

    #29948
    Avatarweb
    Licensee

    Okay, thanks for clearing that up.

    To maybe clarify my question regarding the “executing puzzles”.
    At the moment I’m using a mix of using puzzles and self written logic by looking in the api of verge.

    In the first bigger application I used mainly the “visual_logic.js” for all verge related stuff. Therefor I added the needed puzzles via the puzzle editor to my project so that they are written into the “visual_logic.js”. I then added manualy external function I could directly use in the “main js file”.

    But instead of that I would like to just have the “visual_logic.js” untouched so that I can easily update. And would like to just execute the puzzles in the “main js”.

    For example like this:
    v3d.puzzles.tweenCamera('Cam_01', 'Cam_01.Target', 2, function () {});

    #29959

    Do you mean using some internal Puzzles logic inside your custom JavaScript? Unfortunately, this is not possible. If you still need to do so, the best way is to copy blocks of code from visual_logic.js to your main script.

    Co-founder and CTO at Soft8Soft
    FB | Twitter | VK

    #29966
    Avatarweb
    Licensee

    Yeah exactly. Hmm, okay. Is it possible to change this behaviour in future updates? Or does it simple not work programmaticaly this way?

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.