Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Realistic Gold Material

Discussion in 'Shaders' started by LostBalloon, Feb 20, 2011.

  1. LostBalloon

    LostBalloon

    Joined:
    Feb 12, 2011
    Posts:
    25
    I've been trying to make a realistic gold material for coins in my game but have failed to do so in unity.
    Any help would be appreciated at this point.
     
  2. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,355
    What have you tried? Do you have reference images of the sort of gold you want?
     
  3. Deleted User

    Deleted User

    Guest

    I had a go for you using info from here.
    Basically, you use a Reflective/Specular shader, with Diffuse colour (70,40,0), Specular (255,240,215) and Reflection (255,200,100), and then you add a cubemap (I used "Mountain Path" from here, with default scaling).

    Here it is on a sphere:


    and here on a Roman coin (from here, decimated):
     
    angles20 likes this.
  4. LostBalloon

    LostBalloon

    Joined:
    Feb 12, 2011
    Posts:
    25
    Thanks,

    really nice links.
    How did you get your coin to distort the image from the cubemap so much?

    When i apply it in my scene, i feel like im creating a gold mirror that reflects something that is not even part of my scene.



    The player has a light and can only see for a specific distance, the scene is totally dark.
     
    Last edited: Feb 21, 2011
  5. Deleted User

    Deleted User

    Guest

    It distorts the cubemap that much, as the surface of the coin is modelled that way (it's not a simple disk). What are you using for a cubemap? If you are using pro, you could probably create a cubemap for the surrounding area using Camera.RenderToCubemap, as long as you keep the resolution quite low.
     
  6. LostBalloon

    LostBalloon

    Joined:
    Feb 12, 2011
    Posts:
    25
    No, im not using pro, could i still do that for the "Camera.RenderToCubemap" without pro?

    Edit: yeah, i just checked, i can't do that without pro.
     
    Last edited: Feb 21, 2011
  7. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    How big on screen are these coins going to be? Cause unless they're seen pretty large and supposed to be highly detailed, and have an environment they're pretending to reflect, then cubemaps and fancy shaders are overkill, simple texture (hundreds of gold coins on Google and unless they're immortal Romans or something, they can't exactly sue you for using them) and at most a normal map would suffice.
     
  8. Deleted User

    Deleted User

    Guest

    What Frank Oz said is quite true. Using any specular shader with the right colours in will give you a good enough gold effect, and will react to the lighting with much less fuss.
     
  9. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    Because it's going to bug me if I don't say anything, lol... I just wanna add that I wasn't knocking your suggestions or the gold color you got. I just had visions of him using high res textures and cubemaps for piles of individual coins no bigger than a few pixels in size and it made me shudder hehehe.
     
  10. Deleted User

    Deleted User

    Guest

    Hahaha - don't worry about it. I know what you mean - "Why is the game turning into a slideshow? Must be a pile of gold nearby!"

    Edit: Just in case you're worried, OP, I just tested with 20 of those high-poly coins, and got the same 830fps that I got with one :D (Unity's usually good at that kind of thing, but don't always assume that's true + the texture budget)
     
    Last edited by a moderator: Feb 21, 2011
  11. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    Ooooh damn your right! Hmm thinking about it, I shoulda kept quiet, it could have been a really useful ingame "feature" hehe.
     
  12. LostBalloon

    LostBalloon

    Joined:
    Feb 12, 2011
    Posts:
    25
    The coin will be pretty big on screen, specially when played in full screen, but Frank Oz gave me a good idea.
    i added a normal map to the material and it's pretty much the effect im looking for.

    Here is a screenshot with a test normal map (didn't take the time to properly UV map it since its a test)



    Thanks guys!
     
  13. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    Try get the color closer to gaustwick's original example.


    Also, you could consider dirtying it up too, in the creases and grooves where it's been handled, dropped, dented and otherwise well used and has gradually picked up a lot of muck, like most coins *looks at the few in his pocket* ok all coins.. hehe. Have the specularity amount low to nothing for the dirty bits. Along with making it look a bit more realistic, it'll bring out the details of the coin too.
     
  14. LostBalloon

    LostBalloon

    Joined:
    Feb 12, 2011
    Posts:
    25
    I tested with 50 coins, the amount i'm going to put, and works fine :)
     
  15. majiclite

    majiclite

    Joined:
    Mar 23, 2011
    Posts:
    1
    Hi gaustwick, excellent job!

    What do you suggest to get a soccer gold ball like this image examples? Normal maps? Bump map? Reflection Cube Map? I tried but did not get the results I'm looking for.



     
  16. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    Normal map and low res blurred reflection map.
     
  17. cyenketswamy

    cyenketswamy

    Joined:
    Jul 24, 2015
    Posts:
    41
    For a really quick material.
    1) Assets/Create/Material
    2) Select your Material and leave the Shader as Standard
    3) Change Albedo to R 255 G 226 B109 A255 or Hex Color FFE26DFF
    4) Move the Metallic slider to 1
    5) Select Source Albedo Alpha
    6) Add a Reflection Probe to scene Gameobject/Light/Reflection Probe
    7) Add a Sphere 3D object to your scene Gameobject/3D Object/Sphere
    8) Change your rendering Color Space to Linear Edit/Project Settings/Player

    Then drag and drop your material on your 3D object.
     
    Last edited: Feb 27, 2019
    r3dux, luckrols, lop221 and 3 others like this.
  18. A-AGames

    A-AGames

    Joined:
    Nov 24, 2019
    Posts:
    8
    I know that this post is really old. But what does he mean with Reflection, where do I have to assign these values? I hope someone will reply to my question.
    Thank you