Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

Question Confused about usage of same material with different outcome

Discussion in 'Animation' started by pi_314159265, Feb 14, 2023.

  1. pi_314159265

    pi_314159265

    Joined:
    Aug 14, 2022
    Posts:
    27
    I have a very basic question about materials (At least i think the question is about materials).

    I downloaded this (free) asset from the unity store:
    https://assetstore.unity.com/packag...ures/elemental-animations-free-227604#content

    In this asset there are (animations of) elementals: Fire, Ice, Earth.

    All 3 come with an animated prefab:
    upload_2023-2-15_0-43-35.png

    As far as i can tell every child object with a material (of all 3 elementals) uses exactly the same material:
    upload_2023-2-15_0-44-44.png

    Yet the elementals clearly look different:
    (Here with looking different, i am refering to the surface of the "skeleton" not the shape)
    upload_2023-2-15_0-45-33.png
    upload_2023-2-15_0-45-52.png

    With my (very limited) knowledge of matrials i can not think of an explanation for this behaviour. Can someone enlighten me why this is happening? Where is this behaviour configurated?

    My concrete use case is, that i want to color the earth elemental green (to indicate it beeing associated with poison). While i can archive that by replacing every material in the childs objects of the earth elemental by some green matrial of my choice (preferably by an editorscript). I would rather understand the situation better before doing so.
     
  2. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    1,534
    Look to the left of your material's "Albedo" field. It is a tiny thumbnail of a texture included with the asset. It's a small grid of swatch colors.

    Mesh models have UV coordinates associated with every vertex. This particular asset chooses a "one color per polygon" art style. The artist edited the mesh so that the UV coordinates of all of the vertices around one polygon are aligned with the blue swatch in that grid of swatch colors, and thus that polygon appears blue.

    The more typical case is for a polygon's vertices to be mapped to a region of the Albedo texture so that the imagery in that area shows up recognizably on the model.



    This example uses both techniques. All the solid-blue polygons map to the swatches, while the logo works map to the image area, in the same Albedo texture map.


    For your case, you have two choices: you can try to adjust the "Offset" of the material, which will cause all of the vertex UV data to point at a different color, or you can replace that Albedo texture map reference with a completely different texture image.
     
  3. pi_314159265

    pi_314159265

    Joined:
    Aug 14, 2022
    Posts:
    27
    Thank you for your reply, halley. Unfortunatly i had no time till today to read it.
    I am not quite sure, that i get what you are saying. Let me elaborate further:

    I missed this detail before. There is indeed a small grid of swatch colors like you indicated:
    upload_2023-2-18_8-48-24.png

    I do not see the place where this is configurated. If we look at (a part of) the object struktur of one of the elementals
    upload_2023-2-18_8-49-53.png
    The first 4 parents (i.e. "IceElemental", "Rig", "root", "footSatellite01") carry no information for the surface appearance of the material (the last 3 have only a RectTransform component, and the first RectTransform + Animator)?

    My conclusion is, that the information is somewhere in the last GameObject "02.FootSatellite01". I do not see any place with UV coordinates there? So it is configurated somewhere else?
    upload_2023-2-18_8-54-15.png

    I am not quite sure how. Could you elaborate further? Maybe my only problem is that i havent found the place where th UV coordinates are configurated.
    In particular i am unsure if it is possible to keep the same material in all 3 elements and edit the colors of exactly 1 of them? Preferably (but not necessary) without editing every Child GameObject, which has a material attached to it.
     
  4. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    1,534
    The UV coordinates are a part of the mesh model itself. Stored inside the mesh data.

    If you use the Offset sliders at the bottom of your last screenshot and watch the model, you'll see things change. This may or may not be useful to you, since you said you wanted green monsters and I don't see green swatches.

    Instead, make a duplicate of the original texture image file with swatches. And also make a duplicate of the material assets. Edit the new texture to adjust colors. And then in the new material, assign the new texture by dragging it onto that swatch box. You can then use the new material on the existing mesh and it will have the new colors you edited in.
     
  5. pi_314159265

    pi_314159265

    Joined:
    Aug 14, 2022
    Posts:
    27
    I dont see any slider for "offset", just 2 x,y configuration fields. Changing those values did nothing with the animation (as far as i could tell). Also each material in each (different appearing) elemental has the same values there.

    upload_2023-2-18_22-34-54.png

    Is it possible for you to add an image of where exactly i should be changing values?
     
  6. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    1,534
    Type 0.25 into any of those four fields labeled Offset X or Y. Then type 0.5 in either one. Then type 0.75 in either of them.

    You can also click on the letter X or letter Y and DRAG your mouse left or right to modify those values. That's why I called them sliders.
     
  7. pi_314159265

    pi_314159265

    Joined:
    Aug 14, 2022
    Posts:
    27
    I tried to modify the values by whole numbers, which did nothing. Probably the values are read modulo 1?
    When modifing as you mentioned by 0.25 etc. the colours indeed changed.

    But i still dont get how the elementals have different surface appearence. If i modify the "Offset" (in the indicated way from your replay), the appearence of all elementals changes at once. This makes sense, because the Offset in my picture is the material specific Offset used in all 3 elementals.

    I still dont see the place, where any elemental specific configuration is done. Is it possible to give me a pointer here? Best would be an image.
     
  8. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    1,534
    I don't have your Elemental models. I suggest you watch a tutorial on UV Mapping. Even if you don't actually use Blender, even if you don't actually intend to model anything yourself, ever, this will be useful to help you understand how meshes work with texture images. The concepts carry over, even if the interface to various tools is different.



    After you watch that, go back and look at my screenshot of a few vending machines above.