Graphics

 View Only
  • 1.  Changing color to image

    Posted 05-16-2024 14:50

    Working on some map graphics, specifically one that has all counties in our state with  each one on its own layer brought in as a .psd file..  It assigned each county as.a quad with its own material.  IS there a way to go in a change the fill color of the material/texture while still keeping an alpha of the county shape?

    Thanks,

    Scott



    ------------------------------
    Scott Carmichael
    Indiana University
    ------------------------------


  • 2.  RE: Changing color to image

    Posted 05-16-2024 15:25

    Yes.

    I haven't done this yet as you want to do, but this is how I think it would be done.

    Enable/disable layers or shaders.

    Make a multilayer material and turn layers on or off based on county condition.

    ...or...

    Make a multishader material and turn on or off shaders based on county condition.

    I'd recommend VB.

    Are you comfortable with VB?

    If so, when I need a break from work, I might fool around with it. Or someone else here might already have some code.



    ------------------------------
    Azathoth
    Son of Cthulhu
    ------------------------------



  • 3.  RE: Changing color to image

    Posted 05-16-2024 16:36
      |   view attached

    I have a scene that does this with Visual Logic. Basically, the end-user can select 4 colors to use and then select which color to apply to a county cutout.

     

    I use 4 materials that I've named "Key 1, Key 2, Key 3, Key 4." Then with visual logic, I give the end-user the ability to apply 1 of 12 different colors to each of the Key materials.

     

    Once the Key 1,2,3,4 colors have been assigned, the user can then apply Key 1,2,3 or 4 to any county cutout.

     

    Each county cutout is a separate material and then assembled in LAYOUT to complete the base map.

     

    Then I have a text object for Key 1,2,3,4, and each county. The Key 1,2,3,4 text objects have a Data Source Static List with all 12 different colors in text form, e.g., White, Blue, Green, Red, etc. In VL, each color is assigned a Hex Code color value. The county text objects have a Data Source Static List with None, Key 1, Key 2, Key 3, Key 4.

     

    After this setup, everything else is done in Visual Logic. Looking at the attached VL Images, the Key Colors VL must be done for Key 1,2,3, and 4, and the County Colors VL must be done for each county. It looks like a lot, and it is, but once you complete one set, you can copy/paste and replace the necessary blocks.

     

    Hope this helps. I'm trying to attach an XPP of the scene. Hope it posts.

     

    John Renigar

    WRAL

     

     

     

    A screenshot of a computer  Description automatically generated

     

    A screenshot of a computer  Description automatically generated

     

     




    Attachment(s)

    xpp
    MAP PROJECT.xpp   21.38 MB 1 version


  • 4.  RE: Changing color to image

    Posted 05-17-2024 10:28

    I gave this a shot. I made a mask for each "county", a quad to hold red, a quad to hold blue, and a quad to hold gray.. Also  red, blue & gray materials. The red, blue, gray and mask are applied to quads inside a layer object along with a text object with gray being the base layer. I set the text object to select between only R and D.

    on the text object on the OnSetText is this script. Basic I know but I'm on my first cup of coffee. 

    dim red as xpBaseObject
    dim blue as xpBaseObject


    scene.GetObjectByName ("red",red)
    scene.GetObjectByName ("blue",blue)
    if text = "R" then
    blue.Visible = false
    red.Visible = true

    else if text = "D" then
    blue.Visible = true
    red.Visible = false

    else
    blue.Visible = false
    red.Visible = false

    end if

    As the operator changes the value, it turns on the corresponding color. You could add as many colors as you want, or could use a percentage value that would automatically change colors, otherwise the color is gray.

    This script would work on every county, all you would do is change the mask in each layer object group.

    If I've oversimplified, or missed the target, sorry. 



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



  • 5.  RE: Changing color to image

    Posted 05-21-2024 14:47

    Thanks everyone, I really appreciate it.   I will dive into these suggestions when I get back into the office next week!



    ------------------------------
    Scott Carmichael
    Indiana University
    ------------------------------