Graphics

 View Only
  • 1.  Linking Object Materials?

    Posted 05-16-2017 17:14
    It would be great if there were a way in which I could publish the material of a single object, and via Visual Logic have other objects who share that material link to the published object so that they would all change at once, but there is no readily apparent way to set that up, unless I am missing something (and there is a decent chance I am).

    Any thoughts?


  • 2.  RE: Linking Object Materials?

    Posted 05-16-2017 18:30

    Materials only or also images? If you were working in just one scene, you could match the faces of one object to another in VL. So Quad 1.face=Quad 2.face. You could also use datalinq and filepaths for images.

    For materials, you have to use a script. This is one I use on one of my projects. Please forgive the length. But this shows you an option based on the user input controls from a color picker. So Picker 1 selects AMat1 and BMat1, while selecting 1 AND Inverted, switches the colors around.



    OnSetText




    dim Amat1, Amat2, Amat3 as xpMaterial
    dim Bmat1, Bmat2, Bmat3 as xpMaterial
    dim top, btm as xpBaseObject
    dim mode as xpBaseObject
    dim dots as xpBaseObject



    Engine.GetMaterialByname("A1", Amat1)
    Engine.GetMaterialByname("A2", Amat2)
    Engine.GetMaterialByname("A3", Amat3)


    Engine.GetMaterialByname("B1", Bmat1)
    Engine.GetMaterialByname("B2", Bmat2)
    Engine.GetMaterialByname("B3", Bmat3)



    scene.GetObjectByName("BTM COLOR-PRIM", top)
    scene.GetObjectByName("BTM COLOR-SEC", btm)
    scene.GetObjectByName("COLOR INVERT", mode)
    scene.GetObjectByName("DOTQUAD", dots)




    if text = "1" and mode.text = "NORM" then
    top.SetMaterial(0, Amat1)
    btm.SetMaterial(0, Bmat1)
    dots.SetMaterial(0, Bmat1)
    end if

    if text = "1" and mode.text = "INVERT" then
    top.SetMaterial(0, Bmat1)
    btm.SetMaterial(0, Amat1)
    dots.SetMaterial(0, Amat1)
    end if


    if text = "2" and mode.text = "NORM" then
    top.SetMaterial(0, Amat2)
    btm.SetMaterial(0, Bmat2)
    dots.SetMaterial(0, Bmat2)
    end if

    if text = "2" and mode.text = "INVERT" then
    top.SetMaterial(0, Bmat2)
    btm.SetMaterial(0, Amat2)
    dots.SetMaterial(0, Amat2)
    end if

    if text = "3" and mode.text = "NORM" then
    top.SetMaterial(0, Amat3)
    btm.SetMaterial(0, Bmat3)
    dots.SetMaterial(0, Bmat3)
    end if

    if text = "3" and mode.text = "INVERT" then
    top.SetMaterial(0, Bmat3)
    btm.SetMaterial(0, Amat3)
    dots.SetMaterial(0, Amat3)
    end if



    #XPression


  • 3.  RE: Linking Object Materials?

    Posted 05-16-2017 18:54
    Thanks for the response! In this particular case, it would need to be image textures. The idea is, if I prepare a logo image for a set of teams, I can have in the corners contain the primary, secondary, and tertiary colors. These colors would be outside the frame via either masks or texture scaling as needed. Then, on an object who's color needs to change with the team logo, I would have the same material, set to clamp with texture coordinate values of 1,000 1,000 for example to make that object now have the primary color of the team. This way, when an operator chooses a team logo, every relevant object will automatically change in color accordingly. Further, I could expose tex coordinates on these other objects so that secondary or tertiary colors could be swapped out as needed. It feels like a more elegant approach than making separate 'home' and 'away' scenes.

    I hope that makes sense...

    I don't really know much about datalinq at this point...
    #XPression


  • 4.  RE: Linking Object Materials?

    Posted 05-16-2017 19:48
    If you have Datalinq, this is its exact application. Check out the youtube page for tutorials on this exact application. I have mine set up as a Excel doc, with team tricodes as the Datalinq Key. When this is entered, the logos and primary colors are populated to the corresponding objects.

    If you don't have Datalinq, you can do this via scripting. you can modify the above script to pull colors and logos from within the material manager. There are a couple ways to populate colors. You could use it to pull RGB from an excel doc and then use DL, or render out color solids (like 100x100 pngs) of the colors and datalinq them that way. There are plenty of resources to do this so you should have no problem.
    #XPression


  • 5.  RE: Linking Object Materials?

    Posted 05-17-2017 21:09
    Hi Willie. In Visual Logic, you can use the face property of an object (in the Faces section of the objects properties) and apply the texture that object is using to the face of another object. When the Published texture of one object changes the other will as well.
    #XPression


  • 6.  RE: Linking Object Materials?

    Posted 05-25-2017 16:01
    Willie, I work for an NBA team and when a visiting team comes in, I use a spreadsheet to populate all the various materials (main logo, secondary, work mark, team colors) of the visiting team. I change the name of the spreadsheet from it's 3 letter ID (CHI for the Bulls) to AWAY TEAM and all my materials and colors are set. Would this help you?
    #XPression