View Full Version : Flat window shader
Bonedaddy 02-05-2004, 03:29 AM Hey all,
Been working on putting together some houses for a short CG scene I'm doing, and I'm having a devil of a time with windows. Most all the glass shader advice I see is oriented towards curved surfaces, and makes heavy use of the fresnel effect. However, as my glass is basically flat, those shaders tend to just make the windows completely transparent.
I am trying to get a good reflection of a sky image I have in these windows, and the central problem areas are thus:
1) Establishing reflectivity. I've got to incorporate the brightness of the sky (only reflect brighter parts), raytracing (won't reflect sky if something's in the way), and camera angle, and haven't been able to do that real well yet.
2) Reflection color. This has to get both raytraced objects in the scene and the sky. I know I could probably just plop a skydome in there and bake the results out into files, so not too worried about this one, but open to suggestion.
I'd go into all the approaches I've tried and failed at, but I am braindead from hacking at this thing for the past several hours. I read this site and tutorials religiously, I feel like I should know this stuff better...
|
|
leigh
02-05-2004, 03:45 AM
What software are you using?
Bonedaddy
02-05-2004, 03:47 AM
Maya 5.0, rendering in Mental Ray. Have access to Photoshop.
leigh
02-05-2004, 03:58 AM
Damn, I don't have Maya here at home, so I can't figure out a solution for you.
Incidentally, have you tried simply altering the strength of the incidence node? Even flat glass is affected by the Fresnel effect, and I would recommend using it to drive the reflections, and not necessarily the transparency (although in reality it affects transparency as well).
gerardo
02-05-2004, 05:29 AM
Perhaps be not a surfacing problem; recently, I had a problem seemed yours (in LW) with a window that was very flat and with poor reflections, and no matter how much I played with the fresnel it didn't get an interesting effect.
Why? This was because the geometry of my window was very simple (too flat); to solve it I modeled the glass of the window as a subpatch object (something like a Sub-D object in Maya?), then I surface it like any other object (shaders,subtle bumps, fresnel, etc) what improved the finish of the surface vastly and it provided pretty variations in the reflections.
I hope this helps :)
Gerardo
Bonedaddy
02-05-2004, 08:22 AM
I'm a little slow at this, so forgive me if I misinterpret a bit of what you're talking about.
I have boosted the tolerance of the fresnel effect node substantially, with little in the way of better results. Bump mapping and small flaws help, but only slightly.
Here's what I've got, basically:
- a ramp changing the reflectivity from on to off based on viewing angle (looking at it right on = low reflections, angle = high)
- same ramp affecting the transparency, so that looking at it right on = seethrough, angle = not
- a bump map to vary up the reflections, specularity
- 0 diffuse
My problem mainly is that the reflections are muddy, unclear, and ugly. I have nothing in the reflected color slot, so it should do raytracing. When up close, this works fine, as it reflects a border around the glass well. However, it will not reflect the skydome around itself very well at all, even when I set reflectivity to full blast all over the object. I believe this is because the transparency is so low.
I believe I need to keep the reflectiing color raytraced, so I've physically modeled the skydome instead of using Maya's simulation nodes.
My two problem areas boil down to:
- adjusting the amount of reflectivity so that it not only raytraces and reflects JUST the bright objects, but also takes into account the fresnel effect
- making sure that the bright reflection areas aren't transparent
A lot of these concepts are a bit hard for me to wrap my head around, so I may be missing some obvious stuff. I haven't included any refraction, as the window is single-pane and solidly built, so it wouldn't really bend the light that much.
Thanks much for all your help in advance.
EricChadwick
02-05-2004, 10:23 PM
Well, I'm using Max not Maya, but here we just add an Output map on top of the reflection end of the shader, which lets us control brightness/contrast of the reflection effect or its mask. Perhaps there's a node like this in Maya, letting you push the reflection masking effect...
Bonedaddy
02-06-2004, 02:35 AM
The way Maya shading systems are set up is that there is no raytracing node you can link up to the reflectivity or reflection color attributes. When you have any reflectivity, it will automatically raytrace the reflections, unless something else is put in the reflection color slot.
Because of this, I can't put any nodes to futz with the levels onto it. I can control how reflective everything is before raytracing, and I can control the colors if I completely eschew raytracing.
This thread (http://www.cgtalk.com/showthread.php?s=&threadid=99219&highlight=raytrace) gets at some of what I'm trying to do. There is a plugin that will blur reflections in Mental Ray available on Highend3d, and that's about the only thing I can find that will actually alter raytraced imagery in Maya. Unfortunately, the plugin is pre-compiled, so I can't look at the code and hijack it for my own nefarious ends. :P
There is also the mysterious DGS node which I just learned about, for Mental Ray, so looking around at that to see if that has anything I can use...
Bonedaddy
02-06-2004, 02:54 AM
Reading more through this, it seems like this is almost a black hole for my time. I'd love to learn all about photons and final gathering and whatnot, but this project needs to get done, and changing gears in the middle is going to make it more difficult.
I think what I will have to do, in the end, is render the reflections in a different pass and apply all level changes, blurs, etc. onto them then. Probably more efficient in any event.
gerardo
02-06-2004, 05:00 AM
Have you tested with a HDRI for your reflections? (in the skydome maybe?) This type of images commonly generates good reflections.
Gerardo
Bonedaddy
02-06-2004, 06:32 AM
Gerardo,
That is an excellent idea. I plopped one in and it looks great. I had held off on doing so for awhile because I wanted to use a LDR panorama that I'd shot, but this works so much better I can't imagine going back.
HDR solves the reflectivity problem because in reality, the sky is infinitely more bright than we perceive it. Any LDR pictures of the sky are entirely inaccurate in their representation of the sky. Any objects lit by the sun that aren't bright colors don't show up very well in reflections just because of the sharp falloff in the way reflections work... you're right.
Alright, well, I can try and mess with the luminance levels of my panorama (thus destroying the color purity and losing several hours in the process), or I can just use an HDR image. I think I'll opt for HDR.
Thanks again.
gerardo
02-06-2004, 07:20 AM
I am glad that it works! :)
In LW there is a trick to fake HDRI´s with LDR´s (from Mr. Stuart Aitken), maybe work in Maya too:
Use the LDR in the skydome
Put diffuse to 0% and map the same image to the luminosity channel.
On top of this add a gradient, in Maya in some way(i dont know), this gradient should affect the previous layer, then ramp the gradient from around 100% at the top to about 10000% at the bottom.
You will need to put in another key in the gradient (150% aprox) about 4/5ths of the way down; this will create a nonlinear ramp on the luminosity, leaving the darker areas of you're image fairly 'normal' but boosting the very brightest areas by a large amount.
This will roughly simulate the range of values in a realworld HDRI image, play about with the gradient to fine tune the results and if you can, save in an HDRI format.
I hope this help you to use your LDR panorama.
Cheers,
Gerardo
Bonedaddy
02-06-2004, 08:03 AM
That's a neat little trick, will give that a shot sometime.
Also found a Photoshop-oriented way of turning LDR to HDR off of learning-maya.com. Check it out here (http://www.3dluvr.com/intercepto/maya/tutorials/ldri_lighting/ldri_light.htm)
gerardo
02-06-2004, 08:15 AM
-----------------------------------------------------------------------------------
http://www.3dluvr.com/intercepto/maya/tutorials/ldri_lighting/ldri_light.htm
------------------------------------------------------------------------------------
Great tut!!!
It is the same principle, but more controllable
Thanks!
Gerardo
Abominable
02-06-2004, 05:08 PM
Yo bonedaddy,
Can you show us a couple shots of your glass, I've been following your thread and am curious to see (if you still have em) some shots of your first attempt and you near final results.....Thanks if you can....Cheers!
Bonedaddy
02-06-2004, 05:32 PM
Sure thing.
The rest of the house is not yet finished (no lighting, roof tiles, brown trim need some work, among others). But here you go:
This (http://scf.usc.edu/~jporath/reflection_black.jpg) is a pretty basic pass of it. It achieves what I want, which is that you can barely see through it when the sky is reflected very brightly. The area behind it is just a briefly extruded black hole, so the colors show up very well there.
Check this picture (http://scf.usc.edu/~jporath/reflection_red.jpg) out to see exactly how much the reflections affect the transparency. In that picture, I've changed the material on the inside to complete red, just to provide some contrast.
I'm happy with the results, will likely render them out in another pass and composite them on anyways, so I can tweak the reflection levels to please the director. In the end, I will have curtains in there behind the windows, thus sparing me from modeling out the inside of the house (except for the open window, which camera flies into, segueing into live action.
As always, comments and crits (even at this unfinished stage) are appreciated.
CGTalk Moderation
01-17-2006, 09:00 AM
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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.