Build missing shaderUniform textures from dynamic paths

  • #1, by propapandaMonday, 01. April 2019, 17:56 5 years ago
    I've been playing around with shaders and have normal mapping working pretty well -- at least as long as I'm running within the VS Editor. However, when I create a build and test there, it seems to not include the necessary textures.

    The problem seems to be that the build process only includes hard-coded texture paths, e.g. this works fine when I run my build:
     graphics.shaderUniform(shader, "_t_normal", "vispath:frame01_n.png")
    However, when I construct the path to the texture dynamically at run-time, the texture is not included in the build and hence my effect falls apart. Even something as simple as this makes it not include the texture in the build: 
     graphics.shaderUniform(shader, "_t_normal", "vispath:frame01_n" .. ".png")
    Looking into the generated report.txt I can confirm that my texture is indeed not included in the build here.

    I've tried including the texture in an unused animation on my character, in which case it does appear to be included in the build according to report.txt, but I can't seem to access it at the expected path to pass it to my shader.

    Is there any way I can force the build process to include specific textures? Preferably via Lua so that I can just include a big directory tree of images?

    This is with VS 5.0.9 on Mac OS 10.13.6.

    Thanks!

    Newbie

    6 Posts


  • #2, by afrlmeMonday, 01. April 2019, 20:44 5 years ago
    I think you can force it to include files with loadfile().

    loadfile("vispath:example_dir/file.x")

    Imperator

    7278 Posts

  • #3, by propapandaMonday, 01. April 2019, 21:39 5 years ago
    Thanks for the quick reply.

    Unfortunately I'm not sure it's a solution: It's the same as with my initial approach, i.e. the texture in question is included in the build as long as the path to the file is hard-coded. Once I replace it with a dynamically changing variable, the texture is no longer stored in the build as far as I can tell.

    It might be possible to work around the issue by creating a huge list of all the extra textures I want to include in the build, but that does seem rather clumsy. Was hoping I could perhaps just point Visionaire at a path and it would include anything contained.

    Newbie

    6 Posts

  • #4, by sebastianMonday, 01. April 2019, 22:08 5 years ago
    this works for me:
      local nmap = "normalmaps/"..graphics.getCurrentSpritePath(object)
    graphics.shaderUniform(lightingShader, "_t_normal", nmap )

    so if you save the dynamic constructed path in a value and put it in the uniform function, it should work

    Thread Captain

    2346 Posts

  • #5, by afrlmeMonday, 01. April 2019, 22:08 5 years ago
    ah, yeah. vispath requires strict pathing otherwise the engine does not know what to include. you could create a Lua table full of different files though - that's something I did ages back for sounds I wanted to play with the openAL sound engine that we could access via Lua script.

    Imperator

    7278 Posts