public IMaterialSettings Import(int surfaceIdx, MaterialBag bag)
    {
        string uvSet = bag.ExtractUvSetName(figure);

        var textureImporter = TextureImporter.Make(textureProcessor, figure, uvSet, surfaceIdx);

        var diffuseTexture = textureImporter.ImportColorTexture(bag.ExtractColorTexture("diffuse"));

        FloatTexture opacityTexture;

        if (bag.HasExtraType(MaterialBag.DazBrickType) || bag.HasExtraType(MaterialBag.IrayUberType))
        {
            var rawOpacityTexture = bag.ExtractFloatTexture("extra/studio_material_channels/channels/Cutout Opacity");
            opacityTexture = textureImporter.ImportFloatTexture(rawOpacityTexture);
            faceTransparencyProcessor.ProcessSurface(surfaceIdx, uvSet, rawOpacityTexture);
        }
        else
        {
            opacityTexture = new FloatTexture {
                value = 1,
                image = null
            };
        }

        return(new HairMaterialSettings {
            uvSet = uvSet,
            diffuseAlbedo = diffuseTexture,
            opacity = opacityTexture
        });
    }
Example #2
0
    public FloatTexture ImportFloatTexture(RawFloatTexture rawTexture)
    {
        FloatTexture texture = new FloatTexture {
            image = ExtractImage(rawTexture.image, TextureProcessingType.SingleChannel),
            value = rawTexture.value
        };

        return(texture);
    }
Example #3
0
 public ParticlesPass(Material materialToUse, Mesh[] meshArray)
 {
     material = materialToUse;
     _texture = new FloatTexture(meshArray);
     _texture.PrintEmpty();
     buffer     = new FrameBuffer(_texture);
     resolution = _texture.resolution;
     dimension  = _texture.dimension;
     Update();
 }
Example #4
0
    public FloatTexture ImportBumpTexture(RawFloatTexture rawTexture)
    {
        FloatTexture texture = new FloatTexture()
        {
            image = ExtractImage(rawTexture.image, TextureProcessingType.Bump),
            value = rawTexture.value
        };

        return(texture);
    }
    public FloatTexture ImportNormalTexture(RawFloatTexture rawTexture)
    {
        FloatTexture texture = new FloatTexture()
        {
            image = ExtractImage(rawTexture.image, TextureProcessingType.Normal),
            value = rawTexture.value
        };

        if (texture.value != 1)
        {
            Console.WriteLine("warning: normal map with non-unity multiplier");
            texture.value = 1;
        }
        return(texture);
    }
Example #6
0
 public FrameBuffer(FloatTexture floatTexture)
 {
     currentTexture = 0;
     textures       = new RenderTexture[2];
     width          = floatTexture.resolution;
     height         = floatTexture.resolution;
     for (int i = 0; i < textures.Length; ++i)
     {
         if (textures[i])
         {
             textures[i].Release();
         }
         textures[i] = new RenderTexture(width, height, 24, RenderTextureFormat.ARGBFloat, RenderTextureReadWrite.Linear);
         textures[i].Create();
         textures[i].filterMode = FilterMode.Point;
         textures[i].wrapMode   = TextureWrapMode.Clamp;
     }
     Print(floatTexture.texture);
     dimension = new Vector2(width, height);
 }
Example #7
0
 public void Print(Texture2D tex)
 {
     _texture = new FloatTexture(tex.GetPixels());
     buffer.Print(_texture.texture);
 }
 private static void SetBumpTexture(TextureLoader textureLoader, FloatTexture colorTexture, out float value, out ShaderResourceView textureView)
 {
     value       = colorTexture.value;
     textureView = textureLoader.Load(colorTexture.image, TextureLoader.DefaultMode.Bump);
 }