View Full Version : Index of refraction calculations in LW

 Anti-Distinctlyminty12 December 2005, 12:22 AMHi peoples. Been working on an object that needs some darn awkward surfacing. I posted a thread a while ago: http://forums.cgsociety.org/showthread.php?t=294682 While I have reasonable results so far due to the help of people here, it's made me think of a few things, one of which is total internal reflection. When you set a refractive index for a material does LW calculate this effect? I know there is a real fresnel shader, but I'm using FPrime so that puts all shaders out of the window (grrr). Furthermore, the RF shader makes everything look like glass, which is not the effect I'm looking for - this material (plastic nylon) has very interesting properties with regards to its scattering and bending of light, which cannot be conveyed with the single picture in the thread quoted above. Light seems to be captured inside and bounce around illuminating parts which then become tranparant when looked at head on. Anyway, yeah. How deep does LW native calculations go regarding how light behaves at a surface?
Netvudu
12 December 2005, 01:39 AM
The last question you make, though interesting, goes far beyond what I would dare explaining. Maybe someone programming shaders or even redner engines would be more capable of answering such a question.

As for the fresnel effect though, almost nobody who has some mastering of the app is using those shaders anymore, and the reason is that even when Fast Fresnel sometimes bestow decent results, they give too few control of how the fresnel behaves. Specially regarding angles. Thatīs why we always use a gradient with "Incidence Angle" as the Input Parameter. That allows for a fine control of the fresnel effect, both angle and intensity. Remember, 90 degrees is orthogonal, or "directly in front", while 0 degrees is at the same plane or "silouhette".

Plus, using gradients allows for Fprime visualization, this is almost real-time tweaking of the fresnel.

Hope this helps. :)

gerardo
12 December 2005, 12:13 PM
Hi peoples.
Been working on an object that needs some darn awkward surfacing. I posted a thread a while ago: http://forums.cgsociety.org/showthread.php?t=294682
While I have reasonable results so far due to the help of people here, it's made me think of a few things, one of which is total internal reflection. When you set a refractive index for a material does LW calculate this effect?

Yes, but if you want to achieve internal reflections you need to use air polys or double_sided option; I don't use air polys for my tests in that thread but I recommend it for internal reflections instead of double_sided option since you can use spherical map reflections just for this surface and speed up your render times. Btw, G2 has an special option for refraction index of backsided polys.

I know there is a real fresnel shader, but I'm using FPrime so that puts all shaders out of the window (grrr). Furthermore, the RF shader makes everything look like glass, which is not the effect I'm looking for -

About fresnel effect with gradients, don't use a linear ramp; this effect never is linear. G2 has an special option for this too.

this material (plastic nylon) has very interesting properties with regards to its scattering and bending of light, which cannot be conveyed with the single picture in the thread quoted above. Light seems to be captured inside and bounce around illuminating parts which then become tranparant when looked at head on.

In that thread, I faked SSS with incidence_angle gradients and distance_to_object gradients in luminosity channel and FI'sLocalAmbient. If you want an easy way that your lights interact with this effect, you can mix it with light_incidence gradients modified by incidence_angle and distance_to_object gradients in translucency channel; maybe in your case is possible to use surface thickness but LW doesn't blur this effect yet. Other way is using TBShaderTree or maybe the new InterZolt; if you are using FPrime, G2 may be other way as well.

Anyway, yeah. How deep does LW native calculations go regarding how light behaves at a surface?

Are you sure that you are seeing internal reflections and not caustic effects? According to LW manual, caustics take place in real world when light reflect off a curved surface (as your object) or refracts through a transparent surface (as your object again) so that it's focused on a small area. It would be good if you can post some pictures about your test and the effect you want to achieve.

Gerardo

red_oddity
12 December 2005, 03:41 PM
http://developer.nvidia.com/object/fresnel_wp.html

Check the PDF.

this might give a good idea about your ramp/gradient should somewhat be in order to get a fresnel.

Anti-Distinctlyminty
12 December 2005, 01:37 AM
Hi again Gerardo :)
Yes, but if you want to achieve internal reflections you need to use air polys or double_sided option; I don't use air polys for my tests in that thread but I recommend it for internal reflections instead of double_sided option since you can use spherical map reflections just for this surface and speed up your render times. Btw, G2 has an special option for refraction index of backsided polys.
Gerardo

I've started using the air polys to try to get the desired effect. Its very perculiar though - if you take a look at the picture of the object, about 1/3 of the way up from the bottom of the picture you can see a brighter white disc shape that's on the inside of the object. In fact, I've attached two images to demostrate this better (demo & demo2). The polys that are selected are the ones that show this phenomenon most. In the picture of the actual object, this is the disc like area that looks bright.

Are you sure that you are seeing internal reflections and not caustic effects? According to LW manual, caustics take place in real world when light reflect off a curved surface (as your object) or refracts through a transparent surface (as your object again) so that it's focused on a small area. It would be good if you can post some pictures about your test and the effect you want to achieve.
Gerardo

I've attached a render I've done that is similar using your object gerardo, but with different surfacing. I didnt use luminosity to get the 'bright' effect, but additive tranparency. I know it's not spot on yet, but I just thought I'd try a different approach :) I think it needs more translucency & less transparancy.

While I'm chatting about this, there is something awkward I came across. You know how diffuse + reflection + tranparancy = 100%?
Well, what if you have different gradients, with different blending modes at different opacities? That makes this kind of calculation almost impossible to work out. Is there a tool to assist?

ham8
12 December 2005, 03:33 AM
If I understand the question, you are after SubSurface Scattering (SSS)?

Go here and check this out:

There is a file attached in the thread that is a zip that you can dowload.

I hope that this helps in what you are trying to do.

;)

cheers!

Netvudu
12 December 2005, 04:46 AM
You know how diffuse + reflection + tranparency = 100%?

No, I donīt.
I do know people will argue with me here, but in my 3d experience, this isnīt true.
Of course it would a be valid statement if 100% was an absolute maximum diffuse value (what the hell is that) and light reacted just like in the real world, but in a world with far from perfect shaders and non real lighting, this doesnīt necessarily hold. For godīs shake, youīre even creating "air" polys because you know that.

Which means, itīs a very good point for starters and will yield quite acceptable results, but I wouldnīt let myself get obsessed by that info...thus, I say play with your gradients at will. As long as you keep in your head those values to get something close youīll be fine. I have stumped in a few situations where an unreal combination of them worked even better than the theoretically perfect amount. Use the "Eyes rule" law.

I do agree the fresnel isnīt linear. Again, play with you gradients.

Canīt recommend an SSS solution because I havenīt tried InterZolt yet, so I cannot compare it with G2 or Ogo_Hikari.

gerardo
12 December 2005, 07:37 AM
Hi again Gerardo :)

I've started using the air polys to try to get the desired effect. Its very perculiar though - if you take a look at the picture of the object, about 1/3 of the way up from the bottom of the picture you can see a brighter white disc shape that's on the inside of the object. In fact, I've attached two images to demostrate this better (demo & demo2). The polys that are selected are the ones that show this phenomenon most. In the picture of the actual object, this is the disc like area that looks bright.

Hi Luke, I guess this is due to your additive transparency; maybe it works with your environment and lighting setup, but additive_transparency is presented on materials in plasm state for example, plastics commonly doesn't show this phenomenon.

I've attached a render I've done that is similar using your object gerardo, but with different surfacing. I didnt use luminosity to get the 'bright' effect, but additive tranparency. I know it's not spot on yet, but I just thought I'd try a different approach :) I think it needs more translucency & less transparancy.

With that setup, you may want to try with soft reflections too

While I'm chatting about this, there is something awkward I came across. You know how diffuse + reflection + tranparancy = 100%?

I agree with Netvudu, this is very relative and I've noticed most of the times, useless. As far as I know, this law of 100%, is a myth, since isn't applicable in most cases in reality; and in cases that it's applicable (if that thing exist) might be useful in Maxwell, but in LW (and most of 3D packages) the light doesn't behave exactly as real light, and LW camera doesn't capture the light exactly like a real camera, and the response curve of LW FPviewer is linear, so doesn't show the RGB values like a real film (even with virtual darkroom you need to tweak or use G2). You can have diffuse at 50% but your lighting level might be 200%, you can have a grey in color channel but your diffuse might be 350% what gives white and not grey, you can have reflection at 10% but the brightness of your window might be 3000%. This gives us a big room where to play, extending the real possibilities, but these things mainly depends of how you are setting your particular scene.

Well, what if you have different gradients, with different blending modes at different opacities? That makes this kind of calculation almost impossible to work out. Is there a tool to assist?

Yep, your eye :) Maybe some day this isn't necessary, that would be great because we might focus only in the creative aspect of lighting and surfacing; but right now, in fact, the best tool we have here, is our observation skills; but is very good from you to try of knowing the real effect you want to achieve, just consider when you translate these things to LW tools, due to LW nature, you should determine what deserves to be "calculated" by you and what may be just represented by sight.

Gerardo

Anti-Distinctlyminty
01 January 2006, 03:26 PM
First of all, Happy New Year! :)

Anyway, as for the 100% thing, I never took it as a rule before, but in the thread I quoted above I was chastised by someone for not adhering to the 100% 'rule'. I was always under the impression that it's a rough guideline to start with, so now that is confirmed.

Netvudu & ham8: Thanks for the input. This phenomenon doesn't seem to be SSS (I can't use interZolt anyway as its a shader and I'm using FPrime). Its a reflectance thing.
If you look closely at the reference pictures of the actual object from the previous thread, and the pictures supplied with thsi thread you should see the area I'm talking about.
One thing I'd like to know is how far LW calculations go for the bending of light at an interface between objects? Will it perform something like total internal reflection itself?

OR Will I have to write a version of the Fresnel equations somehow? I'll have no trouble with the equations, but getting them into LW may be interesting.

Anti-Distinctlyminty
01 January 2006, 07:10 PM
Guys, I've attached what I've managed so far.
Any suggestions from a fresh pair of eyes are welcome, but I dont think that it looks to far from the real thing at the moment (the render is a bit dimmer, but I'll just crank up one of the lights).
I've used a slight gradient on the diffuse from 50 - 100%, 60% opacity, multiply blending. Base diffuse value is 50%
Reflection 5% (may need to tweak this a little), fresnel gradient on this at 60% opacity, multiply blending.
Transparency 45% fresnel gradient again opposite to reflection.
50% translucency, 20% colour highlights, 20% additive tranparency.
G2 was used to set the refractive index of the backsided polys to 1.
Also, there is no refraction blurring, its gerardos moving micro bump procedural.

And finally, what seemed to be causing the illumination of that disc shape, was light bouncing around in there. I the attached render was done with 2 bounces of radiosity and lo and behold, it is illuminated correctly. There goes my render times :)

gerardo
01 January 2006, 12:17 AM
Man, that's really nice improvement! :thumbsup:
Perhaps you want to increase a little the translucency (or SSS effect) and transparency (with its refraction blurring); looks like if the indirect lighting needs to affect more these surface parameters.

Gerardo

Anti-Distinctlyminty
01 January 2006, 11:43 PM
Hey gerardo (and anyone else who's interested).
I've attached an image that I think is a fairly good representation of the real thing. Oh, by the way, the extra shine on the disc that I talked about earlier wasn't due to radiosity (which is good). It was caused by the air polys.
I didn't use air polys in the end, just turned on Double Sided and activated the two options in G2 to deal with this ('zero attributes of backsided polys' and 'set refraction index of backsided polys' to 1). Strange this is not native in LW as it seems so essential to making transparant objects - especially in this case.
In the end I had fresenel gradients reflection and transparancy on 60% opacity. Reflection base 12%, transparancy at 40%, Diffuse 40%, micro bump map.
Also added some SSS using G2. (object is about 1.5m wide in the model) Transparency absorbtion 100%, transucent lighting 150%, SSS 100%, nonlinear scattering 100%, surface refraction 100%, falloff distance 1.0 and internal contrast 0%.
Also rendered using radiosity and a touch of dof to make it look swish.

What do you think?

gerardo
01 January 2006, 09:14 AM
Don't know if it's my monitor, but for some reason your image looks too blurry here (as if it was out of focus).

Gerardo

Anti-Distinctlyminty
01 January 2006, 10:01 AM
Yeah, that's due to some extreme DOF. I'll tone it down a bit in future :)

One thing I've notice when using SSS in G2: The centre of the object, which is the thickest part and should show more SSS effects, is almost always transparant. As if G2 is confused about which parts are the actual inside of the object. HAve you any experience with SSS with G2?

gerardo
01 January 2006, 11:24 AM
Yes, I use it mostly for its surface_refraction option (which is commonly difficult to achieve with gradients tricks), but I don't think the problem that you mention is due to the SSS, but rather for your falloff_distance; notice the part of the object you are referring has a bigger radius but in fact your object has the same thickness along its surface, consider also is possible that that part of the object is more opaque or dirty due to the use or fingerprints grease or just due to manufacture process of that nylon piece. You can try to solve it observing if that part is more thickness in reality or is in fact more opaque; according to that, you may try diminishing your falloff_distance (but I don't think that helps much); other way might be making that part more thickness (separating the internal polygons more from the external ones), another way may be diminishing the transparency in that area through gradients, weightmaps or alpha maps (using LW Boost option in G2), or increasing the refraction blurring (only in that area).
Consider as well G2's SSS doesn't works with indirect illumination yet; you may try to solve it adding some fill lights (commonly pointlights), or dome lights or spinning lights that represent your environmental lighting; other way (the easy way) is to play with the complementary_color option.

Gerardo

Anti-Distinctlyminty
01 January 2006, 11:42 AM
[snip]...other way might be making that part more thickness (separating the internal polygons more from the external ones)...[snip]

The polys are double sided, so seperating them will not be possible. The object itself is quite thick in that area, so I though the SSS would pick this up. I've tried messing about with the falloff distance, but it has little effect in this thick part. It behaves quite strangely.
I was considering adding another disc shaped thick object in that area and applying SSS to it to make the light scattering more prominent there.

...Consider as well G2's SSS doesn't works with indirect illumination yet; you may try to solve it adding some fill lights (commonly pointlights), or dome lights or spinning lights that represent your environmental lighting....

Yeah, I really noticed this when I turned radiosity on. There is a technique (that uses luxigons I think) to reproduce a lightprobe image with LW lights. I'll look into this.

I'm trying not to use the refraction blurring options as I don't want to use to many processor intensive options if I can get away with it (it's also annoying that you can't apply a texture to this option in LW :()Your micro bump method works very well, but can't quite blur things enough. I think the only way to do it is SSS. It's an interesting thing actually, refraction blurring is just a moderate SSS effect, there's a kind of grey area when you need so much blurring that SSS is the actual effect you're looking for.

gerardo
01 January 2006, 11:52 PM
The polys are double sided, so seperating them will not be possible. The object itself is quite thick in that area, so I though the SSS would pick this up. I've tried messing about with the falloff distance, but it has little effect in this thick part. It behaves quite strangely.
I was considering adding another disc shaped thick object in that area and applying SSS to it to make the light scattering more prominent there.

I'm not referring to separate the air polys, I'm referring to separate these polygons:

Yeah, I really noticed this when I turned radiosity on. There is a technique (that uses luxigons I think) to reproduce a lightprobe image with LW lights. I'll look into this.

Yes, if you want to use a dome light, you may want to try with AmbImage or lightgen (there is a nice plugin by TAIS that looks excelent for this too, but he hasn't released it yet)

I'm trying not to use the refraction blurring options as I don't want to use to many processor intensive options if I can get away with it (it's also annoying that you can't apply a texture to this option in LW :()

I'm not referring precisely to LW refraction blurring, but rather to accomplish that effect with other methods or tools. ie: You can modify this effect with a bitmap, procedural or gradient using Carpaint2 (but it doesn't work with LW 8.5, I think)

Your micro bump method works very well, but can't quite blur things enough. I think the only way to do it is SSS. It's an interesting thing actually, refraction blurring is just a moderate SSS effect, ...

The micro-bump trick works too as you mention, if you need a more blurred effect, mix it with an envelope in your micro-texture on bump channel, if you need even more blurred effect, add other envelope in your refraction Index, remember you can use texture functionality to increase the refraction index in the area in where you want more blur effect.

...there's a kind of grey area when you need so much blurring that SSS is the actual effect you're looking for.

Are you sure? I think that blurring effect is still more related with transparency and with what you can do with this channel in LW than with what you can get with scattering effect in G2. If you need EVEN more blurred effect in that area, you can apply the micro-texture used in bump channel but applied in the transparency channel (don't forget the envelope trick for this too); you may want to use an alpha to affect only that object part :)

Gerardo

CGTalk Moderation
01 January 2006, 11:52 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.

1