Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Allegorithmic B2M

Discussion in 'Formats & External Tools' started by SteveJ, Feb 13, 2012.

  1. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    I'm getting some funny results with this tool and was hoping someone else might have some advice.

    1) Firstly a question - is there any reason why I shouldn't replace EVERY material in my scene with an instance of B2M in order to generate normal maps and give everything a uniform appearance? Is this NOT what the tool is intended for?

    2) The reason I ask that: I have done this, and there seems to be major problems now when attempting to build my project. Especially for iOS, but also sometimes for Standalone. I get crashes etc.

    3) Also, in the editor when I run my game, there's a good second or two where everything is just BLUE, and then the generated textures start appearing one by one. As I walk around in the game, this happens each time I "look at" a texture that I haven't "seen" before.

    4) When moving back and forth between scenes, coming out of Play mode, there's often a very lengthy reimport of all of the B2M instances.

    All in all, there seems to be a lot of negatives piling up and I'm starting to doubt my decision to put B2M into the project. Would hate to stop using it and throw that money away, so I'm hoping I'm just using the tool incorrectly?

    If anyone has experience in using B2M successfully, I'd love to hear your thoughts/advice.

    Thanks!
     
  2. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    1) I know Martin Schultz did replace all his textures by B2M materials in one of his racing games with success, so yes, you should be able to do the same (taking into account the memory overhead of having normal maps and specular generated on top of your simple diffuse maps)

    2) B2M, as every other substance, behaves badly on the Developer Preview build, it might be one of the reason. Also, the baking on iOs is broken in that build and even if you are using the 3.4 version the baked bitmaps are uncompressed and can fill your iOs device memory pretty easily, this is being fixed for the 3.5 release.

    3) That should not happen as the B2M outputs are already generated in the editor. The blue texture is a placeholder while the textures generate but since B2M is poretty quick to render compared to other substances it should definitely not give you these blue surfaces.
    How many B2M do you use in the scene and at which resolution did you set them ?

    4) The reimport is long, I agree, but the Editor asks for it as the B2M parameters might have changed during play time. I'll check with our devs to see how this can be addressed.
     
  3. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    I remember reading about Martin. I thought that was the case - that he'd used B2M to replace everything - but wasn't sure.

    I am using the 3.5 preview now. I was using 3.4 previously, but I was also using 1024x1024 textures at that time and suspect I was mostly having memory problems when building to iOS.

    Maybe this is a 3.5 preview thing too? It happens every time, so it's definitely a "behaviour". I'm currently using 512x512 textures. There's approx. 20 in the scene all up. It's a dungeon type scene, so there's a few wall sections, pillars, floor tiles, roof tiles, etc.

    Would be good - I think this has actually been raised previously. I remember commenting on it in another thread, so I think quite a few people have experienced this "issue".



    All in all, I think I'll remove B2M just until the final 3.5 comes out and then see if I can get it up and running properly. Thanks for the quick response :)
     
  4. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    20 x 512 materials should generate very quickly, so I guess there is something wrong with the build. 3.5 is pretty close now so hopefully you will be able to use B2M again very soon :)
     
  5. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    Yep - I just tried adding a single plane into a blank project and setting its material to the output from B2M. Even that - on Play - will show a blue texture for a good second or so before "loading" the actual image.

    Am I using B2M correctly? For each material that I need to generate, I create a duplicate of the B2M object in my heirarchy. I assign the input texture, and then assign the B2M outputs to the Material that is assigned to this particular part of the model (e.g. a pillar).

    So all up, if there are 20 objects (pillars, doors, walls, floortiles, rooftiles, etc), I end up with:

    20 x Texture (the flat base image that I assign while modelling the level)
    20 x Material (auto-generated by Unity when I import the level model)
    20 x B2M objects (I create one per texture)

    Essentially I'm taking the standard Diffuse Material that has the original Texture assigned, changing it to a Bumped Diffuse (or Mobile Bumped Diffuse), creating an instance of the B2M object and assigning the Texture to it, then dragging the outputs (by expanding the B2M object to reveal them) to the inputs on the material.

    Hope that makes sense :)
     
  6. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    Yep, that's the way it should be used. You could use the auto generated material directly but it should not impact performances at all either way.