Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - dgoyette

Pages: 1 2 3 [4] 5 6
46
I'm trying to create a texture I'll use as a cracked glass decal in my game. I'm trying to create the effect of an object having hit the glass, creating a spider-web fracture.

(https://www.google.com/search?q=cracked+glass+decal&rlz=1C1CHBF_enUS760US760&source=lnms&tbm=isch&sa=X&ved=0ahUKEwikyYDJ79ffAhUF16wKHR8OCNcQ_AUIDigB&biw=1920&bih=979))

Does anyone know of any guides or tutorials that might walk me through something like this? I've tried playing around with some noise patterns, but I don't see how to get lines to come out of a center point, with occasional other perpendicular lines connecting those lines, or how to increase the line density towards the center where it's more cracked.

Thanks.

47
Substance Integrations - Unity - Re: Unity 2018.3 Information
 on: December 14, 2018, 03:56:25 pm 
Thanks for the heads up dgoyette.
Option two sounds like it could work.

I wasn't very clear about it but I was actually talking about the new Scriptable Render Pipeline which would require the textures to be packed in a certain way:
https://github.com/Unity-Technologies/ScriptableRenderPipeline/wiki/Upgrading-to-HDRP#converting-materials-manually

Yeah, that built-in support for MaskMap would be convenient, but it's easy to add to your substance. The steps Wes pointed out are pretty simple. I created my own custom node, so I can reuse it in all my substances, to make it easier. It just does an RGBA merge of the different raw inputs (metal, AO, smoothness).

And just a note, the node I made also outputs those raw channels as well, because I don't know of a good way to get Substance Designer itself to actually use the MaskMap in the 3D output, so I just plug metal/ao/roughness into plain old outputs so that it looks correct in the 3D output.


48
Substance Integrations - Unity - Re: Unity 2018.3 Information
 on: December 14, 2018, 03:03:07 am 
My understanding is, that using substance materials adds some runtime overhead.

Therefore it would be very appreciated if you could add a way to export substance materials as regular Unity SRP materials with texture bitmaps.

I'd say you can already do that in two ways.
  • Just export from Substance Designer.
  • Within Unity, all those generated textures you see collapsed under the SBSAR, you can drag or copy those to a folder in Unity, and it'll make a copy of the texture as an asset. So, it's not exactly an "export" button, but pretty easy.

49
Substance Integrations - Unity - Re: Consistent updates?
 on: December 10, 2018, 12:14:09 am 
It seems that every couple of weeks I go through a crisis of confidence regarding whether I should be using Substance in Unity. My game it more than a year away from release, and I tell myself that will give Allegorithmic time to get the plugin working. But then I review the extremely slow pace of progress, and I question whether I just need to stop wasting cycles on this, and export textures out of Substance Designer, and forget about the Substance plugin entirely. I struggle to find new ways to express this concern.

Here's a quote from Wes on Unity's forums, dating back just about 11 months to the day: https://forum.unity.com/threads/an-update-on-substance-format-support-in-unity.509408/#post-3348995
Quote
...this will be a positive move for both Allegorithmic and Unity. Unity is a great partner and we are very excited about what we will be doing with the new 2018 substance support. The original integration has become old and we are now able to rework the entire plugin with our new framework as well as deploy timely updates to coincide with new Substance Engine features.

11 months later, we're still in beta, with weeks between updates, and a huge bug (the DynamicInvoke issue) that Allegorithmic does not see fit to release a hotfix for. (It will be fixed in 2.2, for which Wes can't offer an ETA.)

I've been really looking forward to Unity 2018.3, and issues like this make me wonder how many months it will be after 2018.3 is released before the plugin will support it. If they're this far behind supporting 2018.2's patch releases, 2018.3 feels like a distant target.

Wes has stated that Unity keeps changing things, making plugin development difficult. But is Allegorithmic actually doing something to confront this reality? Are sufficient resources being devoted to the Unity plugin development? Without sounding too much like a whining child, my overall feeling is that the burden of the plugin development has been shouldered by an intern or a single developer fresh out of school.

My overall feeling it that things are "not okay" right now with the state of the plugin. Allegorithmic should put sufficient resources on the project, to get it stable ASAP, or just give up. The current pace isn't working. No need to reply to this expressing how you're as frustrated as we are.


50
I think you need to kick off a re-render, using the following:

Code: [Select]

graph.QueueForRender();
Substance.Game.Substance.RenderSubstancesSync(); // Or Async if you prefer...

Does that work?

51
Thanks, Josh. By "Play in Editor" mode do you mean putting [ExecuteInEditMode] on my script? I did try that, but that didn't improve the behavior. (It still crashes.) However, on the bright side, it seems that if I'm actually in Play mode, I don't have any issues modifying the properties in code. So the takeaway is that we can't use the substance API in Edit mode, only in Play mode?

52
I've created a test project to demonstrate the issue. (https://www.dropbox.com/s/thekvofyc1uez6c/SubstanceCrasher2.zip?dl=0) Open CrashScene. Now find the SBSAR named "TestSubstance" in the Materials folder. Expand it and select "graph.TestSubstance". Change the Text and/or FontSize property, and hit Apply. Now in the scene, click on the cube, and find its "ChangeFontSizeAndText" component. Click on the Refresh button, and you should start seeing these errors in the log:

Quote
C++ Error in InsertNumericValuesIntoArray(), invalid Substance input identifier: 'FontSize'!
C++ Error in SetStringValue(), invalid Substance input identifier: 'Text'!

Now go back to the "graph.TestSubstance", and change FontSize or Text, and hit Apply again. Unity will crash. This whole process of modifying the graph, and clicking the "Refresh" button on my "ChangeFontSizeAndText" component, sometimes gives different results. Sometimes pressing the Refresh button will cause the crash. Sometimes changing a property on the Graph in the inspector will crash Unity before even hitting Apply. There seem to be a lot of things that can go wrong with this workflow.

Note: This is similar, but not identical, to the test project I provided for the other thread I have.


53
I've created a test project to demonstrate this behavior. (https://www.dropbox.com/s/qgfu5c78cfooqvz/SubstanceCrasher.zip?dl=0) It's a standard Unity 2018.2 project. Open "CrashScene", and you'll find a cube that has a script "ChangeFontSizeAndText". Pressing "J" runs the following code. The important detail is the last line, where I'm trying to get the generated textures, but every time I run that line it returns 0 textures.

Code: [Select]
    public void ChangeSubstance()
    {
        Debug.Log("Changing Substance");

        Graph.ResetGeneratedTextures();
        Graph.RefreshCurrentTarget();

        Graph.SetInputFloat("FontSize", UnityEngine.Random.Range(0.2f, 0.4f));
        Graph.SetInputString("Text", UnityEngine.Random.Range(0, 100).ToString());

        Graph.QueueForRender();
        Substance.Game.Substance.RenderSubstancesSync();

        Debug.Log($"Has {Graph.GetGeneratedTextures().Count} textures");
    }

54
Both, actually.

I'm using HDRP, which means I can't directly use the Material that the Substance Plugin generates at this time. So instead, I've created a separate HDRP material, and dragged the Substance's generated textures into the textures of the Material. So I'm not sure whether that alone counts as using the substance directly in the scene?

At the same time, I also have a script in my scene that has a reference to the substance graph, and it's against that reference that I'm executing methods like SetInputString and GetGeneratedTextures(). You can see a screenshot of my script usage, and I've just attached the script as well.

Every once in a while, I've see GetGeneratedTextures return my textures, but usually it returns an empty list. I haven't nailed down what causes it to occasionally return the textures, though. But you can also see from my other post (https://forum.allegorithmic.com/index.php/topic,26597.0.html) that calling these methods is resulting in lots of full Unity crashes, so diagnosing this in depth is fairly slow and painful.


55
If I "Expose" given property of a node, and that property already has a Label, that same Label will be used on the Input Parameter that gets generated. This is annoying, as I'm almost always having to copy/paste the ID into the Label for all the new parameters I create. Instead, the ID/Name that I enter for the new exposed Input Parameter should be used for the Parameter's Label.

For example, I drag a material "Glossy Paint" into my graph. It has a property "Paint Roughness" that I want to expose in my material. So I expose it, but this roughness is for my "border color", so I call the exposed parameter "Border Roughness". Now I go over to the list of Input Parameters for my substance, and the first thing I see is "Paint Roughness", not "Border Roughness". Expanding the parameter, I see that the Identifier for the input is named "Border Roughness", as I entered. But the Label is "Paint Roughness".

Again, instead of keeping the Label from the original property, it should be set to be the same as the ID. Or at least give a (defaultable) option on the Expose Parameter dialog to apply the ID to the Label as well.

56
What's the trick to getting GetGeneratedTextures() to work? Here's my code:

Code: [Select]
myGraph.QueueForRender();
Substance.Game.Substance.RenderSubstancesSync();

var textures = myGraph.GetGeneratedTextures();
Debug.Log($"{textures.Count} textures");

Despite the graph having outputs that I can see in the inspector, GetGeneratedTextures() always returns 0 items. Am I not using it correctly?

57
This occurred under Unity 2018.2.14 using Plugin 2.1.

The attached crash report shows it occurring at:

Substance.Engine.dll caused an Access Violation (0xc0000005)
  in module Substance.Engine.dll at 0033:558d24e8.

The line of code in my project it's apparently complaining about is:

DecalGraph.SetInputString("Text", Text);

This is being called in OnValidate in the Editor. However, the same crash occurs if I call this via a simple Inspector button after having previously just modified and Apply'd the SBSAR.

It doesn't seem to matter what input I set. This is the stack trace when I try to set a Float instead:

Quote
C++ Error in InsertNumericValuesIntoArray(), invalid Substance input identifier: 'Font_Size'!
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogError(Object)
Substance.Game.NativeCallbacks:csharpLogCallback(Int32, String)
System.Object:wrapper_native_00007FF8558D4F10(IntPtr, String, Single[], UInt32)
System.Reflection.MonoMethod:InternalInvoke(MonoMethod, Object, Object[], Exception&)
System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
System.Reflection.MethodBase:Invoke(Object, Object[])
System.Delegate:DynamicInvokeImpl(Object[])
System.MulticastDelegate:DynamicInvokeImpl(Object[])
System.Delegate:DynamicInvoke(Object[])
Substance.Game.NativeFunctionsShared:cppSetInput_Float(IntPtr, String, Single[], UInt32)
Substance.Game.NativeFunctions:cppSetInput_Float(IntPtr, String, Single[], UInt32)
Substance.Game.SubstanceGraph:SetInputFloat(String, Single)
GraviaSoftware.Gravia.Code.Controllers.Decals.StaticDecalTextController:RefreshTextures() (at Assets\Code\Controllers\Decals\StaticDecalTextController.cs:64)
GraviaSoftware.Gravia.Code.Editor.StaticDecalTextControllerEditor:OnInspectorGUI() (at Assets\Code\Editor\StaticDecalTextControllerEditor.cs:16)

Even though it claims it is complaining about a property "Font_Size", that property definitely exists in my Graph, and this method work properly as long as I haven't just Apply'd the graph in the inspector.

More on this. Here's some code I'm calling in a script to display the properties of the graph:

Code: [Select]
            var sb = new StringBuilder();
            foreach (var prop in myGraph.GetInputProperties())
            {
                sb.AppendLine($"Prop: {prop.name} - {prop.type}");
            }
            Debug.Log($"Properties: {sb.ToString()}");

If I open Unity fresh, and call this method via a button in the Inpsector, I get the full list of all properties of the graph. If I then edit the graph and press Apply, then call this again, I get an empty list.

So what's going on when pressing Apply that causes so many values to be missing? The only way I can "Fix" the graph is to enter Play mode and then exit. Then I can iterate over the list of graph properties again. Even then, some of the time, when doing that, I get this error in my console:

Quote
OutOfMemoryException: Out of memory
 at (wrapper managed-to-native) System.Object.__icall_wrapper_ves_icall_array_new_specific(intptr,int)
 at Substance.Game.NativeTypes.GetNativeInputs (Substance.Game.SubstanceGraph graph, System.Int32 pNumInputs) [0x00000] in <a7f324179b874bf6be743a4296b96d4e>:0
 at Substance.Game.SubstanceGraph.GetInputProperties () [0x0000c] in <a7f324179b874bf6be743a4296b96d4e>:0
 at GraviaSoftware.Gravia.Code.Controllers.Decals.StaticDecalTextController.RefreshTextures () [0x0000e] in C:\Users\Dan\Documents\GitHub\Gravia\Assets\Code\Controllers\Decals\StaticDecalTextController.cs:61
 at GraviaSoftware.Gravia.Code.Editor.StaticDecalTextControllerEditor.OnInspectorGUI () [0x0002d] in C:\Users\Dan\Documents\GitHub\Gravia\Assets\Code\Editor\StaticDecalTextControllerEditor.cs:16

58
Something I discovered is that it's possible to have multi-line text when setting the text via code. For example:
Code: [Select]
myGraph.SetInputString("Text", "Line 1\nLine 2");
So, this is sort of a workaround for those willing to use the API.

Oddly, the following results in an unknown character in the output: $"Line 1{Environment.NewLine}Line 2"

It seems Environment.NewLine isn't handled correctly by the plugin.


59
I'm bumping this post, as I was about to make the same post. Specifically:
  • Please let us enter multi-line text Unity
  • Allow for font-selection to be exposed.

The first seems possibly very simple to add into the plugin.

60
If you need to scale your model, then you should import it without checking the "Preserve strokes position on mesh" on the import dialog. This will cause hand-painted layers to scale with the model. If you keep that box checked on import, the paint won't scale, and you'll be left with a mess. If you need to scale the model, I'd recommend having that be the only change you make to the model during that import.

So, to walk through a hypothetical workflow:
  • You create your model in Blender, and export the FBX, which you import into Substance Painter.
  • You spend hours painting it, of hours setting up fills using masks, then you realize the scale of the object needs to be adjusted. You go back into blender and change the scale, apply the scale, then export the FBX again.
  • You go back to SP and reimport the FBX, making sure to uncheck "Preserve strokes position on mesh". You should find that all your strokes scale properly, and everything looks the way it should.

Note that this doesn't work as well if you don't scale all the axes equally. For me this works perfectly if I double x, y, and z scale (for example). But if I just double y, then things don't quite look right.

Pages: 1 2 3 [4] 5 6