Search Unity

Substance answers !

Discussion in 'General Discussion' started by Jerc, Apr 20, 2011.

Thread Status:
Not open for further replies.
  1. RyuMaster

    RyuMaster

    Joined:
    Sep 13, 2010
    Posts:
    468
    One more question: with all those new additions, do we have some better way of casting substance texture to texture2D without using render-to-texture, which takes additional memory?
     
  2. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    Yes, you can now use GetPixels32 to read the pixels from a substance output and store them in a Texture2D using SetPixels. Note that your substance will have to be set to RAW format for this to work.
     
  3. Crazy Robot

    Crazy Robot

    Joined:
    Apr 18, 2009
    Posts:
    921
    Ok, I just bought B2M and I like it so far but I have a few questions I can't find in the docs.

    All questions are with mobile in mind.

    1) What are the options under "Load Behavior" do? What is the best setting for mobile?

    2) So I assume I create a bunch of "Bitmap2Material_2_RealTimeMobile" material to replace all of my material in the game?

    3) When you said the textures get created at first run time then are stored on the device, is that at start up or when a level loads? Does question 1 above have anything to do with that behavior?

    4) I see that when I drag my original texture into the "Bitmap Diffuse" slot the B2M material it, B2M creates a diffuse texture, is that the one that Unity includes in the game build or are both my original diffuse texture and the B2M one saved during the build? I know it doesn't make any sense to have both, but I just what to make sure.

    5) My original texture is 2048 and uses 2.7MB,but the diffuse texture B2M creates is 4 MB??? Why, doesn't that add to my build size?


    Thanks so much,
     
    Last edited: Mar 19, 2013
  4. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    1) Build on Level Load will regenerate the substance every time a level needs it.
    Bake and Keep will bake the substance as a bitmap for fast loading but will keep the substance source in case you want to animate it ingame.
    Bake and Discard simply bakes the substance as bitmaps when building the game.
    Use Caching will generate the substance only once during the first loading then save it as a bitmap on the device <- This is what you want to do on mobile.

    2) Yes

    3) Textures are generated at load time, not startup.

    4) Only your original asset is embedded in the build.

    5) It's probably due to the mipmap levels, the size should actually be the same as your original image unless the resolution of the substance differs from the resolution of the source texture. In any case it won't add up to the download, but to the memory used by the app.
     
  5. PatBGames

    PatBGames

    Joined:
    Mar 28, 2009
    Posts:
    120
    Thank you if you can take this in account.

    I've just installed the last Unity update (4.1.04f) and it changes nothing. And this bug seems to happen only on Electric_Liquid substance, I haven't see it on other substances from the "Substances_Free" pack.
     
  6. TriplePAF

    TriplePAF

    Joined:
    Aug 19, 2009
    Posts:
    246
    I started today with testing the new substance for mobile feature in Unity 4.1.2 and wanted to say that it seems to work a 1000% beter on mobile devices.

    Thanks for addressing those nasty and slow performance issues. :D

    Peter.
     
  7. TriplePAF

    TriplePAF

    Joined:
    Aug 19, 2009
    Posts:
    246
    Last edited: Apr 4, 2013
  8. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    We are in the process of updating the whole substance database with new optimizations, we will keep you updated.
     
  9. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    I'm having this same problem with Electric_Liquid, though I didn't change the tiling; I just changed the color and glow. I'm using Unity 4.1.2f1 and Windows 7 x64 in DX11 mode.

    I think it's something wrong with the ElectricLiquid substance itself... Unlike all the other ones in the free pack, it doesn't generate a full set of textures even if you check Generate All Outputs. It only creates one texture (name_Emissive) which doesn't correspond to any of Unity's built in shaders, and the default shader chosen in Bumped Specular (there's no bump map though). I'm guessing by the name that it's making a diffuse RGB texture with emissive data in the alpha channel, but Unity's Self-Illuminated Diffuse shader expects an RGBA diffuse where A is gloss and then a separate alpha texture where A is emissiveness.
     
    Last edited: Apr 18, 2013
  10. TriplePAF

    TriplePAF

    Joined:
    Aug 19, 2009
    Posts:
    246
    Almost all the space substance have the same problem as mentioned above. Upgrading them with Substance Designer 3.5 makes no difference.


    Peter.
     
  11. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    The sky substances and animated stuff like the Electric Liquid will work best using the Unlit Texture shader in Unity. It may not affect the output automatically to the Diffuse slot because of the "Emissive" tag but you can drag and drop it from the Project view to the right slot.
     
  12. Enoch

    Enoch

    Joined:
    Mar 19, 2013
    Posts:
    198
    A real quick question. Any chance of getting some substances that I can use in a transparent/cutout shader for leaves, grasses, general billboards and tree branches? You don't seem to have any substances that cover those textures. I have only found one and it was in the example project called "grass_billboard" which awesomely have properties for drought, snow amount and toon style. Please more substances that can be used as vegetation "cutouts" (properly generates alpha channels, etc).
     
  13. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    The problem is that even after you drag it there, when you press Play (or do certain other things like click a different substance instance) it causes it to refresh/rebuild, which removes the texture from the diffuse slot. So anything with that substance shows up with a missing texture in game.
     
  14. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    @makeshiftwings We have a fix on the way for this issue. The workaround for now is to not use the materials automatically created with the substance for those Emissive textures but rather create a new one and assign the substance output to a slot in this new material, this shouldn't reset everytime you hit play.
     
  15. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    Ah, ok, thanks Jerc! Also, I feel like I'm being rude when I type your name. Not intended! ;)
     
  16. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    734
    Hi Jerc,
    I have a question regards Water_flow field present in some substance materials(in my case "ground_001.sbsar").
    Is there a way to animate this field continuously (to simulate a perpetual flow)?
    I'm trying with script below ...but i'm not very happy with result...maybe the water flow range values (0-1) are not loopable or I'm using a wrong scripting approach.
    Regards
    Max

    Code (csharp):
    1. var floatRangeProperty : String = "Water_Flow";
    2. var cycleTime : float = 10;
    3. function Update () {
    4.     var substance : ProceduralMaterial = renderer.sharedMaterial as ProceduralMaterial;
    5.     if (substance) {
    6.                
    7.         var lerp = Mathf.Repeat(Time.time/cycleTime,1);
    8.        
    9.     substance.SetProceduralFloat (floatRangeProperty, lerp);
    10.         substance.RebuildTextures ();
    11.     }
    12. }
     
    Last edited: Apr 25, 2013
  17. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    I don't think the Flow ever loops; it's supposed to go forward forever, so you need to use a value that just keeps going up, like Time.time. This is what I'm using:

    Code (csharp):
    1.  
    2. public class AnimateLiquid : MonoBehaviour
    3. {
    4.     private ProceduralMaterial mat;
    5.    
    6.     void Awake()
    7.     {
    8.         mat = (ProceduralMaterial)renderer.sharedMaterial;
    9.     }
    10.  
    11.     void Update ()
    12.     {
    13.             mat.SetProceduralFloat("Flow", Time.time);
    14.             mat.RebuildTextures();
    15.     }
    16. }
     
  18. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    734
    Hi makeshiftwings,
    thanks for your reply but the chosen of loop function comes becouse the water_flow field is a float that can be >0 and <=1.
    Your script is near to my fist approach and works perfectly until the value incremented over time arrives to 1...after that the value stays to 1 and the flow goes to stop.
     
  19. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    Hmm weird, sorry then. I was using Electric Liquid and Sand from the free substance pack and they both supported arbitrary float values for Flow.
     
  20. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    734
    No problem!...I hope that Jerc (or anyone)could give me some help to best use this great effect in my bought substances.
     
  21. dvochin2

    dvochin2

    Joined:
    Jul 14, 2012
    Posts:
    84
    Hi all,

    The latest Unity (4.1.2f1) crashes when I import sbsar files. (Same as 4.1.0) These are Allegorithmic-generated samples like 'knits.sbsar' and 'fabric_012.sbsar'.

    Anyone else gets crashes during import??

    Any workaround?

    Thanks!
     
  22. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    sjm tech > Tell me exactly which substance only has a flow value ranging from 0 to 1, I'll send you fixed versions with a far larger range.

    dvochin > We didn't notice any crash, is it something that you can reproduce on specific substances ?
     
  23. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    734
    Hi, Jerc,


    (from Substance250 package)

    (water_flow)
    - ground_001.sbsar
    - ground_011.sbsar
    - ground_017.sbsar
    - bricks_026.sbsar
    - concrete_029.sbsar
    - rock_002.sbsar
    - stones_001.sbsar

    (flow)
    - fire.sbsar

    (rain_flow)
    - roofing_002.sbsar

    each one gives me 0-1 as range.
    Thanks
    Max
     
    Last edited: May 10, 2013
  24. dvochin2

    dvochin2

    Joined:
    Jul 14, 2012
    Posts:
    84
    Hi Jerc, thanks for taking the time. These are Allegorithmic-generated samples like 'knits.sbsar' and 'fabric_012.sbsar' crashing the latest Unity on my main machine (Unity usually works fine there, only problem is sbsar importing).

    No reports of sbsar files crashing latest Unity?

    Dan,
     
  25. TechnicalArtist

    TechnicalArtist

    Joined:
    Jul 9, 2012
    Posts:
    736
    Hi,

    After building a webplayer my build log show stat. as following:

    Textures 6.0 mb 13.8%
    Meshes 15.3 mb 35.3%
    Animations 286.1 kb 0.6%
    Sounds 7.6 mb 17.4%
    Shaders 993.6 kb 2.2%
    Other Assets 8.8 mb 20.3%
    Levels 3.2 mb 7.3%
    Scripts 752.6 kb 1.7%
    Included DLLs 123.5 kb 0.3%
    File headers 506.0 kb 1.1%
    Complete size 43.5 mb 100.0%


    Show i want to know what is the Other assets Unity count? If anybody knows then please tell me what is that Other Assets?

    when i delete substance material other asset size also reduce,substance count in other asset?

    Thanks.

    Dev
     
  26. Play_Edu

    Play_Edu

    Joined:
    Jun 10, 2012
    Posts:
    722
    Hi,

    Currently i'm working with unity 4.1.2 it's new update but when i import(Electric_Liquid and many more) unity get cress. but it's work fine with unity 4 how it's possible.i'm simple import this substance nothing else.............................
     
  27. Play_Edu

    Play_Edu

    Joined:
    Jun 10, 2012
    Posts:
    722
    Hi,
    my unity also crashes when I import sbsar files. But it's work fine with unity 4. I don't know why this happen .
     
  28. Marble

    Marble

    Joined:
    Aug 29, 2005
    Posts:
    1,268
    May I ask about Bitmap2Material...?

    My substances all need to be regenerated every time I open the Unity Editor; otherwise, when I enter play mode, many of the materials in my scene have the same substance material. Here is a shot of the B2M Inspector after I open Unity and a second shot of the same inspector after I've regenerated the materials (by just updating one of the parameters on it).

    The bug is not debilitating, but it is annoying. Is a fix in evidence?
     

    Attached Files:

    Last edited: May 20, 2013
  29. Bagless

    Bagless

    Joined:
    Jul 3, 2012
    Posts:
    4
    Any idea when this will be fixed? Really want be able to use the substance materials however can't get textures to stick for anything but diffuse and normal, everything else gets removed when the material updates :(.
     
  30. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    734
    Hi Jerc,
    are there any news about the fixed substances?
    Thanks
    Max
     
  31. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    The faulty substances should have been updated on the asset store. Please try downloading them again.

    About the B2M having to be regenerated and the issue with substance materials not keeping custom outputs such as Emissive and else, we fixed both issues on our side it should be shipped with the next Unity update.
     
  32. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    734
    Thanks Jerc..but my substances are part of B2M 2 upgrade bundle (250_Sbs_Designer). It's possible to obtain the update via allegorithmic user account?
     
  33. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    Let me check if we updated the substances in that package, but yes it would be through your user account.
     
  34. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    Is there any chance that B2M bug will be fixed in B2M 1.6 or is it only in 2.0?

    Also... I'm having a seemingly new issue with the substances in the Free Substances asset that I think is related to what Marble is seeing... the brick and wood panel substances need to be reimported manually each time I open my project, or they all end up as clones of one of their instances. (For example, I have four different instances of the brick substance with different values for HSV color, brick amount, etc., but when the project first opens all of them show up as the first instance until I right-click and reimport the substance.
     
    Last edited: May 28, 2013
  35. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    These issues with B2M and the rest are global Unity+Substance issues, as soon as the fix is released it will solve them whatever the substance or version of B2M you are using.
     
  36. nospam94

    nospam94

    Joined:
    Dec 4, 2012
    Posts:
    10
    Hi,

    for my project, i need to put substance material in assetbundles and load them when required. This work well with, mesh, simple material but how to do this with substance ? should i put substanceArchive in the assetbundle or only the proceduralMaterial ?

    for now, i put the substanceArchive on assetbundle and can load it. But how to set the result material to a gameobject ?
     
  37. nospam94

    nospam94

    Joined:
    Dec 4, 2012
    Posts:
    10
    ok, i can now load at runtime assetbundle with substance proceduralMaterial, If i save them as proceduralMaterial, not substanceArchive.



    So another question : proceduralMaterial are inside substanceArchive so i can have several ProceduralMaterial in a substanceArchive. I suppose these differents materials are variation of the same scripting material (they are defined by same "procedural script", only values are different; Is it OK ?

    If so i can access substanceArchive in editorMode... but if i want to put the archive in assetBundle and load it at runtime, is it possible with substanceArchive or should i save all the differents ProceduralMaterials in the assetBundle.
     
  38. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    You should only use ProceduralMaterials when scritping at runtime. I believe substanceArchive purpose if for asset importing and such in the editor and should not be used at runtime.

    You can have multiple ProceduralMaterials in a substance archive indeed and these could be either variations of the same material or completely different if you created a substance yourself in which you created several different materials.
    We recommend however to have no more than 5 variations in the same substance archive to avoid instability.
     
  39. Crazy Robot

    Crazy Robot

    Joined:
    Apr 18, 2009
    Posts:
    921
    Hello,

    I bought a bunch of substances on your website last year. How do I get updated versions of them as they are getting updated for mobile?
     
  40. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    I've been using substances in the designer quite a bit but i'm only now trying to make use of the nice substance DB in unity, i'm using the latest unity pro and i'm very confused about what i should do.
    1) I notice inside the substance there are materials provided, however those have the parameters (unlike materials i create myself if i assign the textures), which one should i use, my own materials or the provided one?
    2) How am i to use the same substance multiple time with diferent parameters? It would seem the changes are at the substance level and not the material level, if i want say the same bricks on 2 diferent walls but with different age, do i have to import the substance twice or can i use 2 materials? And if i can use 2 materials how do i do it since the provided one is "inside" the substance?
    3) I see different way to build the textures (on level load, on export etc), is there something that would say "on first load, once only"? So that i saveup the bandwidth by shiping just the texture, but as soon as someone launches the game it stays cached (not only at runtime, but also on disk as if it was using unity's build process). To be clear i'm looking at exporting max size textures, hundreds of them, so i'd like it to be done at install time (ideally if scriptable) or at worse, at first game launch "once" only for the application installation lifetime. If it's not supported can you suggest a workaround?
    Thanks! :)
     
  41. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    And while i'm at it 2 other questions
    1) Is there a way to change the "default" output texture size? It seems as soon as i import a substance it defaults to 512, it's no big deal if i import one, it's a pain if i import the substance DB want to change em all! I'd really like a way to set that default value in the unity GUI
    2) I can't seem to set the resolution to >2K, is there no support for this or is it an UI limitation? In either case i'd like support for 4K 8K at least, even if it means very slow (i assume 4X as slow for each doubling?) generation.
     
  42. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    1) The material you see when importing a substance is simply a default material set up so you don't have to, but you can use the substance outputs in any other material also if you don't want to use the default one.
    2) To duplicate substances, you can use the little + icon on top of the substance inspector where you see the 3d preview. This will create a new instance of that substance on which you can use different parameters. Or you can also import multiple times your substance also.

    3) Choose "Use caching" to generate the textures only once during the first loading and then cache them on the client.

    There is no way to change the default output size for now, sorry. Also, the CPU generation engine we use in Unity only goes up to 2048x2048.
     
  43. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    1) Is it a special material type or is it just displaying that way because it's embeded in the substance? (with the default material i can see the substance params on the material which is quite convenient, if i want to create my own material to place it elsewhere in my project hierarchy, is it possible to duplicate this functionality?)
    2) Sounds like just what i need
    3) Nice so there's a built in way! Does this behave the same on all platforms? Where is the cache stored, same place as the rest of the assets? How does this work in the unity "play" mode? Will it generate once on first play too or will it regenerate on each time i hit play while testing?

    It would be nice to add the default size but it's really nothing huge, just a minor pain but well worth it for the advantages substances bring. However it really is a shame that you're limited to 2K, is there any chance of this changing soon? I see it works just fine for higher resolutions in substance designer and 2K is very low for me, and if i use the designer to generate them i lose all the advantage of substance dynamism lightweight client transfer

    Another quick question on cache mode, how does this behave if i change the parameters of the substance at runtime? Will it cache each version to disk making it prohibitive to animate substances? Or only in change in memory if it was already generated? Will it invalidate the cache? Or is changing the texture not supported at all if using this mode? Would love more info on this.

    Really love the texture DB btw, insane value for what it brings
     
  44. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    Sorry for the questions spam but another quick once, since setting the default resolution through the UI is not possible, is it possible through scripting? If you have a quick sample that can allow me to set my default properties on all sbsar in the project that would rock (so that i could set 2K / 2K / cached on the whole substance DB and not need to worry about i do and do not use or missing one here there).
    Doing it by hand seemed reasonable, until i saw multi object editing wasn't supported hehe :)
     
  45. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    Also another update request, you should remove the "collections" from the substance database and place those 2 in texture instead:
    - Input
    - Grunge maps tookit
    All the other collections files are already available in the texture folder so they're getting downloaded twice and appear twice in unity when importing the database, aside from those 2 folders every single file in the collections is already in the texture folder.
     
  46. cjubb

    cjubb

    Joined:
    Dec 17, 2012
    Posts:
    7
    Can you expand your answer a bit where you say: You can also import multiple times your substance also.

    Do you mean just copying a pasting your .sbar file? Or is there another way to duplicate the substance instance at runtime?

    I can't use the + button because I don't know how many instances I am going to have.
    There seems to be a major limitation where you have one ProceduralMaterial and want to have it applied to different meshes with different parameters.


    Thanks for posting your answers :)
     
  47. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    Ronan

    1) It's a specific UI and you won't be able to see both substance and shader parameters if you are using an external material.

    3) It should behave the same on all platforms. It's not active while playing in the editor though. It still allows you to modify textures at runtime I think, I'm not sure about that one though, but if it does, dynamic changes will only occur in memory and won't override the cache.

    The size limit may change in the future but I can't commit on that unfortunately.

    You can probably write a script that changes the resolution of all the substance materials in your project. I did a similar script for other parameters so it should also work with the resolution. You may need to call a reimport of the substance after having changed the $outputsize parameter though.

    Thanks for the heads up on the database, I'll look into it.
     
  48. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    cjubb

    Yes, I do mean copy/paste.

    The other way to go is using this to instantiate a new substance from an existing one at runtime:

    ProceduralMaterial Instance = GameObject.renderer.material as ProceduralMaterial;

    Instance will be a copy of the initial substance material on which you can change parameters at runtime independently from the previous one.
     
  49. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    I think what would be a really really nice tradeof would be to be able in unity to do right click => new => procedural material and pass it a substance reference, that way we could have multiple materials (with diferent properties) targeting a single substance and still organise them as we wish in the hierarchy tree.

    Also what is blocking at the 2K limit, is it an actual technical limit or just due to an old version? I would've assumed the code would be the same one that runs in substance designer? 2K is not a deal breaker but i do see myself reimporting textures manually before export to get the 4K + ones from designer instead :(
     
  50. Bagless

    Bagless

    Joined:
    Jul 3, 2012
    Posts:
    4
    Just downloaded Unity 4.1.4 with the hope that the bug for textures resetting for custom shader slots being fixed. However I'm still getting the same issue. Am I missing something or has Unity not yet added the fix? My project depends on real time editing of substances with custom shaders so currently I'm stuck. Unless I'm missing something or doing something wrong? Noticed I get the following error message

    AssetImporter is referencing an asset from the previous import. This should not happen.
    UnityEditor.ProceduralMaterialInspector:OnDisable()

    Good to get your thoughts Jerc.
     
Thread Status:
Not open for further replies.