MADjestic Posted November 26, 2006 Share Posted November 26, 2006 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 Quote Link to comment Share on other sites More sharing options...
symek Posted November 26, 2006 Share Posted November 26, 2006 Please do. I am following you with great interest. Surely others do as well.ttt I'm with him! This threat is my evenning reading... Quote Link to comment Share on other sites More sharing options...
Jens Posted November 26, 2006 Author Share Posted November 26, 2006 I added here the formulas used to determine the intensity shift. Quite simple. On the diffraction mirror model: 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. 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 Quote Link to comment Share on other sites More sharing options...
Jason Posted November 29, 2006 Share Posted November 29, 2006 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 Looking forward to seeing where you go with this, Jens:) This is very intruiging to follow indeed. Take care, Jason Quote Link to comment Share on other sites More sharing options...
lisux Posted November 29, 2006 Share Posted November 29, 2006 Go ahead Jens, this seems to be pretty interesting stuff. Quote Link to comment Share on other sites More sharing options...
Jens Posted November 29, 2006 Author Share Posted November 29, 2006 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 ... and there is that horrible problem called: 'time' :cry2: Quote Link to comment Share on other sites More sharing options...
MADjestic Posted November 29, 2006 Share Posted November 29, 2006 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 ... 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 Quote Link to comment Share on other sites More sharing options...
Jens Posted November 29, 2006 Author Share Posted November 29, 2006 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: 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). Quote Link to comment Share on other sites More sharing options...
zoki Posted November 30, 2006 Share Posted November 30, 2006 dont know if you read this hope it helps http://graphics.stanford.edu/courses/cs348...nake/index.html great work z Quote Link to comment Share on other sites More sharing options...
Jens Posted November 30, 2006 Author Share Posted November 30, 2006 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. 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). Quote Link to comment Share on other sites More sharing options...
zoki Posted November 30, 2006 Share Posted November 30, 2006 wow very nice very fast progress on this one ! regards z Quote Link to comment Share on other sites More sharing options...
lisux Posted November 30, 2006 Share Posted November 30, 2006 Great result, I like it a lot! Quote Link to comment Share on other sites More sharing options...
Jason Posted November 30, 2006 Share Posted November 30, 2006 Oh you can get similar results with the shader already. I really like the look of this very much, it really adds to the image quite significantly. Jason. Quote Link to comment Share on other sites More sharing options...
MADjestic Posted November 30, 2006 Share Posted November 30, 2006 Jens, if my assumption is right you are currently trying to get your code wrapped up in a VOP Node to get it integrated with other parts of the shader (assuming you are planning to do it in VOPs). Though it can surely work Quote Link to comment Share on other sites More sharing options...
Jens Posted November 30, 2006 Author Share Posted November 30, 2006 Jens, if my assumption is right you are currently trying to get your code wrapped up in a VOP Node to get it integrated with other parts of the shader (assuming you are planning to do it in VOPs). Though it can surely work jiri_v2.zip Quote Link to comment Share on other sites More sharing options...
Jens Posted December 2, 2006 Author Share Posted December 2, 2006 I've been playing around with that shader and I'm getting closer with the soap shader 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 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) Quote Link to comment Share on other sites More sharing options...
Jason Posted December 3, 2006 Share Posted December 3, 2006 That looks really good, Jens. I know I, for one, am eager to play with it:) Take care, Jason And I have this feeling that Mantra is only going to get faster and better in the future. Quote Link to comment Share on other sites More sharing options...
MADjestic Posted December 3, 2006 Share Posted December 3, 2006 I've been playing around with that shader and I'm getting closer with the soap shader 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 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 ) Quote Link to comment Share on other sites More sharing options...
zoki Posted December 4, 2006 Share Posted December 4, 2006 lovely cant wait to get some time for this yes its hard to convince peolpe how good mantra is if they didnt try it I did some displacement with it and its the same speed/quality as renderman in my oppinion z Quote Link to comment Share on other sites More sharing options...
old school Posted December 4, 2006 Share Posted December 4, 2006 Hard to convince because there is no support for Mantra in Maya and 3DS Max? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.