PDA

View Full Version : How to setup reflection blur based on distance?



Infinite
01-27-2010, 05:45 AM
Does anyone know how to setup a node structure to blur a reflection on distance.

For example you have a glass sphere, a few centimeters away you have object A and about 2 meters away you have object B. How can you set up the node structure on a reflective model to blur object A but no so much on object B say using a gradient 0-100%. Is there a way to do this?

I have tried Gradients based on distance but this doesnt seem to work.

Danner
01-27-2010, 09:00 AM
just off the top of my head, you could add a gradient controlled bumpmap that moves fast and use motion blur to smooth it out.

probiner
01-27-2010, 09:40 AM
Edit: nevermind, captain made me see my post was obviously wrong :D

Captain Obvious
01-27-2010, 09:43 AM
Unfortunately, there is no easy way of doing that. The problem is that the renderer can't know in advance how far away the things in reflections actually are and you can't find out without ray tracing. And even when you ray trace to find out the distance, you end up with a sharp border between the different distances. The best way is to control the reflection blur through localized textures. A distance to null gradient is one easy way.

Danner
01-27-2010, 02:11 PM
seems I miss understood the question, what you want is sort of like a depth of field in the reflections. wich do work. but everything gets the depth of field effect not ony the reflected things. I guess you could do it in two passes.

Captain Obvious
01-27-2010, 02:26 PM
I guess you could do it in two passes.
Yeah, that'd probably be best. But even that would be a bit tricky. Actually getting a good blend between them if the reflections overlap could prove difficult.

BeeVee
01-27-2010, 04:38 PM
Have you read Tobian's guide on LightWiki (http://www.lightwiki.com/Optimising_Reflection_blur)?

B

Infinite
01-28-2010, 06:55 AM
Wow thanks for the replies guys, I thought there wouldn't be any.

BeeVee: Yeah I looked through that, some very interesting techniques but nothing to solve my issue.

Comping isn't really a good choice for me, for years I have always strived to get everything done in one render pass and can normally get what I need this way (apart from hair and hair shadows)

Just to give you an idea of the actual scenario:

The issue I am having an have done for years is being able to independently control reflection of certain objects in a scene. My example is based on the Cornea of an Eye picking up heavy reflection of the nose of a character. I have tried so many different things but with no joy. Gradient fall offs, Reflection image maps, Ray trace only, Spherical Map only etc

The ideal thing would be to be able to tell a reflection surface what it can reflect and what it cant, but you cant do this.

So I thought about trying a blur on distance to soften that nose reflection out but to have sharper reflections on objects further a way, although this is a real bad cheat as this doesnt happen at all in real life.

Over all reflections are an issue I guess, I want the cornea to pick up the brightest spots in a scene (but darken everything else out) like light sources, illumination polygons but not a big brightly lit nose!

Captain Obvious
01-28-2010, 10:39 AM
Well, what you can do is offset the reflections by a certain amount and modulate it by ambient occlusion. Uh, hang on and I'll try it.

Tobian
01-28-2010, 10:44 AM
I think perhaps post some example pics of what your specific problem is. It's quite possibly you've got something set up wrong, which is making your renders look wrong, rather than going down the road of trying to hack apart the renderer to do funky things!

The more complex my surfaces gets the more consistently simple I find I need to be, and when you approach things with a realistic model, you tend to need to do less ugly hacks!

What it might be is that, for example, you aren't using Fresnels properly, and using an HDR pallette. Facing Fresnels of a low number (like 1.5) have a very low reflectivity (a couple of percent) so likewise to get something to 'show' it needs to be extremely bright (several hundred percent). Once you get all the balances right, you can get really nice effects without hacking the system too heavily!

Captain Obvious
01-28-2010, 11:04 AM
There we go!

Basically, what happens in this surface is that the reflections start with an offset (controlled with the OFFSET node). So anything closer than that distance will NOT show up in the reflections of that particular surface.

Additionally, there is an ambient occlusion node firing along the reflection vector in order to make sure that you get a darkening effect where stuff shows up in the reflections. Tweak the softness of the AO node to your liking. It can also be safely disconnected from the OFFSET node if you want to tweak the range seperately.

Requires DP_Kit.

Infinite
01-28-2010, 01:00 PM
I think perhaps post some example pics of what your specific problem is. It's quite possibly you've got something set up wrong, which is making your renders look wrong, rather than going down the road of trying to hack apart the renderer to do funky things!

The more complex my surfaces gets the more consistently simple I find I need to be, and when you approach things with a realistic model, you tend to need to do less ugly hacks!

What it might be is that, for example, you aren't using Fresnels properly, and using an HDR pallette. Facing Fresnels of a low number (like 1.5) have a very low reflectivity (a couple of percent) so likewise to get something to 'show' it needs to be extremely bright (several hundred percent). Once you get all the balances right, you can get really nice effects without hacking the system too heavily!

I have some experience with setting up reflections and nodes, I have tried various lens types, cornea objects and many diffrent reflection settings. This has been an on going problem for years.

I can play around some more with the fresnel settings but I dont think this will solve the problem. My main issue is the lack of fine user control, being able to tune in and out surfaces from reflections or objects. This would solve a great many problems. It's not a massive issue but when your trying to pull of extreme realism, having a lack of control like this is a pain, even if it is just a hack. G2 has some pretty neat features but can't do what I mentioned earlier.

Here's an example, the nose shows up in the reflection just as in real world terms, it depends how bright a light source is but sometimes it can show up to much.

http://www.ir-ltd.net/uploads/eye-eye.jpg


There we go!

Basically, what happens in this surface is that the reflections start with an offset (controlled with the OFFSET node). So anything closer than that distance will NOT show up in the reflections of that particular surface.

Additionally, there is an ambient occlusion node firing along the reflection vector in order to make sure that you get a darkening effect where stuff shows up in the reflections. Tweak the softness of the AO node to your liking. It can also be safely disconnected from the OFFSET node if you want to tweak the range seperately.

Requires DP_Kit.

Thanks I will try that, although I have a feeling it wont be compatible with FPRIME?

Currently I am using a simple shader, standard Lightwave material, using a greyscale image to control the lens of the cornea with fall off on the edges, 5% blur and a Spherical Map mixed with Raytrace, some slight bump noise. That's it, I have tried much more complex node shaders with fresnel etc but its more hassle and the effects seem worse on the nose showing up.

Captain Obvious
01-28-2010, 01:59 PM
Thanks I will try that, although I have a feeling it wont be compatible with FPRIME?
I don't see why it wouldn't be. As long as the DP_Kit ambient occlusion node works in FPrime, this shader shouldn't have a problem.

However, getting it working with *materials* might be a bit tricky as it stands at the moment. Basically, what you'd need to do is stick my shader network into a 'Make Material', and plug that one into a Material Mixer based on a fresnel. That should work.

Edit: also, you could use the AO node in a mixer instead of as a multiply, and blend in a different color or shader instead of the current (black).

Infinite
01-28-2010, 02:29 PM
I don't see why it wouldn't be. As long as the DP_Kit ambient occlusion node works in FPrime, this shader shouldn't have a problem.

However, getting it working with *materials* might be a bit tricky as it stands at the moment. Basically, what you'd need to do is stick my shader network into a 'Make Material', and plug that one into a Material Mixer based on a fresnel. That should work.

Edit: also, you could use the AO node in a mixer instead of as a multiply, and blend in a different color or shader instead of the current (black).

Thanks Captain Obvious, I will try that out and see what I find. :D

Captain Obvious
01-28-2010, 04:31 PM
Basically, what my shader does is this:

serge
01-29-2010, 07:00 AM
I agree with Tobian. If you're reflection/Fresnel setup for the eye is correct, but the reflection of the nose is still too bright, then there's something not correct in the skin settings. Check the brightness of the nose in Image Viewer FP.

Infinite
01-29-2010, 10:38 AM
I agree with Tobian. If you're reflection/Fresnel setup for the eye is correct, but the reflection of the nose is still too bright, then there's something not correct in the skin settings. Check the brightness of the nose in Image Viewer FP.

In the skin settings? please explain? As far as I know the skin is fine, so are the other surfaces and light sources in the scene. All using basic settings.

It's the reflection that is the issue, or more so... lack of control.

Rabbitpenny
01-29-2010, 10:45 AM
Captain, Infinite thank you. I had used two passes/photoshop to make a dramatic corneal reflection sans nasal bridge...not convincing. Thanks for the ideas and very thoughtful discussion/explanation.

serge
01-29-2010, 12:34 PM
In the skin settings? please explain? As far as I know the skin is fine, so are the other surfaces and light sources in the scene. All using basic settings.

It's the reflection that is the issue, or more so... lack of control.
"Basic setting" filled in by Newtek doesn't mean that it's physically correct. Specularity might just be too much.

On the other hand, what you find 'incorrect' might just be physically correct. I saw your other thread about simple skin, and I see what you mean about the nose. Do some experiments. Do you have a strong flashlight? Go into your bathroom, close the lights, stand in front of the mirror, and point the flashlight at your face; this is pretty much how you lit your scene. You will find a strong reflection of the nose in your eye (I just tried :)). It does look odd because it's not a very common and dull lighting situation.

toby
01-29-2010, 05:04 PM
"Basic setting" filled in by Newtek doesn't mean that it's physically correct. Specularity might just be too much.

On the other hand, what you find 'incorrect' might just be physically correct. I saw your other thread about simple skin, and I see what you mean about the nose. Do some experiments. Do you have a strong flashlight? Go into your bathroom, close the lights, stand in front of the mirror, and point the flashlight at your face; this is pretty much how you lit your scene. You will find a strong reflection of the nose in your eye (I just tried :)). It does look odd because it's not a very common and dull lighting situation.
I agree, it seems like you're doing something unrealistic in order to make it look realistic. If it's common for the nose to be bright, then it should be visible in the eye in real life or 3d, no?

It could be that your eye surface is too reflective, rarely can you see anything reflected except light sources :

http://images.businessweek.com/ss/06/04/sb_presentations/image/eye.jpg

http://www.ergoindemand.com/images3/eye%5B1%5D.jpg

If you've increased your reflection to get highlights like these, maybe you should be increasing the brightness of the reflected object/environment instead. They should be the brighter parts of an HDR, brighter than 100% white, or they'd be barely visible in the eye.

Tobian
01-29-2010, 06:13 PM
One thing to consider, most sources I read state the eye/lens/vitrious humour has an IOR of between 1.34-1.41, which is quite a bit lower than glass, so yeah maybe they are not properly reflecting /too much reflection. Also is your material properly 'energy conserving? Either using the 'dielectric' shader, or simply feeding the fresnels into the right inputs, either making the eye one surface, or making a 'ball' inside a 'jelly ball' which is how I've done it, in the past.. If you look at the 'preview' of an IOR of 1.34, the value is almost imperceptable except at the edges, so really it shouldn't be showing ANYTHING which is not in an HDR range, such 'sky' and not a 'nose' As toby's pics show.

If you don't make the material 'energy conserving (I.e. making sure the diffuse is the inverse of reflection) then the reflections are 'additive' in Lightwave, which is wrong, and would make reflections look overly bright.

Captain Obvious
01-29-2010, 06:18 PM
If you look at the 'preview' of an IOR of 1.34, the value is almost imperceptable except at the edges, so really it shouldn't be showing ANYTHING which is not in an HDR range, such 'sky' and not a 'nose' As toby's pics show.
Keep in mind, though, that realistic IOR-based fresnel effects ONLY work if you're using a gamma corrected workflow.

Tobian
01-29-2010, 06:32 PM
I sure do, and to cap it off the Fresnel node doesn't take into considerations of different polarisations which can affect the curvature of the reflection either.. Not that I would have a clue what to do with such a 'realistic' shader mind :D

Infinite
02-01-2010, 07:21 AM
One thing to consider, most sources I read state the eye/lens/vitrious humour has an IOR of between 1.34-1.41, which is quite a bit lower than glass, so yeah maybe they are not properly reflecting /too much reflection. Also is your material properly 'energy conserving? Either using the 'dielectric' shader, or simply feeding the fresnels into the right inputs, either making the eye one surface, or making a 'ball' inside a 'jelly ball' which is how I've done it, in the past.. If you look at the 'preview' of an IOR of 1.34, the value is almost imperceptable except at the edges, so really it shouldn't be showing ANYTHING which is not in an HDR range, such 'sky' and not a 'nose' As toby's pics show.

If you don't make the material 'energy conserving (I.e. making sure the diffuse is the inverse of reflection) then the reflections are 'additive' in Lightwave, which is wrong, and would make reflections look overly bright.

Tobian, thank you very much for that node setup and explanation. It really makes sense when explained that way. I will try some experiments and get back to you. The LW forums sure have changed these days, everyone are such much more friendlier and helpful.

and thanks for the other posts you guys. I can see all your points here.

I will post some results soon.

Infinite
02-01-2010, 07:24 AM
"Basic setting" filled in by Newtek doesn't mean that it's physically correct. Specularity might just be too much.

On the other hand, what you find 'incorrect' might just be physically correct. I saw your other thread about simple skin, and I see what you mean about the nose. Do some experiments. Do you have a strong flashlight? Go into your bathroom, close the lights, stand in front of the mirror, and point the flashlight at your face; this is pretty much how you lit your scene. You will find a strong reflection of the nose in your eye (I just tried :)). It does look odd because it's not a very common and dull lighting situation.

Believe me I have tried that many times, nearly blinded myself twice! :dance:

EDIT: Thanks for the ref pics btw Toby.

I think it comes down to the settings, which I will play some more with.

Damn, I wish I could get my head around this gamma corrected workflow! Especialy when using a SimpleSkin setup with lots of Image maps etc

Tobian
02-01-2010, 04:57 PM
Trouble is it is often a little more complex than that, and it has to be said that yes, Fresnel reflections do work more correctly in linear, but they show MORE - and his problem is it's showing too much :)

The SG colour nodes could be a bit friendlier to use too, they are alarmingly complex looking, with poor manuals :D

Infinite
02-01-2010, 05:11 PM
get gerardos hdri mag articles.

just gamma correct the colour images .4545 in image editor or by adding a node. leave the scalar stuff alone and then gamma correct render to 2.2 afterwards. you on the beta? in LW HC it has linear workflow built in now.

alternatively use :

http://www.lightwiki.com/SG_CCTools_-_For_Color_Management_and_Linear_Workflows

btw, you use jovian yeah?

http://www.joviancolorpicker.com/


Hey chunderburger, I will look into that, No I havent used Jovian before, it looks quite fancy. I think I must be stuck in the dark ages what with all these new toys, plugins and tips! The lW forums are just full of information and really helpful people. It's ace. Thanks :thumbsup:



Trouble is it is often a little more complex than that, and it has to be said that yes, Fresnel reflections do work more correctly in linear, but they show MORE - and his problem is it's showing too much :)

The SG colour nodes could be a bit friendlier to use too, they are alarmingly complex looking, with poor manuals :D

Well the whole thing is enough to make my head explode, more research and testing :D

Infinite
02-02-2010, 10:15 AM
WoW!

All I can say is a big thanks chunderburger, you have really helped open my eyes to some great stuff http://www.hdrlabs.com/ is like a treasure trove of goodies and is just rammed full of plug-ins toys and information. From this I got a link here - http://www.hdrsource.com/store/ just full of great HDR images and sIBL libraries. Pretty much plug and play.

Thanks for pointing me in the right direction and those other links are very helpful indeed.

All of this from a support thread on eye reflections. Brilliant! This thread has helped solve the original issue I was having. I will post some results soon.