Author Topic: Procedural texture to Texture 2d turns out with a black image!  (Read 2551 times)

I am crushed.
I have tried converting a ProceduralTexture to a Texture2D countless times yet none of them worked. They all give the same result. A black texture. I believe the issue lies in the ProceduralMaterial not being readable event though I set it to be readable. My substance format is set to RAW.

The current code:

Code: [Select]
        substance = renderer.material as ProceduralMaterial;
       
        substance.isReadable = true;
        substanceTexture = substance.GetGeneratedTexture(substance.GetGeneratedTextures()[0].name);
        substanceTexture2D = new Texture2D(substanceTexture.width, substanceTexture.height, TextureFormat.ARGB32, false);
        substance.SetProceduralTexture("Hexagon_Heights", hexTexture);

        substance.RebuildTexturesImmediately();

        substanceTexture2D.SetPixels32(substanceTexture.GetPixels32(0, 0, substanceTexture.width, substanceTexture.height));
        substanceTexture2D.Apply();


Could someone help me out with this?
I don't see why Substance material doesn't have a Texture2D build into it... 

This should work. What version of Unity are you using?

Hi,
Is there a texture as input in your substance ?
if yes, did you check "read/write enabled" ?

The problem is solved, I responded to the other thread.