PDA

View Full Version : maya/MR reflection falloff


Ubersquid
09-12-2007, 03:16 PM
What I'm trying to create a mirror surface where objects are reflected less when they are further away but not blurred. Is there a way to do this?

Additionally I am looking for an easy way to make this material reflection only, i have tried the use background shader but for some reason it renders alpha correctly but no color information at all.


tia

1armedScissor
09-15-2007, 03:55 PM
Try creating a samplerInfo node & a rampTexture node. connect the "facingRatio" of the samplerInfo node to the "V co-ordinate" of the rampTexture. Use 2 colors in the ramp texture, black & white. Connect the outColor.r to the "reflectivity" of your materialShader. Then modify the ramp texture to control your falloff.

Ubersquid
09-17-2007, 05:35 PM
thanks for the suggestion, doesn't really work though because it's mostly depending on the camera angle.

what i did now is mirroring the geometry below the reflective floor and fade it out with a volume shaded cube. the problem now is, that the volume shader also fades out the background. is there a way to exclude objects from beeing affected by volume shaders?

1armedScissor
09-17-2007, 06:24 PM
The facing ratio is also based on the camera angle. To make the material reflection only, set the color & diffuse to 0, the spec to white, & teh bright part of the ramp that's driving the refelction to white.

By modifying the gradient on the ramp, you'll be able to control exactly what you need to. You can even use the same ramp to control the blur values under the mentalray tab.

1armedScissor
09-17-2007, 06:25 PM
From the maya docs regarding samplerInfo.facingRatio;

Facing Ratio gives you a number between 0 and 1 that tells you if the point being sampled is facing towards or away from the camera. A value of 1 means that it is facing the camera head-on. A value of 0 means that is is facing 90 degrees from the camera. In mathematical terms, Facing Ratio is the cosine of the angle between Ray Direction and Normal Camera.

tedious
09-18-2007, 02:10 AM
I think ooga booga is answering a different question. What he's describing is a way of setting up the Fresnel Effect. :)

I'm not sure how to get a reflection to fade with distance actually...

-tedious

1armedScissor
09-18-2007, 02:21 AM
If you use the setup I described and use these values on the ramp;

setAttr "ramp1.colorEntryList[0].color" -type double3 0 0 0 ;
setAttr "ramp1.colorEntryList[2].color" -type double3 1 1 1 ;
setAttr "ramp1.colorEntryList[2].position" 1;
setAttr "ramp1.colorEntryList[0].position" 0;

Then yes you will get a fresnel approximation. However if you modify the above values, then you can use the output as a "luminance mask" if you will to control other paramaters. Such as a shader's reflectivity.

1armedScissor
09-18-2007, 02:53 AM
Otherwise if you don't want the falloff to be camera/view dependent, then simply use the ramp by itself to control the reflectivity.

jeremybirn
09-18-2007, 07:33 AM
What I'm trying to create a mirror surface where objects are reflected less when they are further away but not blurred. Is there a way to do this?

Yes. On your reflective surface, connect a mib_amb_occlusion texture to the specular color. In the mib_amb_occlusion texture, set the bright to the distant reflection value (like black), the Dark to the near reflection value (like white), the spread to 0 if you don't want any blur, the Max Distance to the distance where you don't want to see the reflected objects anymore, and (most important!) check the "reflective" box. This will give you a surface where the reflections fade off with distance.

-jeremy

1armedScissor
09-18-2007, 01:27 PM
Alternately you could also create a distanceBetween node, and use it along with 2 locators to drive the reflectivity. It would also evaluate faster than the mib_amb_occ node

Ubersquid
09-18-2007, 01:50 PM
thanks guys, i think i got it now...

i tried jeremy's suggestion but the amb. occlusion didn't show transparencies and refractions of course, so i simply connected it to the transparency instead of the specular color of the reflective shader and it looks ok at the moment

CGTalk Moderation
09-18-2007, 01:50 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.