Tutorial: Strong Glares using Camera Shaders
June 8th, 2008
This tutorial will show you how to add realistic lens glares to your renders using 3ds max, Mental Ray, and Photoshop. I’m going to assume that you already have a scene to use that has any bright reflections, highlights, or exposed lights.
The best glare I have been able to produce is through using Lume Tools‘ glare camera shader. This shader ships with 3ds max (I am using 3ds max 9), however, it needs to be unlocked before you can see it in the material browser.
-So let’s unlock it:
Browse to your mental ray shaders folder: “C:\Program Files\Autodesk\3ds Max 9\mentalray\shaders_standard\include”, and open “lume.mi” in notepad.exe (be sure to make a backup before editing anything). Once you have it open do a find for ‘glare’, and put a ‘#’ next to ‘hidden’. Save the file and fire up 3ds max.
I guess some people with Windows Vista are having a hard time making changes to lume.mi. A commenter posted a fix:
I solved it by saving in my User Folder, as lume.mi,
and then I cut and pasted it back into the correct folder.I don’t really know why it stops you from saving it their, but it seems you can still move files in and out.
Now open up your scene, open the render dialog box and click on the ‘output’ slot under ‘Camera Shaders’. You should see ‘Glare (lume)’ in the Material/Map Browser. If not, then go back to your ‘lume.mi’ file and make sure that glare has been unhidden correctly. Also, make sure you restarted max after editing ‘lume.mi’. Once it’s in the slot, drag and drop it into the material editor. Be sure it is instanced!
Select the material (the gray box you just instanced) and take a look at the Parameters roll-out. Set ‘Quality’ to 2, and check ‘Overlay Only’. This will take out the rendered image and only leave the glare on a black background -perfect for post-production compositing. You will also have to adjust ‘Spread’ if there aren’t any glares showing up. Spread controls how bright the glares are, however, it’s better to do this by adjusting the light intensity in your scene rather than simply amping up the spread. Now for the streaks:
To get good streaking you need to create a black, square bitmap image with white lines intersecting through the middle. These white lines will determine the look of the lens streaks. Create two separate streak bitmaps with different patterns. They will be loaded in ‘Streak Image’ (also check ‘Streaks’).
Here is the Lume’s manual on glare for more information on the parameters.
For my composite, I saved out three different glare passes. One with no streaks, which creates a nice light bloom, and two more using the streak images I created.
Also, be sure to save these glare overlays as 32-bit images (.exr, .hdr). When you bring them into Photoshop it will allow you to adjust the exposure of the glare without losing any quality. The image below shows what happens when blowing out the exposure with an 8-bit .jpg compared to a data-rich .exr. 32-bit images have a lot of extra information tucked away.
Now we’re almost ready to bring this into Photoshop. I am using CS2, however, I wish I had CS3 for this -I’ll get into why in a bit. Before leaving 3ds max, render out a pass without using any glare at all (uncheck the lens shader in the render dialog). I’ll call this the base render.
Open up the three glare passes you rendered out earlier. Adjust the exposure if necessary (Image | Adjustments | Exposure). If you are using any version of photoshop older than CS3, you will have to convert the image to 8-bit before dragging the layer on top of the base render (Image | Mode | 8bits/channel). This can be a bit of a pain, because if you don’t like the exposure, you have to return to the 32-bit image, make the adjustment, and convert back again. With CS3 you can layer up images in all their 32-bit glory and do what you like.
Drag the first streaked overlay on top of the base render and change the blending mode to ’screen’. Make a copy of this same layer and change the blending mode to ‘color dodge’. Make adjustments as necessary; change the opacity, do some subtle levels adjustments, rearrange the layers, and mess around with more blending modes. Be sure to search around flickr or google images for some reference images.
Now drag your bloom overlay into the comp. This is the one with no streaks. Again, don’t be afraid to mess around with multiple layers, blending modes, etc.
Bring in the final streak and there you have it. Questions, comments, feel free to drop a line in the comments.
6 Responses to “Tutorial: Strong Glares using Camera Shaders”
1Dejan
June 13th, 2008 @ 2:59 pm
very impressive tutorial and excelent blog
bravo!
2james
June 20th, 2008 @ 11:09 am
hello
im using 3ds max 9 on windows vista home. Im trying to unlock glare shader from you method but its not letting me save the file. Ive also tried deleting the whole line including the comma before it but still does not want to save do you know why?
much appreciated
3admin
June 20th, 2008 @ 3:09 pm
It sounds like a read/write issue. What is the exact error you’re getting? Look at the properties of the file and make sure you are allowed to write to it. I am on XP so I can’t tell you exactly where the settings will be.
4Josh
June 23rd, 2008 @ 3:26 pm
Hey,
I’m also using Vista, (32 bit) and I had the same problem.
I solved it by saving in my User Folder, as lume.mi,
and then I cut and pasted it back into the correct folder.
I don’t really know why it stops you from saving it their, but it seems you can still move files in and out.
5phil
October 12th, 2008 @ 2:06 am
Hello,
Your Interior renderings r looking realistic. In which Max version u modeling and rendering?. Do u render interior scene only from Inside? Please refer me Blogs & web sites, which r doing/ discussing Architectural rendering with MR in Max Design 2009.
6admin
October 13th, 2008 @ 4:20 pm
Phil,
I’m using 3ds max 9 (not 2009). For more info on architectural visualization, I recommend vizdepot.com
Leave a Reply