PDA

View Full Version : Iridescent Materials?


Weiser_Cain
11-30-2005, 03:23 AM
I'd like some tips on creating iridescent materials.

MoP
11-30-2005, 05:37 AM
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
11-30-2005, 07:47 AM
Blurry saturated reflection map is the way I've gone, works well.

Korovyov
12-21-2011, 07:35 PM
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:
http://upload.wikimedia.org/wikipedia/commons/d/df/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:
http://i.imgur.com/yxJWu.jpg

Material Editor:
http://i.imgur.com/nXdCJ.jpg

Specular Network:
http://i.imgur.com/t8RXl.jpg

All in all this was a pretty fun project.

I hope this helps.

LoTekK
12-21-2011, 09:07 PM
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
12-21-2011, 10:04 PM
Does UDK support the use of Colored Gloss maps? If so, this is relatively simple, no?

Ace-Angel
12-21-2011, 10:09 PM
^^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
12-21-2011, 10:41 PM
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
12-22-2011, 12:56 AM
Sorry for the biggish image:
http://dl.dropbox.com/u/778345/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.


I forgot to take the multiply node out before, so I've swapped it out for a power node (to control hue shift falloff).

Korovyov
12-22-2011, 01:12 AM
This is awesome! I'm going to try it out RIGHT NOW!!! :D

Thanks a ton, this looks way lighter on overhead too.

Vailias
12-22-2011, 02:31 AM
OH btw LoTekk and others, here Have some Material Functions. (http://dl.dropbox.com/u/442934/PC_Links/Vailias_Resources.zip)
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.
http://dl.dropbox.com/u/442934/PC_Links/Irridecent_BeetleThings.jpg
http://dl.dropbox.com/u/442934/PC_Links/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
12-22-2011, 03:30 AM
Vailias, you beast!

(where's that 3D math video series?! :p)

Korovyov
02-18-2012, 12:52 PM
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:
http://i.imgur.com/Q5aG3.jpg

dreatern
02-18-2012, 02:46 PM
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
02-18-2012, 02:58 PM
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
02-18-2012, 04:40 PM
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
02-18-2012, 05:25 PM
^
Haha, no way! I have exactly the same setup in my material :P

Korovyov
02-18-2012, 06:41 PM
o_O lies!

Dvolution
02-18-2012, 07:42 PM
Korovyov: is that upk still in dropbox? When I click on it, I'm not prompted to download anything.

Korovyov
02-19-2012, 12:02 AM
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.