Jump to content

Particular type of reflection


DaJuice

Recommended Posts

Alright, after mucking around in VOPs for hours I think I need some help with this.

I'm trying to come up with a raytrace shader with a couple of specific properties.

1) Reflection falloff, where normals more perpendicual to the camera have little reflection, while surfaces more parallel to the camera have a lot of reflection. In max they're called fresnel reflections because it uses the fresnel forumla for the falloff.

I've tried wiring the Fresnel VOP into other VOPs but that didn't have the desired effect.

I've also tried piping the Edge Falloff VOP into the tint channel of the Shiny Metal VOP, which does the exact opposite of what I'm trying to do. Perpendicular = very reflective, parallel = hardly reflective.

Typing in negative values for the falloff parameter fails to produce a smooth gradient, like positive values do.

I've tried going into the subnets, to see if I can't change something there, but no luck. I don't know what else to do. :(

2) Second, I want to get some diffuse (blurry) raytraced reflections going.

I don't even know where to start on that one. :P

Link to comment
Share on other sites

i've done a quick test... take a look if it fits

basically, place a fresnel function, pick the blue channel (that's 3rd component of the vector) and that gives you a function to work with to modulate the reflection

Edit:

Of course I mean the blue channel from the fresnel's Reflection output.

Edit2:

Ouch sorry, forget it. just download the hip file

Link to comment
Share on other sites

  • 4 months later...

When doing fresnel() or fresnel like calculations for your reflections it's important to realize that, in most cases, these aren't general purpose, all inclusive techniques for dealing with view dependent reflections. Only when you're totally homogenous about the way you're defining your surface properties, light sources and textures will you get visually correct results. With all things CGI, even today, it's important to make the distinction between "visually correct" and "mathematically correct".

Your fresnel() function and other means to achieve view dependent reflections multiply down the contribution of a reflection based on incidence to the viewer. This is mathematically correct but it will not be visually correct if you are living in a normalized lighting space (where all your light color, surface color and texture colors exist between 0-1). This is the reason for HDRI textures because in the real world there's no such thing as normalized light.

Just taking a snapshot of the sky and using it as an environment, for example, will only give you correct results for how a picture of the sky would reflect on your surface. In this case fresnel() is still right, but the context in which it's being asked, "how much reflection should I give?" is actually wrong. I'm guessing this would be true for at least 90-95% of its use, all over the world, as I type this. So that you don't get discouraged by your results you have to take the limitations of your textures into account when planning to accomodate reflections in your shaders.

What I've done in the past (in my Renderman days), for single exposure, clamped environment textures, is generate a scaler with my angle rolloff calculation (might be able to hotwire fresnel() to do the same thing). This scaler is used to control, basically, a gamma operation on the color returned from the reflection angle and not used to actually multiply it down.

I've had shader TDs look at me with disbelief when I've explained this before, but hang in there. Gamma .5 on an image of the blue sky with a sun will give you a nearly black image with the sun still visible. This is because values in the upper range of an image aren't affected as much as the low and midrange parts of the image. These values represent parts of the image that aren't light sources and wouldn't contribute much to the reflection coming back to the eye as a surface normal becomes more coincident to the eye. BUT the sun would still contribute a LOT even at angles near coincident to the eye as would any light source or reflection of a reflection of a light source.

If you think about the math, it's not anywhere close to correct. But neither is specular() or phong() or half of what we use to make pretty pictures every day. My way gives you something that looks more correct when you're stuck in a normalized universe, usually because of the textures available to you.

Just remember that if you're stuck with normalized textures you have to be consistent with the rest of your lighting. If you were to do the above hack but have very bright objects in your scene you could get very strange results. In cases like these it might be more useful to actually "amp up" the values in your textures using a seperate texture map and scaler. The scaler would multiply by the map to tell the renderer about exponential differences in value. This map would have to be created through an image processor and/or paint program so that you could define, for example, that the sun should be much brighter than a white sign.

Is that clear as mud?

Link to comment
Share on other sites

  • 2 months later...

hah, muddy :P that expained the problem a lot, but does that mean s/he has to stick with HRDI(sp?) texture? i never touched one of those (what's wrong with low rang bitmaps anyway :P) so that's initially a problem.

personally i think there's no one all-powerful way to deal with every scenes. i have to customise lighting n texture n stuff for every scene to make them look "normal" anyway... already forgot how to complain :lol:

*waiting for free shaders to drop from the sky* B)

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...