Jump to content

Coatings - Iridescence


Jens

Recommended Posts

If anyone wants to, I can derive the formulas and post them, but they are fairly straight forward. This model can be used to explain iridescene effects on microstructures surfaces, such as butterflywings, fraction on stones ...

Please do. I am following you with great interest. Surely others do as well.

ttt

Link to comment
Share on other sites

  • Replies 64
  • Created
  • Last Reply

Top Posters In This Topic

I added here the formulas used to determine the intensity shift. Quite simple.

On the diffraction mirror model:

post-1415-1164558192_thumb.jpg

To calculate the the shift is this time even easier. We need teh solid red and green line. One solution would be to use trigonometric functions however I think in terms of speed using projections is much faster. To project a point onto a line you need to find the coresponding point that lies on the line and has the least distance to the point we want to project. A fun exercise ;) Anyhow green - red length will give us again the shift.

If we want to allow those thin layers to have a transmission and reflection part we have again the exactly same formulas as derived for our thin films. Just have to tilt everything.

This time we should look as well into the lightening model a bit. Have a look at the following diagram.

post-1415-1164558205_thumb.jpg

Obiously the lit surface is depending on the incident angle relative to the tilt of our structure and the ratio of d and p. Fun exercise to refresh the math skills too :bag:

I'll post the solution in a few days along with the code. I had a few problems with all those conversions from local space, camera and worldspace and vector attributes attached to primitives. Made me feel dizzy at times :blink:

Link to comment
Share on other sites

I'll post the solution in a few days along with the code. I had a few problems with all those conversions from local space, camera and worldspace and vector attributes attached to primitives. Made me feel dizzy at times :blink:

Looking forward to seeing where you go with this, Jens:) This is very intruiging to follow indeed.

Take care,

Jason

Link to comment
Share on other sites

I'll post an update with the code and a few samples soon, however a problem currently is to make it somewhat more useable for anyone who doesn't want to mess with the actual code. Currently when working on the code I simply created a new SHOP from a surface shader vop and directly changed the code at the shop level. To make things worse I added all functions of a metal shader, glass shader etc. into that single file and all parameters I manipulte directly in VEX.

But that's actually not my main problem. Rather it's learning how to create a custom VOP I could access directly as node in the VOP editor and integrate it into existing networks, how to create the labels, multiple outputs etc. --> gotta learn some basics of Houdini :lol: ... and there is that horrible problem called: 'time' :cry2:

Link to comment
Share on other sites

I'll post an update with the code and a few samples soon, however a problem currently is to make it somewhat more useable for anyone who doesn't want to mess with the actual code. Currently when working on the code I simply created a new SHOP from a surface shader vop and directly changed the code at the shop level. To make things worse I added all functions of a metal shader, glass shader etc. into that single file and all parameters I manipulte directly in VEX.

But that's actually not my main problem. Rather it's learning how to create a custom VOP I could access directly as node in the VOP editor and integrate it into existing networks, how to create the labels, multiple outputs etc. --> gotta learn some basics of Houdini :lol: ... and there is that horrible problem called: 'time' :cry2:

Come along with that - I think that me (and likely somebpdy else) won't mind hassling a bit with your code to create the UI. If it is possible a couple of comments on the params would be great (if you think that some params can seem complicated).

rrr

Link to comment
Share on other sites

Come along with that - I think that me (and likely somebpdy else) won't mind hassling a bit with your code to create the UI. If it is possible a couple of comments on the params would be great (if you think that some params can seem complicated).

rrr

The bit of code is (the code version using trigonometrics)

// Diffraction mirror shift
// 'jN' is not the global 'N', but modified according to microstructure
float dm_rs(float lambda, p, d; vector jN){
float e = sqrt(p*p + d*d);
float alpha = (jpi * 0.25 - acos(dot(jN,-jI)) + atan(d/p));
float beta = (jpi * 0.25 - acos(dot(jN,-jI)) - atan(d/p));
return (e * cos(beta) - (e * sin(jpi/4 - alpha))) / lambda;
}

and the idea for a for a lightening model that suits something like a CD.

float amp; //multiplier for coloroutput e.g. 'amp * Cf'
illuminance(P, jNf, jpi){
			vector tvec; 
			float  tfl;
			tvec = .5 * (normalize(L) + normalize(I));
			tfl = acos(abs(dot(tvec,jN)));
			if ((tfl) > 1.54) amp += 1;
			// if ((tfl) > 1.54 & tfl <= 1.56) amp *= (50 * tfl - 77);		  
		};

the uncommented part is simply to have some control on the falloff. Most basic thing you can do here.. just a linear one in the range 1.54 - 1.56. You get something like the following with 3 lights:

post-1415-1164835973_thumb.jpg

One problem is that to create a realistic CD shader you need a bit more complex model. However you can get away quite nicely by passing the color information from the diffraction mirror function into HSV before multiplying it with the 'amp' and just set s close to 1. A bit more insight on that subject once I'm a bit closer to the final version.. i have something a bit more fancy in my sleeve ;) (won't happen too soon, since I got a fair amount of work ahead).

Admittingly I think using some of the principle ideas and drive a few userdefined ramps is a way more artist friendly approach and from computation time for effecient (though shaders using this more physically motivated approach evaluate pretty fast still).

Link to comment
Share on other sites

dont know if you read this

hope it helps

http://graphics.stanford.edu/courses/cs348...nake/index.html

great work

z

Oh you can get similar results with the shader already. My version desaturates in colors once we have a facing ratio where normal and eye vector get close to each other. I guess he might not have used the fresnel coefficients, but rather the result of 'acos(dot(N,-i))'. If you'd do that the colors get brighter.

post-1415-1164894974_thumb.jpg

This is what I got when I simply plugged in my version without modifying the eta's for fresnel / change depth of coating layer. Decreasing the depth a bit and increasing the eta's will most likely get you fairly similar results as he has in those kangaroo renderings, if that's what you're aiming for :)

The CD lightening model is different thing that has to do little with the actual coloring due to those interferances and resulting iridescent colors (that's basically all done with the simple function a few posts above).

Link to comment
Share on other sites

I've been playing around with that shader and I'm getting closer with the soap shader :huh:

post-1415-1165104768_thumb.jpg

I tried find a way to create some soap foam procedually but that beyond my current houdini skills. For now that poor little kangooro has to endure all my shading tests :P

Currently the thickness is uniform.. but once I menaged to find some good controls for that it should look a bit more natural.

(Mantra's speed is impressive)

Link to comment
Share on other sites

I've been playing around with that shader and I'm getting closer with the soap shader :huh:

post-1415-1165104768_thumb.jpg

I tried find a way to create some soap foam procedually but that beyond my current houdini skills. For now that poor little kangooro has to endure all my shading tests :P

Currently the thickness is uniform.. but once I menaged to find some good controls for that it should look a bit more natural.

(Mantra's speed is impressive)

Cool, Jens! Keep it up (don't make me persuade Ratman to finish your shader ;) )

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...