Graphics

 View Only
  • 1.  XPression: copy material texture to a mask material texture

    Posted 11-03-2022 17:14
      |   view attached
    Hello all, I have a scene with two materials that use the same PNG image file as a texture. 1. PICTURE material. 2. MASK material (set to Alpha Mask Inverted).  I would like to change the image file on the picture material texture and have the MASK texture change as well.  I tried this with Visual Logic (attached), to copy the face, but it copied the pictures settings as well; where I ended up with 2 pictures on my scene; and no mask.  Can this not be done with visual logic?  Only with scripting?

    ------------------------------
    Steve Szeszycki
    XPresssion Operator
    Los Angeles United States
    ------------------------------


  • 2.  RE: XPression: copy material texture to a mask material texture

    MalThePal
    Posted 11-04-2022 12:10
    How many different image files/mask files will you be using? Will you know the names of the image files before they are used? To my mind, it would be more of a logic/input selector job. You would have to use 2 input selectors, one for the image, one for the mask. That's about all I can come up with for now.

    ------------------------------
    Malcolm Thorpe
    Free Lance Xpression Designer/Carbonite TD
    ------------------------------



  • 3.  RE: XPression: copy material texture to a mask material texture

    Posted 11-04-2022 21:15
    Thanks Mal; it would be a case-by-case basis.  I would not know the files names before actually getting the file.  Looking back at my VL example I posted, I now know why that didn't work.  I'm pretty sure what I want to achieve can be done with a script; I just don't know the right syntax.

    ------------------------------
    Steve Szeszycki
    XPresssion Operator
    Los Angeles United States
    ------------------------------



  • 4.  RE: XPression: copy material texture to a mask material texture

    Ross Staff
    Posted 11-06-2022 10:57
    Hey Steve, 

    This script will copy the material from the first object and make a mask for you on the second. 

    dim PlayerImg, PlayerMask as xpBaseObject

    dim PlayerImgMat, PlayerMaskMat as xpMaterial

    dim PlayerImgSha, PlayerMaskSha as xpBaseShader

    dim FilePath as String

     

    'get file from image-----------------------------

     

    Self.GetObjectByName("Player_Img_RGB", PlayerImg)

    PlayerImg.GetMaterial(0, PlayerImgMat)

    PlayerImgMat.GetShader(0, PlayerImgSha)

    FilePath = PlayerImgSha.FileName

     

    'set file to mask--------------------------------

     

    Self.GetObjectByName("Player_Mask_1", PlayerMask)

    PlayerMask.GetMaterial(0, PlayerMaskMat)

    PlayerMaskMat.GetShader(0, PlayerMaskSha)

    PlayerMaskSha.SetFileName(FilePath)



    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 5.  RE: XPression: copy material texture to a mask material texture

    Posted 29 days ago
    Thanks Red, that worked perfectly.

    ------------------------------
    Steve Szeszycki
    XPresssion Operator
    Los Angeles United States
    ------------------------------



  • 6.  RE: XPression: copy material texture to a mask material texture

    MalThePal
    Posted 28 days ago
    Wow, powerful scripting. Do you mind if I add it to my tool box of scripts?

    ------------------------------
    Malcolm Thorpe
    Free Lance Xpression Designer/Carbonite TD
    ------------------------------



  • 7.  RE: XPression: copy material texture to a mask material texture

    Ross Staff
    Posted 27 days ago
    Pleased it worked Steve and of course Mal, have at it :)

    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------