Home Technical Talk

Iridescent Materials?

Weiser_Cain
polycounter lvl 18
Offline / Send Message
Weiser_Cain polycounter lvl 18
I'd like some tips on creating iridescent materials.

Replies

  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    Depends what sort of iridescent you want, really.
    http://www.pestcontrolcanada.com/Questions/iridescent%20beetle.jpg

    In the past I've usually just made the specular colour a really strong colour that's fairly opposite the diffuse colour of the material. So for a red material, I'd use a strong bright green highlight. Also using very saturated colours seems to help.
    Beyond that you could try using bright, multi-coloured environment reflection maps.

    http://en.wikipedia.org/wiki/Iridescence

    Also helps to read up on "why" this effect occurs, so you can better simulate it when you have an understanding of what's happening with the light in the real world.
  • Eric Chadwick
    Options
    Offline / Send Message
    Blurry saturated reflection map is the way I've gone, works well.
  • Korovyov
    Options
    Offline / Send Message
    This looked like a fun challenge so I thought I'd give it a shot.

    First off, I tried to emulate the kind of iridescence of this beetle:
    Female_Golden_Stag_Beetle.jpg

    I think I've been able to recreate the general behavior of the specular color based on viewer angle with a fair bit of accuracy.

    Screenshot:
    yxJWu.jpg

    Material Editor:
    nXdCJ.jpg

    Specular Network:
    t8RXl.jpg

    All in all this was a pretty fun project.

    I hope this helps.
  • LoTekK
    Options
    Offline / Send Message
    LoTekK polycounter lvl 17
    This looked like a fun exercise, so I did up a quick HLSL thing. It's not perfect, but it does the main job of hue shifting by view incidence:
      float3 k = normalize(float3(1,1,1));
      float t = dot(N, V) * 3.142 * 2;
      float3 v = C.xyz;
      C.xyz = v * cos(t) + cross(k, v) * sin(t) + k * dot(k, v) * (1 - cos(t));  //Rodrigues' Rotation Formula ftw
      //credit to Vailias for turning me onto the Formula a couple months back :D
    

    I'll try and do up a UDK node network when I'm back from lunch
  • Computron
    Options
    Offline / Send Message
    Computron polycounter lvl 7
    Does UDK support the use of Colored Gloss maps? If so, this is relatively simple, no?
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    ^^That would be so awesome, I always get lost in the normalization parts.

    ^I don't think so. I never got any results with colored gloss.
  • Korovyov
    Options
    Offline / Send Message
    the reason I used fresnel nodes instead of a colored specular was because the fresnel nodes react to camera angle the way real iridescence works rather than a static color regardless of viewing angle. The fresnel is computationally heavy and I really just did this to see if it could be done accurately rather than making something that could be used heavily in a game. If I was going to make an army of japanese beetles for a game I would probably just use a colored specular map - they do work, but like most specular maps in udk, you have to multiply them for them to be strong enough.

    Thanks for the feedback all, and I look forward to learning about HLSL when I have more time.
  • LoTekK
    Options
    Offline / Send Message
    LoTekK polycounter lvl 17
    Sorry for the biggish image:
    iridescent1.jpg

    Kept getting hung up on the sin/cos input. Docs say it takes radians, but it doesn't actually. 1 = 360 degrees = 6.2~~~ radians. -_-

    Anyway, that's a node translation of Rodrigues' Rotation Formula.

    [edit]
    I forgot to take the multiply node out before, so I've swapped it out for a power node (to control hue shift falloff).
    [/edit]
  • Korovyov
    Options
    Offline / Send Message
    This is awesome! I'm going to try it out RIGHT NOW!!! :D

    Thanks a ton, this looks way lighter on overhead too.
  • Vailias
    Options
    Offline / Send Message
    Vailias polycounter lvl 18
    OH btw LoTekk and others, here Have some Material Functions.
    I'm building a library of these things, and will eventually be providing documentation. I have a few more things in the works to add.

    However a material function version of Rodriques' rotation function is in there as "Vailias_Vector_Rotation" (everything is prefixed with my name and in a Vailias_Utils section of the function library. Included in the pack are a controllable fresnel, a minnaert shading model, a normalized gaussian function.. which I need to double check as being accurate, a per pixel reflection vector generator.. since UDK's reflection vector is per vertex, a SelfShadowing bump offset function.. and a vector reflector.. ie it takes two vectors, and reflects one about the other. Anyway dig in. It will get its own thread later.

    also:
    lol here's another version.. this one is a bit math heavy due to how I made the banding. It would likely be lighter just to do a gradient ramping thing like that one thread from a while back, but I like the control and effect I get with this one.
    All images here are either different angles of the same setting or a tweak to a parameter or two in the Material instance.
    Irridecent_BeetleThings.jpg
    Irridecent_BeetleThings_Nodes.jpg

    The banding could be done differently, frankly using a ramp texture sampled with the dot product would likely be one of the cheapest options. The key to the look, In my opinion, is the color-shifted environment map which is simple to do really. Just a cubemap lookup, plugged into a desaturation node, with the specular color map as the percentage, then overlay the desaturated cube on the spec color map. 2 node setup now that we have material functions.
  • LoTekK
    Options
    Offline / Send Message
    LoTekK polycounter lvl 17
    Vailias, you beast!

    (where's that 3D math video series?! :p)
  • Korovyov
    Options
    Offline / Send Message
    Ok, I think I've come up with a more finalized result. I ended up borrowing from both of your material setups and put it together as a modified phong.
    Here's what I came up with:
    Q5aG3.jpg
  • dreatern
    Options
    Offline / Send Message
    dreatern polycounter lvl 6
    I did a rustic iridescence in unity using only colored specular to the wings
    http://dl.dropbox.com/u/22781761/3dviewer/flyinginsect/WebPlayer.html

    This is not a realistic effect but in a limited mobile game may be a solution.
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Korovyov wrote: »
    So the Blend Overlay is part of the engine material function library?

    Yes, but you can get the same result by Multiplying the the two together and then multiplying it all by 2.

    The difference is extremely minor, I still haven't come across anything that makes those extra 10-12 instructions worth it.
  • Korovyov
    Options
    Offline / Send Message
    Here is my UPK file if you guys are interested in checking it out: http://dl.dropbox.com/u/45557166/Korovyovs_Iridescent_Material.upk
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    ^
    Haha, no way! I have exactly the same setup in my material :P
  • Korovyov
  • Dvolution
    Options
    Offline / Send Message
    Dvolution polycounter lvl 11
    Korovyov: is that upk still in dropbox? When I click on it, I'm not prompted to download anything.
  • Korovyov
    Options
    Offline / Send Message
    it should be, I tried updating the file and I guess it changed the link location. I edited my previous post to have the correct link.
Sign In or Register to comment.