PDA

View Full Version : New Gamma Correction Tool!


Redsand1080
07-07-2010, 07:39 PM
***** ATTENTION *****

I just moved this script to Creative Crash because it's easier to manage and keep track of there.

Here is the link to the script on Creative Crash:

http://www.creativecrash.com/maya/downloads/scripts-plugins/lighting/c/jjj_gammatools


NEW - v2.0 features Vray support!


********************************

I just finished up the first part of a set of tools I'm writing to help myself automate some annoying tasks in Maya related to Linear Workflows and such. The first of these tools is a gamma correction tool. I thought I'd share it here since I often see others asking for such a tool. There are some other nice gamma correction tools out there, but this one does some neat things that I like. Following are a list of the key features that make this one kind of nifty:

*********************************************************************
KEY FEATURES:

1) Ability to choose either gammaCorrect OR mipGammaGain node.

2) Supports automated gamma correction of COLOR SWATCHES in ONE CLICK!!

3) Allows you to choose a mode of operation:

For instance, if you ONLY want to gamma correct inputs that have file textures
attached but NOT any of your color swatches, you can do that!
OR...if you only want to gamma correct inputs that are color swatches but leave
your file textures untouched, you can do that too!
OR...if you want to gamma correct BOTH color swatches AND file texutres at the
exact same time...you can do that as well!!

4) Fully supports the following mental ray shaders:
1) mia_material (all versions)
2) car_paint_phen (all versions)
3) mi_metallic_paint (all versions)
4) miss_fast_skin_shader (all versions)

5) Special 'Direct Select' mode for handling special case scenarios. (described below)

6) Allows you to undo gamma correction operations and restores
all connections and color swatches back to normal!

7) Automatically turns off 'screen composite' on your miss_fast_skin_shaders when you
gamma correct them (one less annoying button to remember to click...I like that)!

8) Gamma corrects the translucency color of the mia_material IF that attribute is turned on!

**********************************************************************

Eventually I'm sure the guys at Autodesk will have this linear workflow issue nailed down in 2011 and there will be no need for such tools. But for now I still use 2008 and do things old school. Just in case anyone else out there still likes to do things old-school I thought I'd try and help out and share. :)

I'm still developing this set of tools so if anyone has suggestions on the UI or functionality I'm all ears. I'll try and incorporate any suggestions if it makes things easier. I like easy. Also, as I continue to develop the rest of the tools I'll keep updating this post with the latest version and features just in case anyone would like to use them.

I've tested the heck out of this thing and it should not break any of your connections. But just to be safe, go ahead and test on a test scene first to make sure and let me know of any bugs.

Let me know if it helps!

TinyCerebellum
07-08-2010, 04:47 AM
Very nice! I've just tested it and it works great. I'll be using this one from now on :).

PS: It also needs to affect light colours as well.

jasonhuang1115
07-08-2010, 04:54 AM
Great job. Justin!!! Will test it for sure. :thumbsup:

Redsand1080
07-08-2010, 05:41 AM
@jasonhuang1115: Thanks Jason! Look forward to the feedback! :)

@TinyCerebellum: Thanks much for the positive feedback. I know I definitely like the features...which is the only reason I wrote it. I just got tired of constantly finding situations where I had to do things manually. I wanted something fully automated for my particular way of working. Glad others can benefit from it as well. :) Please elaborate on what you mean by 'light colors' and I'll work it in. Which are the shaders that have light colors and name a couple of the attrs that you would describe as 'light colors.' Thanks!

-Justin

TinyCerebellum
07-08-2010, 03:03 PM
I just mean the colour swatch for light objects (spot, point, directional, area, ambient, etc.). There are a number of colour swatches all over the place, in many other nodes too. However, lights get used almost as often as shaders. One other node that I can think of off the top of my head is the physical sun and sky node, with the ground and night colours, but it's not a huge deal.

Again, great job!

TaKIKO
07-08-2010, 03:34 PM
Just curious to know why you have a ramp plug into the value of the gamma node when correcting the swatch colors.

Redsand1080
07-08-2010, 03:57 PM
Just curious to know why you have a ramp plug into the value of the gamma node when correcting the swatch colors.

It's the only way I could think of to easily gamma correct my color swatches. It's just a work-a-round really...kind of a 'cheat' I guess. It was something I was doing manually for the longest time but just wanted it automated.

I thought about setting it up so that it would take the values in your color swatches and divide them all by .454 for you. There would be no need for an extra ramp node and gamma node in that case. But there were some immediate problems with that idea that I did not like for my particular way of working. Say I found the color I liked and then divided it by .454. Then I decided that color was just a little bit too saturated and I just wanted nudge the sat a little bit. Well, since I divided it by .454 it's not the same color anymore...so I can't just reduce that sat by .1 or whatever, I've got to go and re-make that color, reduce the sat, and then divide by .454 again. That's kind of annoying to me. But if I just store that color value in a ramp node and insert the gamma node between I can easily go back to that ramp node and change my original color.

There might be some more clever way to do it and I'm open to any ideas...it was just the first thing I thought of and fairly easy to implement so I just went with it. :)

So yea...in the end...it's just a cheat. If you have some clever ideas I'm all ears though!

Redsand1080
07-08-2010, 04:03 PM
I just mean the colour swatch for light objects (spot, point, directional, area, ambient, etc.). There are a number of colour swatches all over the place, in many other nodes too. However, lights get used almost as often as shaders. One other node that I can think of off the top of my head is the physical sun and sky node, with the ground and night colours, but it's not a huge deal.
Again, great job!

Thanks a lot! Glad you dig it. To be honest I've never thought about gamma correcting my light shaders. I've never heard of anyone gamma correcting light shaders before. Is that really a valid thing to do? The point about the MR Sun and Sky is an awesome idea though! I'm definitely going to include that now that you mention it. :)

JohnPetrucci
07-08-2010, 04:55 PM
Thanks a lot. Does it work with maya 2008??
I'm going to test it now!

TinyCerebellum
07-08-2010, 05:01 PM
Actually, TaKIKO raises a good point. Normally we just change the colour swatch of the Value attribute in the gamma correct node, rather than plug in something like the ramp node into it. We can always go back and change that swatch the same way you'd do it in the ramp. The ramp is really not needed in this case, and perhaps it adds unnecessary computation time in most cases.

Regarding light objects, in my experience I found that gamma correcting the colour swatch makes a significant difference in getting a more predictable result.

I've also found a few things missing:
1: For attributes with an existing connection (such as an existing 2D texture-type node like ramp or noise), your tool does not update the connection by inserting the gamma correct node in between.

2.For the mia_material_x, the tool does not insert a gamma_correct node for the reflection, refraction, translucence(if enabled), and additional colour attributes.

3.For the standard materials like Blinn or Phong, same as above, the tool doesn't insert gamma_correct nodes for the transparency, ambient, incandescence, specular, reflected colour swatches.

For points 2 and 3, ideally, the tool would only update those swatches if they are different from the default black or white value. However, as it stands, the tool doesn't update them with a gamma_correct at all.

Emil3d
07-08-2010, 05:04 PM
... I thought about setting it up so that it would take the values in your color swatches and divide them all by .454 for you. There would be no need for an extra ramp node and gamma node in that case. ....:) I haven't check your script yet but if the calculations in it are based on dividing the RGB values by .454, this is wrong. The correct way is to use Gamma Correct node and change the values to 0.4545.

Applying gamma of 2.2 is taking the RGB values to the power of 2.2 which is not division.

Redsand1080
07-08-2010, 06:20 PM
I haven't check your script yet but if the calculations in it are based on dividing the RGB values by .454, this is wrong. The correct way is to use Gamma Correct node and change the values to 0.4545.

Applying gamma of 2.2 is taking the RGB values to the power of 2.2 which is not division.

Oops...I misspoke! You are right. My apologies. I meant _multiply_ by .454...not divide.

So basically a shade of grey = 0.5, 0.5, 0.5 turns into 0.227, 0.227, 0.227 with a gamma correction of .454. That should be correct.

Redsand1080
07-08-2010, 06:40 PM
Actually, TaKIKO raises a good point. Normally we just change the colour swatch of the Value attribute in the gamma correct node, rather than plug in something like the ramp node into it. We can always go back and change that swatch the same way you'd do it in the ramp. The ramp is really not needed in this case, and perhaps it adds unnecessary computation time in most cases.

That is an excellent point. Man, I should have done that to begin with. I totally agree with both you. My current method is redundant. I'm going to change that in the next couple days.


Regarding light objects, in my experience I found that gamma correcting the colour swatch makes a significant difference in getting a more predictable result.

I'll check up on this to be sure. If that is a valid point I will definitely implement that as well. Thanks for bringing it to my attention. :)


I've also found a few things missing:
1: For attributes with an existing connection (such as an existing 2D texture-type node like ramp or noise), your tool does not update the connection by inserting the gamma correct node in between.

You are totally right. That is what the 'direct select' mode is for. It's a work-a-round for that scenario. I wrote about that in the little readMe file. I learned quite a bit about MEL as I was writing this and I now know I can extend the functionality to cover this scenario, so I'll work on that as well. :)



2.For the mia_material_x, the tool does not insert a gamma_correct node for the reflection, refraction, translucence(if enabled), and additional colour attributes.

It really should work for the translucency color if it's enabled. It works for me just fine. I didn't do those other 2 because I asked Zap about gamma correcting those a while back and I'm pretty sure he said sometimes you may want to and sometimes not. I'll double check on that to be sure and if he says they should always be gamma corrected I'll make sure and add that.


3.For the standard materials like Blinn or Phong, same as above, the tool doesn't insert gamma_correct nodes for the transparency, ambient, incandescence, specular, reflected colour swatches.

The only thing you are supposed to gamma correct out of all of those is the color attr. Never gamma correct your transparency or your specular. Perhaps the ambient, incandescence, and reflected color should be gamma corrected. I'll be honest and say I'm not 100% sure about that. I thought not, but I could be wrong. If anyone can confirm I'll add that as well. I'll ask Zap about that also.


For points 2 and 3, ideally, the tool would only update those swatches if they are different from the default black or white value. However, as it stands, the tool doesn't update them with a gamma_correct at all.

The translucency slot, if it is enabled, really should get gamma corrected. It works fine both on my computer at home, and also on my computer at work. Not sure what the deal is there. Can you confirm that if you click the check box 'Use Translucency' that the 'Color' box does not get updated correctly?

Thanks for the great feedback. This will help me to make this tool much better.

Redsand1080
07-08-2010, 06:43 PM
Thanks a lot. Does it work with maya 2008??
I'm going to test it now!

Yes it works great on 2008. I have 2010 at home and 2008 at work and always bring it in and test it out here at work.

TinyCerebellum
07-08-2010, 06:52 PM
The cases that you're talking about, when the gamma correction probably shouldn't apply is when dealing with greyscale values only, such as a bump texture. However, as soon as the saturation is greater than 0, the situation changes.

I also tested the translucency for the mia_material, and it does indeed work. My mistake.

Redsand1080
07-08-2010, 09:54 PM
The cases that you're talking about, when the gamma correction probably shouldn't apply is when dealing with greyscale values only, such as a bump texture. However, as soon as the saturation is greater than 0, the situation changes.


Thanks a lot for that info. I learned something new. That's awesome. I'm going to work on implementing these new features. I think I can actually improve quite a bit the code I've written so a bunch of stuff will probably be re-written, stream-lined, and made a little neater to make these new features possible.

I really want this tool to solve all of our gamma correction needs. It is such an important operation and it would save me, and I'm sure a bunch of others, a lot of time if there was one tool that solved all of the problems quickly, and easily. I'll be working on making this tool do just that. Your feedback has been quite helpful in helping me do that.

Redsand1080
07-12-2010, 03:52 AM
I just updated the gammaTools to v1.1 based on the excellent feedback from TinyCerebellum, and TaKIKO. Thanks guys for the great ideas! I'm currently working on implementing support for ambient color, incandescence, etc. for relevant shaders if the values are anything other than pure black or white. Same deal with light shaders. The new version is at the beginning of the thread in the same place as the old one...I just deleted the old file and uploaded the new one.

***Updates***

1) Color swatch values no longer stored in ramp nodes.
They are now stored in gamma nodes instead.
2) Flake color on mi_car_paint_phen now supported.
3) Refraction and reflection color at max distance
now supported for all mia_materials (if enabled).
4) Mia Physical Sky now supported.

I did some thorough testing on this version of the tool as well, but haven't been able to test it on 2008 yet. So if you want to use it on a project, please just run a couple tests on a dummy scene to make sure no connections are broken.

I will try to implement any suggestions or features you would like to see.

Thanks,

Justin

TinyCerebellum
07-12-2010, 02:31 PM
Thank you for the update, Redsand.

jasonhuang1115
07-12-2010, 05:30 PM
Thanks for the hard work, Justin.

I noticed a thread a while back where they discussed a final list of which slots of the mia_material should be gamma corrected. Check the page 2 for the conclusion. (the thread (http://forums.cgsociety.org/showthread.php?f=87&t=809879)) I cannot guarantee the accuracy of the conclusion as I have not dived that deep on this yet, but it looks promising in a glimpse though. Maybe you've already being there, but I think it will not hurt to bring it up.

cheers,
Jason H.

Redsand1080
07-12-2010, 07:50 PM
Thanks for the hard work, Justin.

I noticed a thread a while back where they discussed a final list of which slots of the mia_material should be gamma corrected. Check the page 2 for the conclusion. (the thread (http://forums.cgsociety.org/showthread.php?f=87&t=809879)) I cannot guarantee the accuracy of the conclusion as I have not dived that deep on this yet, but it looks promising in a glimpse though. Maybe you've already being there, but I think it will not hurt to bring it up.

cheers,
Jason H.

Thanks for the link Jason! The final one posted in that thread is the exact guide I used as the basis for the script. Seems I once again forgot about additional color, I'll have to add that. I've never seen that original thread, though. I got that image off a post over on the mental images forum. So thanks for the heads up. Good to know djx had a hand in coming up with that final list, he is extremely knowledgeable on the subject.

Let me know of any bugs or hiccups which I haven't been able to reproduce myself!

Thanks,

Justin

Redsand1080
07-17-2010, 11:27 PM
******* Updated to v1.2 ******

Key Features:

1) Swatches will not be gamma corrected UNLESS they are
NOT pure black or white. Gets rid of useless gamma
nodes in the hypershade.
2) `Additional color` now supported on all mia_materials.
3) Ambient color, incandescence, specular color, reflected color
now supported for maya shaders.
4) Bug fix for mental ray shaders: previously if you inserted
a mip_gamma_gain by hand in between a file tex and a shader and
tried to undo with the script it would throw an error.
5) Bug fix: 'Update All' & 'UNDO for All' won't throw an error or warning.
6) Previously ONLY file textures and color swatches were supported.
Now any kind of node connected to a valid input will receive gamma
correction. i.e. 2d procedurals, 3d procedurals, etc.
7) Advanced shader setups now possible:
It attempts to be smart and NOT gamma correct things like materials,
mia_light_surfaces, amb_occlusion, etc. connected to shaders like mia_materials.
So if you're doing an advanced set-up with a mia_material that has
a misss_fast_skin or mia_light_surface plugged into 'additional color',
that connection won't be gamma corrected.
8) Screen composite set back to 1 on UNDO for misss_fast_skin shaders.
9) Extra 'A' connection for mental ray shaders and mip_gamma_gain now handled correctly
10) Support for maya light shaders.

Every feature suggested in this thread has now been implemented. This is the most stable version of the script yet. I went back and fixed a bunch of bugs in the previous version. I haven't been able to get this version to throw an error or warning under any circumstance.

Thanks for all the great suggestions. I think they went a long way to making this a full-featured and comprehensive tool. If you think of any more features you'd like to see handled just let me know and I'm sure I can work them in. Or if you run into any bugs let me know about those as well and I'll see if I can reproduce them and fix them.

Thanks,

Justin

SePu
07-18-2010, 02:49 AM
Thank You man .... definitely very useful!

TinyCerebellum
07-18-2010, 04:56 AM
You rock! Thanks' a bunch!

Redsand1080
07-19-2010, 02:23 PM
Not a problem at all! Let me know if I missed anything, or if something doesn't function as expected. Your suggestions have been of great help. :)

Thanks,

Justin

TinyCerebellum
07-22-2010, 11:18 PM
Hi Redsand,

Found a small bug. Your script sets the gammaCorrect node correctly to 0.454, but the mip_gamma_gain nodes are set to 2.2 by default instead of 0.454.

chuckie7413
07-23-2010, 12:10 AM
this is because the mip_gamma_gain value works in reverse to the maya gammaCorrect node. In the mip_gamma_gain you declare what the the gamma value of the texture already has baked in.

TinyCerebellum
07-23-2010, 12:28 AM
Good point, except that he has set the Reverse checkbox off when the script creates the nodes, which makes the 2.2 value the opposite of what we need. He can fix it either way.

Redsand1080
07-23-2010, 02:46 AM
Thanks for the catch! Can't believe I forgot that. I've been doing so much scripting lately I haven't actually gotten to use it on anything yet...so I didn't catch it myself. I just updated it to v1.2.1 and fixed it! Let me know if you notice anything else.

Thanks,

Justin

GecT
07-23-2010, 10:44 PM
Hey Justin,

I gave your script a go and it doesn't seem to update shaders it already processed. I had it de-gamma a blue colored mia_matx and then after I changed the refl color and ran it again, got nada. I like the interface, its simple and right to the point.

I'm almost done scripting my own but figured I try yours anyways and give some feedback :D

Redsand1080
07-24-2010, 12:03 AM
Hey Justin,

I gave your script a go and it doesn't seem to update shaders it already processed. I had it de-gamma a blue colored mia_matx and then after I changed the refl color and ran it again, got nada. I like the interface, its simple and right to the point.

I'm almost done scripting my own but figured I try yours anyways and give some feedback :D

** Edit **
I just thought about it didn't really click that you said 'reflection color' on the mia_material_x. I don't have it set up to gamma correct that one. There was some discussion on another thread here at CGTalk (Jason posted a link to it on this page towards the top) where the concensus was the 'reflection color' on the mia_material should not be gamma corrected. The rationale made sense to me so I went with that approach.


Really like your blog by the way! We worked on the alpha issue with the mib_color_mix a while back. I still use that approach. :)

Thanks,

Justin

jasonhuang1115
07-24-2010, 12:19 AM
Thank you all and Keep up the great work guys. (the PMM tool looks sexy too).

Justin: I am gonna switch gear back to rendering soon and will test your script for sure.....

cheers,
Jason H.

GecT
07-24-2010, 01:54 AM
Thank you Jason :).

Justin, I just read that thread, I never applied the 50% logic to the refl color , it makes sense though. The refraction color however, is visibly amplified so yeah it makes sense to leave that alone.

volderette
10-31-2010, 09:35 PM
Your tool is really a great help for quickly setting up a linear workflow. Do i still have to connect a lens shader to the camera to color corrected preview?

Redsand1080
10-31-2010, 09:59 PM
Your tool is really a great help for quickly setting up a linear workflow. Do i still have to connect a lens shader to the camera to color corrected preview?

Glad it's helped you out. Yea you still need to connect a lens shader and do everything you would normally do in your work flow to get the proper result. This tool doesn't do anything other than help manage the gamma correct nodes.

-Justin

volderette
11-17-2010, 05:38 PM
Sometimes when i hit "UNDO for All Shaders" it confuses the textures of different materials. The materials are still on the right geometry but the textures are the wrong ones.
Maybe its because i have pretty long names for my shaders, but im not sure about that.

Redsand1080
11-17-2010, 11:04 PM
Sometimes when i hit "UNDO for All Shaders" it confuses the textures of different materials. The materials are still on the right geometry but the textures are the wrong ones.
Maybe its because i have pretty long names for my shaders, but im not sure about that.

Can you give me a list of all the shaders in your scene and I'll see if I can reproduce the error. I should clarify and say the shader types, i.e. blinn, phong, phongE, mia_material_x, etc. I tested the heck out of the latest version and was pretty sure I worked all those bugs out. Hard to test every conceivable situation though. I have to say I haven't had that happen to me, but then again I don't often use that function in my own workflow.

Thanks for the heads up.

-Justin

volderette
11-18-2010, 12:36 PM
Thanks for the fast reply.
Im uploading a test scene right now and will send you a private message with the link to it. It's a Maya 2011 Scene, hope that will work for you?

When i fix the swapped textures by hand for this scene UNDO seems to work again pretty fine.

Redsand1080
11-18-2010, 02:07 PM
Not a problem. Thanks for uploading. If I get the same error when I use the 'undo for all shaders' I should be able to fix whatever the issue is.

Goobatastic
01-04-2011, 03:12 PM
Alrite mate. Just wondering were i can get the new updates from.

Goobatastic
01-04-2011, 03:33 PM
Hi Redsand.

Where do i find your most up to date version of the script.

Shout out to everyone. This gamma correction stuff is hurting my brain and im trying to think of the exact workflow i need to use it effectively. Would someone beable to breakdown a workflow using Maya , Photoshop, Zbrush, and Mental Ray. Thanks again guys

Redsand1080
01-06-2011, 07:49 PM
Where do i find your most up to date version of the script.


The most up to date version is the one on the first page of this post. I haven't had time to fix the little issue volderette pointed out yet. I promise I will fix it as soon as I get time. The issue he had should only occur pretty rarely though. So the vast majority of the time you should be good.

Kyron
01-15-2011, 11:00 PM
Just downloaded it, since I got tired of trying to figure out color management in 2011. Thanks a lot, definetely a time saver. Only bug I have found so far is the same as volderette mentioned.
If I undo shaders it sometimes changes my textures around. For example I had a record with Schubert suddenly having a wood texture on it.

Redsand1080
01-16-2011, 01:06 PM
Only bug I have found so far is the same as volderette mentioned.


I'll be fixing this one as soon as I get a free moment. Thanks for the feedback.

-Justin

lipuster
01-23-2011, 04:47 PM
Many many thanks Justin! your tool is wonderful...one more must have maya tool. Keep up the great work :)

Agitpr0p
01-25-2011, 02:27 PM
very good tool Justin, very appreciated, thanks!
I recently switched to linux x64, and when running this script the UI doesn't display correctly, just a menu saying "Gamma Correction" and nothing else. I'm using maya 2009, fedora 14.

Redsand1080
01-26-2011, 04:44 PM
very good tool Justin, very appreciated, thanks!
I recently switched to linux x64, and when running this script the UI doesn't display correctly, just a menu saying "Gamma Correction" and nothing else. I'm using maya 2009, fedora 14.

Wow...that's unfortunate! I've read in the documentation that there can be some differences between how MEL UI commands function between different operating systems. Unfortunately I have never run this script on Linux or a Mac OS. I've wanted to learn Linux for some time now...but just haven't wanted to take the time away from actually creating things to learn a new OS, so unfortunately I can't be of much help here.

I can say that the UI was written using regular old MEL UI commands...nothing fancy at all...unless you consider a form layout fancy. So I'm not totally sure what the hang-up could be. Maybe someone with more experience using MEL UI commands on Linux could shed some light.

Thanks for the heads up, though. Since quite a few people have posting here in this thread I may have to take some time and fix the 'lil bug I've been slacking on...maybe even optimize some stuff since I've learned quite a bit since I wrote this.

-Justin

Goobatastic
01-26-2011, 04:51 PM
Great tool works a treat in 2010. I would be great if it could attach the mia exposure node to the camera also saving me from forgeting. :)

volderette
01-31-2011, 09:25 PM
Any news on the swapping textures problem? I also just saw, that the Linear Workflow Toolkit is not updating textures that are connected to a mib_color_mix shader. I guess the node is used quite often, so maybe this could be part of a future update?

For the GUI problem: Im on OS X and there there are no display problems with the user interface.


Thanks,

Andi

CurtJ
02-04-2011, 11:25 AM
A useful tool.

Thanks for sharing, Justin. Much appreciated.

Tempest6x
02-04-2011, 09:21 PM
This script saved me renderings and a lot of time. Thank you for making so easy to use! :beer:

Autodesk really needs to get their act together with this stuff. Sometimes I feel like Max is easier to use because of little issues like this.

Redsand1080
02-09-2011, 02:57 AM
I just updated the tool to v1.2.2.

This release fixes the texture swapping error a number of you guys pointed out to me.

@volderette: I've tested this on your problem scene a number of times now and it works perfectly. Thanks for sending that to me as a test scene.

Sorry I've been slacking on getting this 'lil issue fixed...MEL Studio not working in 2011 kind of discouraged me from scripting in Maya a little bit. Since Digimation don't plan on ever making that tool work in 2011, I guess I'll just have to get over it. :)

I'll work on getting the mib_color_mix integrated into the tool as well. If anyone has any other suggestions or feature requests I'm all ears.

Just to be safe make sure and save a couple scenes that used to break the script as test scenes and run the script before you use it. If it works (which it should now) then you're good to go.

You can download the latest version from the front page of this thread. I deleted the old one and replaced it with the new one.

Let me know how it works out!

-Justin

cabike
02-09-2011, 05:45 AM
Just tried this out after the new update. Very cool, and very helpful. Should a gamma node be applied to the color swatch in mia_light_surface when it's piped into the additional color of an mia_material? I've just tried this on a scene where I have a couple light surfaces linked this way, and notice gamma nodes are applied to the mia_material swatches, but none to the actual mia_light_surface. Is this the correct way, or should it be corrected, and could it be applied in a future update (I would assume so, if it should be). Thanks again! Great work!

Redsand1080
02-09-2011, 01:22 PM
Should a gamma node be applied to the color swatch in mia_light_surface when it's piped into the additional color of an mia_material?

Thanks for the feedback. Really appreciate that. As far as gamma correcting a mia_light_surface shader, I specifically designed the tool to avoid gamma correcting those. Reason being I am pretty sure the calculations in that shader are already in linear space, so applying a gamma correct node would be incorrect. Same thing goes for the blackblody shader, those calculations are already in linear space, so this tool is designed to avoid those as well. I know for a fact that is the case with the blackbody, and since Master Zap wrote the mia_light_surface I'm pretty darn sure those calcuations are already linear as well. But I guess you are picking the value in a color swatch based on what looks good to your eye, so maybe I'm wrong here. I'll ask Zap and see what he had to say.

Thanks,

Justin

acc9340
02-09-2011, 11:56 PM
HI JUSTIN:

I LIKE THE IDEA OF YOUR SCRIPT BUT EVERY TIME I TRY AND HIT UPDATE ALL SHADERS I GET THIS ERROR: // Error: Unknown object type: mia_physicalsky //

IS THIS ONLY A MAYA 2011 THING OR AM I MISSING SOMETHING HERE? I GET THE GUI TO LAUNCH, BUT IT DOESN'T WORK

HELP???

ACC

acc9340
02-09-2011, 11:58 PM
Ha Ha,

Justin, It Works Fine. Turns Out Mental Turned Itself Off. Whoops. Silly Plug-in Manager...

All Is Copacetic

Redsand1080
02-10-2011, 01:10 AM
Ha Ha,

Justin, It Works Fine. Turns Out Mental Turned Itself Off. Whoops. Silly Plug-in Manager...

All Is Copacetic

Not a problem at all. Thanks for letting me know all is working well in the end. Maya can act in strange ways on occasion. :)

Perhaps I'll put a catch in there for this and have the script give you a warning if mental ray isn't loaded instead of having it throw an error when you go to run it. Never thought about that but it's not a bad idea.

If you happen to notice anything let me know.

Thanks,

Justin

asinn
02-10-2011, 01:07 PM
heelo there, im kinda new here.. how to use this script? am i have to copy the mel into somewhere?

btw, thx Redsand

Keep up the good work! =)

Redsand1080
02-10-2011, 03:06 PM
Not a problem. You just copy that script to your local scripts directory.

A path example is as follows:

C:\Documents and Settings\yourname\My Documents\maya\2008\scripts

After that simply type the name of the file into the command line in maya: jjj_gammaTools;

You can middle mouse drag jjj_gammaTools; from the command line to your shelf to make a shortcut.

Hope that helps!

-Justin

asinn
02-10-2011, 06:05 PM
Not a problem. You just copy that script to your local scripts directory.

A path example is as follows:

C:\Documents and Settings\yourname\My Documents\maya\2008\scripts

After that simply type the name of the file into the command line in maya: jjj_gammaTools;

You can middle mouse drag jjj_gammaTools; from the command line to your shelf to make a shortcut.

Hope that helps!

-Justin

ok, thx justin =)

Redsand1080
02-11-2011, 01:11 AM
***Updated to v1.2.3***

This update adds support for the mib_color_mix node.

The cool thing is the script will not gamma correct any shaders you plug into the mib_color_mix node. It's smart enough to leave those connections alone and only gamma correct color swatches, file textures, 2d or 3d procedurals, etc. So things that should get gamma corrected do, while things that shouldn't get gamma corrected (other shaders you are layering) do not. The shaders that you are layering with the mib_color_mix node will be gamma corrected themselves as usual.

Hope that helps everyone out there who likes to use this node. I know I use it quite often, but I'm always layering other shaders with it so I never thought to include it in the script. But I guess it can be pretty useful to layer textures as well.

You can download the latest version from the same place.

-Justin

volderette
02-11-2011, 10:42 AM
Thanks a lot Justin,

I was testing version 1.2.2 and had no swapping texture problems anymore. Downloading 1.2.3 now.

volderette

Redsand1080
02-12-2011, 05:18 PM
Awesome. Glad it's working well now. I wasn't able to reproduce the error after the tool was updated to v1.2.2 so it should be good to go. Hopefully adding support for the mib_color_mix will help some people out as well.

One other thing I wanted to mention is that I actually added a feature to this tool that helps manage ambient occlusion for mia_materials. Part of the whole 'linear workflow toolkit' idea. It allows you to adjust all ambient occlusion parameters for either a selected number of mia_materials or all of them in the scene. I wanted the exact same UI as seen on the mia_material material to function exactly the same way...I just wanted to be able to adjust a selected number of materials or all of them in the scene at the same time. I didn't expose the controls for this because after I wrote it I felt it should have an entire separate UI instead of being tacked onto the end of this one...or at least have a scroll bar. I've been too busy to go back and make the separate UI so I just left those controls hidden.

But just in case anyone is interested I thought I'd throw that out there. I can upload a separate version of the tools that has that feature exposed if anyone would like to try it.

-Justin

volderette
02-16-2011, 08:53 PM
I think i've found another error. Sometimes i get a "Error: Attribute name not recognized" when i try to undo. For now i only had this in scenes where i set some lights. I will send you a scene where the problem is reproducible.

Also I used a volume light today and there you have a ramp to set a color range. The colors of this ramp dont get gamma corrected when I try to update all shaders with your gamma tool.

Using your tool almost daily right now. Thanks a lot again.

volderette

Redsand1080
02-17-2011, 05:09 AM
Thanks for the heads up. I'll take a look and see what the deal is. Glad it's helping you out.

-Justin

Redsand1080
02-17-2011, 05:34 AM
***Updated to v.1.2.4***

That error should be fixed now. Let me know if it works out for you.

I'll support that volume light later on as well.

-Justin

volderette
02-17-2011, 09:27 AM
Wow, that was quick. Great support!

Edit:

Now with 1.2.4 I get a "// Error: Unknown object type: mib_color_mix" when i try to update all shaders.

Redsand1080
02-17-2011, 08:44 PM
Now with 1.2.4 I get a "// Error: Unknown object type: mib_color_mix" when i try to update all shaders.

Just wanted to let anyone who is using the latest version know that this is caused by mental ray not being loaded in the plug-in manager. There was a typo in this post and what volderette meant to type was:

// Error: Unknown object type: mia_physicalsky //

For right now, if mental ray is not loaded and you try and run the tool it will throw an error and complain it can't find the mental ray physical sky node. Once mental ray is loaded the tool will run perfectly fine though. Its performance will not be affected at all.

This is a known issue at this point and one I will be fixing in the near future.

Thanks,

Justin

Redsand1080
02-19-2011, 07:07 PM
Fixed the bug that would throw an error if mental ray plug-in is not loaded.

I know I've been constantly updating this script as of late with minor things, and that might be kind of annoying. But I feel its important to have this bug free. So as soon as I fix a known bug I figure its best to put it out there instead of waiting.

Thanks,

Justin

Kyron
02-23-2011, 12:27 PM
You effort is much appreciated. Im curious though, as to the whole gamma correcting colors on lights. Is it only on the Maya lights and not the MR lights that needs correction?

lostparanoia
02-24-2011, 03:29 PM
Awesome tool Justin! I use it practically every day. :)

one thing that I've noticed though, is that it doesn't gamma correct the reflection color of the mia material. is there any particular reason for that?

siufa55
02-25-2011, 01:44 AM
great tool. very useful.

Redsand1080
02-25-2011, 03:29 AM
In this version I added support for the 'color range' section of the volume light and support for the mia_light_surface. The cool thing about it is that the connection from the mia_light_surface to the mia_material still will not be gamma corrected, only the color swatch of the light surface itself.

I would recommend testing this one on an old scene or two before using it. Supporting the 'color range' section of the volume light meant sorting multi compounds. I'm 99% sure it's air tight, but still, it would be a good idea to test it out. That's why I still left the old version up there. Let me know if you run into any bugs.



one thing that I've noticed though, is that it doesn't gamma correct the reflection color of the mia material. is there any particular reason for that?

Glad it's been helping you out. The reason that one isn't included is because of the information in this thread:

http://forums.cgsociety.org/showthread.php?f=87&t=809879

David's logic made sense to me, so I went with that approach.

Is it only on the Maya lights and not the MR lights that needs correction?

Well, that depends. If you have to pick the color via a color swatch, meaning the color looks right to your eye, most likely it needs to be gamma corrected. Some of the mental ray lights, like the black_body are selected based on a Kelvin color temperature measurement and are already linear. So those do not need it.

djx
02-25-2011, 10:48 AM
:blush:
Yes, I did write those things, and I probably sounded like I knew what I was writing about, but really I was discussing my take on the subject and open to other peoples reasoning. These days I try to be a bit more cautious, because what starts as a discussion (18 months ago) can end up looking like a statement of fact, and that can lead to confusion if it turns out later to be incorrect.

Short story:
My current opinion is that you should gamma correct your reflection color for a linear workflow if you want the reflection to look like the swatch.

Long story:
You can test this quickly by assigning a black mia_material_x to a sphere, and a white surface shader to a nearby cube. Set the mia reflectivity=1 and set a reflection color=128,0,0 (mid red). Make sure the mia BRDF 0 & 90 degree reflection values are 1. You should then get pure and even reflection of the white cube. Turn off the default light in render settings render options.

If you render this in maya2011 renderview with the renderView colorManagement set to ImageColorProfile=Linear and DisplayColorProfile=sRGB then you'll be rendering linear and seeing an sRGB result. (Note: no exposure nodes required).

Then if you compare the color of the rendered reflection with the mia reflection color swatch you'll find the reflection is brighter 186,0,0 (it should be 128,0,0)

Now if you hook up a gamma correct (gamma=0.455) and set the same mid red color in the gammaCorrect node and do the render again you'll see that now the reflection is exactly the same color as the swatch 128,0,0

Sorry for the long post, but I feel bad that I may have sent you (and probably many others) up the wrong path. Please test it yourself and if you disagree, please let me know.

David

Redsand1080
02-25-2011, 11:35 PM
Hey David,

Thanks a lot for the thorough reply. The topic of gamma correction in mental ray is a tricky one. I appreciate all the work you've put into helping figure out a proper work flow in mental ray over the past few years. It's unfortunate that its such a pain in mental ray for maya, but in a way I'm glad it is a pain. It's forced me to gain a serious and thorough understanding of the issue. I even took Zap's class and I still have to go back and ask him questions every now and then on the subject. It's a pain, but I end up with a much better understanding of the subject than I would have if it just worked...which it should.

I'll conduct the test that you mentioned, but I have no doubt the results will be as you say they are. I will also change the way the script works so that the reflection color will be gamma corrected as well. Zap's general advice on whether or not something should be gamma corrected can be summed up as: "The rule of thumb should be, is it a color I *see*, or a number." The reflection color is definitely a color I end up seeing in the final result, so it would make sense that it would need to be gamma corrected. The idea of the reflection having a color is one of the things that makes metal look like metal.

Thanks again, David.

-Justin

Redsand1080
02-26-2011, 03:17 AM
So I introduced a bug into the v1.3 like I thought might possibly maybe could happen. It was a small one, but it would definitely break. Anyways, it's fixed now.

PK
02-26-2011, 08:32 AM
Reading all this stuff about linear workflow and so on inspired me to the following idea...
check out my screenshot jpg.

What do you guys think if every shader had the linearize button like i did in my screenshot. :rolleyes:

I think this would make life simpler right ?

I replaced so far in the showEditor.mel the "Focus" button which noone uses anyway with the "linear on/off" button.

for now it does nothing but in couple of weeks i think i will make it happen...

http://img263.imageshack.us/img263/1066/buttonodo.png

Ekenryd
02-26-2011, 10:49 AM
That would be amazing. But! There should be a global toggle too, so if you want to go back to non-linear, you shouldnīt have to go through every material.

PK
02-27-2011, 03:36 AM
yes. You are right. There should be a global toggle. :)

I think one should combine this method with the fantastic jjj_gammatools. :thumbsup:

I hacked Justins jjj_gammaTools (hope you are ok with that ;) ) and implemented it into the Maya Interface quickly (while my girlfriend was having a nap besides me); that means its not perfect or final.

Check the script out . You can place into your documents/maya/script folder. :)


showEditor.mel (http://peterkober.com/showEditor.mel)


;)

Redsand1080
02-27-2011, 04:23 PM
@PK: Nice idea. I like it.

After reading David's thoughts on what should and should not be gamma corrected and mulling over Zap's general rule of thumb, I've added support for additional attrs for certain nodes.

1) mia_materials: reflection color, refraction color, and the 2 ambient occlusion colors.

2) misss_fast_shaders: overall color, and the different kinds of specular colors where applicable.

The reason I added the ambient occlusion colors is because they are colors you see in the final render. They are not numbers. So if they are colors you actually see, they need gamma correction. If anyone disagrees, I would be interested to hear why and am open to suggestions.

I also made some _slight_ speed improvements. Honestly it's so slight it probably won't even be noticeable since it works darn fast anyways. I did it just for the heck of it. :cool:

No bugs should be introduced. I couldn't produce any. But if you run into one let me know and I'll fix it.

Thanks,

Justin

bigbossfr
02-27-2011, 05:11 PM
deeX shaders have a gamma button on all shaders :thumbsup:
But it is just for *_x mentalRay shaders.

http://img413.imageshack.us/img413/9663/deexmiamaterial.jpg

Redsand1080
02-27-2011, 05:28 PM
Yea, your shaders are bad ass. They work great. I use them quite frequently. But sometimes I don't use them so then a generalized solution to the gamma problem is nice. :)

PK
02-27-2011, 08:37 PM
Redsand,

cool you like my idea. I have updated the showEditor.mel script with your newest release.
I improved it a bit further to make it less buggy.

I will improve the maya interface implementation over time now. :)
Hope you dont mind if I use your script as a base for it.

Anyway, thanks for your great script. ;)

showEditor.mel (right click save) (http://www.peterkober.com/showEditor.mel)

http://peterkober.com/beforeAfter.jpg



:bounce:

Kyron
03-10-2011, 10:26 PM
Once again thank you for this script Red. I have a question though, I recently tried playing around with fur to create grass and noticed that the script does not gamma correct these, is there a specific reason for this? Not a huge problem just wondering :)

Redsand1080
03-10-2011, 11:09 PM
I don't use Maya fur that much in my work so I never tested any of those shaders. I can probably add support for those if it would come in handy.

Redsand1080
03-13-2011, 07:31 PM
Fixes and feature requests added:

1) fur shaders now supported.

2) fixed an error in direct select mode where if nothing was selected an error was thrown. now it's caught with a warning.

3) added better, more informative feedback messages. should make it easier for the user to troubleshoot any problems.

4) gamma nodes will now be named according to the shader and attribute slot they are connected to. example: gamma node connected to blinn1.color will be named blinn1_color instead of gammaCorrect1 or whatever. should make it easier to figure out which node is which in the hypershade.

Let me know if you run into any bugs.

Thanks,

Justin

Kyron
03-13-2011, 08:12 PM
Woah.. That was quick. Thanks a lot for all your effort and hard work in this script :).

SePu
03-14-2011, 02:35 AM
I found a little bug .... I cant run it with the last updated ... it gives me the following error every time that I tried to update selected materials or not even when I create a new scene it happens as well ... OSX 10.6.6 Maya 2011 SP1

Error: Unknown object type: FurDescription

Redsand1080
03-14-2011, 04:50 AM
I found a little bug .... I cant run it with the last updated ... it gives me the following error every time that I tried to update selected materials or not even when I create a new scene it happens as well ... OSX 10.6.6 Maya 2011 SP1

Error: Unknown object type: FurDescription

I'll investigate and see what the deal is. Should be an easy fix.

**EDIT**

It should be fixed now. Same name and version number as before.

RagingBull
04-11-2011, 01:41 AM
I've only just discovered you had made this tool Justin !
:surprised

I'll be trying it out this week, sounds like it's working well :cool:

Ekenryd
05-04-2011, 12:36 PM
A question:

Your script does not apply gamma correction if the color is black/white. Doesnīt this lead to inconsistencies? For example, if I have a texture map where certain parts have a value of 0 or 255, those wont look the same as when I use a color swatch with 0 or 255, because that swatch wont be gamma corrected, like the texture. If this is correct, wouldnīt it be better to just apply a correction node, even with values of 0 and 255?

earlyworm
05-05-2011, 02:30 PM
For example, if I have a texture map where certain parts have a value of 0 or 255, those wont look the same as when I use a color swatch with 0 or 255, because that swatch wont be gamma corrected, like the texture.

Gamma corrections don't affect the black (0.0) or white (1.0) point of an image. If you open up Photoshop paint a bit of black (0) and white (255) paint and then apply a gamma correction to it, the black and white values won't change.

So ultimately it makes no difference if you add a gamma correction to a constant colour which is either pure black or pure white.

TheNeverman
05-05-2011, 02:45 PM
ditto...
observe the following.

Pure black and pure white values aren't going to shift, it's the middle values that will change the most.

http://upload.wikimedia.org/wikipedia/commons/5/5a/Gamma06_600.png

Ekenryd
05-05-2011, 10:30 PM
Aha, I see, cool :)

GabrieleConsolini
06-30-2011, 01:09 PM
Thank you, this is really helpfull

stallion151
07-05-2011, 05:55 AM
great stuff! using this script so much!
is it possible to get a version that handles utility nodes as the colour input?
eg a blendColors node or anything else?

Redsand1080
07-12-2011, 04:37 PM
great stuff! using this script so much!
is it possible to get a version that handles utility nodes as the colour input?
eg a blendColors node or anything else?

Glad it has been helping you out. There is a way to do just that. That is what the direct select mode is for. It does work a little bit differently, though. Here is what you do: With the tool in direct select mode select the blend color node and hit the 'gamma correct selected' button. This will pop a gamma correct node directly after the blend color node. If you then want to remove that later, with the tool in direct select mode, just select the gamma node itself and hit the 'removed selected' button. This was my workaround to handle these sorts of situations.

I would like to point out one other thing about this script that might get overlooked and may come in handy for certain work flows. There has been some debate about the best approach to a linear work flow not just in mr for maya, but a linear work flow in general. One that is software agnostic and will work across many different applications. Some people suggest saving all file textures as linear to begin with and then not worry about managing values inside the 3D application. I think this is a great approach and makes total sense to me.

This script can assist in that sort of a workflow as well, and here's how. I built an option into the script that would allow the user to either gamma correct file textures only, or color swatches only. Over time 'color swatches' evolved into 'everything else besides file textures.' I never altered the name of the radio button to reflect this however. So if you wanted to use the workflow where you have all your file textures saved as linear, but you decided that you wanted to use procedural textures for some things, or you still needed to gamma correct your light shaders, or you wanted to do something else I haven't thought of, you can put the script in color swatches only mode and you do not have to worry about it inserting gamma correct nodes on your file textures. This way both your file textures and your procedural textures are correct.

If anyone has any thoughts or concerns I'm open to suggestions.

Thanks,

Justin

stallion151
07-19-2011, 02:23 AM
Hey Justin,

Thanks for the reply.
I was working with the script without the GUI, so it would just assign gamma nodes to all shaders and i've implemented it into another script i've written for scene setup at my work.
I have tried the direct select and that works perfectly, but yeh was hoping for an interface free method.
So i was going through the script and its quite large that I can't seem to locate where it only assigns to .outColor and ignore other inputs.
My example was blendColors node which has output of "blendNode.output" to "blinn.color."
This connection is a rgb connection too but can't for the life of my work out how to make it work automatically.

Redsand1080
12-06-2011, 02:21 AM
Just updated the script to fix a minor bug for Maya 2012. Previously certain light shaders would not receive gamma correction. That has been fixed and all lights shaders should be supported for Maya 2012.

-Justin

refract
12-07-2011, 08:49 PM
Does this work with Vray also?

Redsand1080
12-07-2011, 09:24 PM
No, unfortunately not. I would like to add support for it at some point in the future, not sure exactly when that will happen though.

-Justin

dagon1978
01-09-2012, 10:39 AM
Hello Justin, seems that today im running up a lot into your scripts ;)
i have a feature request for this one, can you add a " disconnect gamma" function (without reverting the colors)?
i can explain u why... im trying to use iray and get some decent LWF, but right now iray doesnīt recognize any gamma node (maya or mray)

thank you very much for your script, i also like a lot the ambient occlusion hidden gem ;)

best regards

mat

Redsand1080
02-01-2012, 01:38 PM
Hey Mat,

I will definitely look into making that happen. Shouldn't be much of a problem. Would you want that as a radio button, so it would be kind of like a 'mode' for one of the existing buttons, or a totally different button? A radio button seems to me like it might be the best way, take up less space in the UI.

So you found the mia_material ambient occlusion tool. :) I asked if anyone else would find it useful a while back and no one said anything so I just left it out. I use it all the time on my end, though. I thought it made the UI a little clunky without a slider and was just too lazy to implement it so I left it out. It's worked great for me though...glad you found it useful as well!

-Justin

Redsand1080
02-02-2012, 04:35 AM
Added support for the User Data shader 'mib_data_color'.

I wanted to add support for the User Data texture shader but can't get to that one just yet. But if you're using a texture you can just linerize it in Photoshop anyways. The important one for me was the color shader since that has to be linerized in Maya.

If you haven't used the User Data shaders I highly recommend them! Awesome! There is also a great script to help automate the insertion of these shaders on the mental images forum:

http://forum.mentalimages.com/showthread.php?8610-Python-scripts-for-mental-ray-advanced-production

I am planning on working on some tools to help manage these things once they are inserted into the scene. Hopefully I can get to that sooner rather than later.

Also, I moved this script to Creative Crash because it's much easier to manage there. There is a link in the original post where you previously downloaded it from.

-Justin

SePu
02-02-2012, 06:14 PM
Hey Justin,

I've been using your tool since the beginning and it works great but I've been using Vray for a few month and I love it ... but I was wondering if you are planning to make a vray version for this script ? I understand if not ....

Redsand1080
02-04-2012, 02:12 AM
I've had a few people ask me about that now. Perhaps it's time I install a trial version of Vray and get that up and running. The way I've got it set up it wouldn't be too hard to add it. Just need to find the time to make it happen. Not sure when I can get to it, but I will be looking into it in the future. I want to make some tools to compliment the ones already created on the arc forum for the user data nodes. I think a set of tools to help manage those nodes would really extend the power of the workflow possibilities they open up.

-Justin

Redsand1080
02-05-2012, 01:21 AM
Can one of you guys who is pretty familiar with Vray list the most important materials you'd like to see supported? And list them in the order of importance. Then I'll go through and add support as I am able to block out some time. But this way I'll at least get to the most important ones first. I'm going to try and block out some time tomorrow to at least start it, so if someone could get back to me before then I'll be able to start on support for Vray sooner rather than later.

Thanks!

-Justin

SePu
02-05-2012, 01:46 AM
Hey Justin,
I can name a few

Vray Mtl
Vray Car Paint Mtl
Vray Fast SSS2
Vray Light Mtl

And thank you for taking the time to do it!

Redsand1080
02-05-2012, 01:58 AM
Hey Hernan,

4 nodes isn't too bad at all. I should be able to knock that out tomorrow with no problem. Probably won't even take that long. :) Thanks for the quick response. That will be at least be a really good start for Vray support. If there are any others I can always add 'em later.

-Justin

Redsand1080
02-05-2012, 06:27 AM
Since so many people have been asking for Vray support I figured I'd go ahead and at least start adding it. I'm far from a Vray expert, so if I didn't get all the correct inputs on the materials just let me know. And if there are other shaders you'd like supported, just let me know that too.

Attention!! - I tested it and it seems to work fine, but I'd go ahead and test it on a couple old test scenes before I used it in a production scene just to be safe.

Currently 4 shaders supported:

1) Vray Material
2) Vray Car Paint Material
3) Vray Fast SSS2
4) Vray Light Material

Let me know how it works out!

-Justin

SePu
02-05-2012, 07:44 PM
Thanks Justin, I will be testing it out, let u know how it goes!

Ekenryd
02-08-2012, 09:19 AM
Very cool with vray support.

However, when I run the script in a vray scene I get "Error: Unknown object type: mib_data_color //" and no new nodes attached.

Anyone else had this problem? vray 2, maya 2011

edit: doesn't work with mr materials either any longer.

Redsand1080
02-08-2012, 01:39 PM
I'll test the new version on my work computer. It was working fine for me at home. But I think I know what the problem is. Not everyone has those user data shaders enabled. That is probably what is causing issues. I should be able to fix that pretty quick tonight.

Do you have the user data shaders enabled by any chance?

Thanks,

Justin

Ekenryd
02-08-2012, 02:43 PM
You're right, i'm at work and they are not enabled here, so I guess that's the problem :) Would be great with a fix.

Redsand1080
02-08-2012, 03:16 PM
I'll try and get to that tonight.

Thanks for the confirmation!

-Justin

Redsand1080
02-12-2012, 06:26 PM
Fixed the problem with User Data shaders. Now the script should work if you don't have them enabled. As a temporary fix I just removed support for the User Data shaders. I'll add it back in later when I get time to handle it properly. I figured it was more important to have the script working than to have that one User Data shader supported.

Let me know if it's working for you now!

Thanks,

Justin

nbreslow
05-08-2012, 07:25 PM
Hi Redsand,

First - great script, truly a time saver and very cool of you to share it/update it for everyone to use.

I had this post bookmarked for a while about linear workflow and Maya fluids - located here (http://forums.cgsociety.org/showthread.php?t=1041447) - that I wanted to run by you. Duncan has a pretty nice little procedure for correcting a fluid that could be automated. I realize it is silly to think your script could cover everything in Maya but if you ever got back to fiddling with gamma correction or made a Maya 2013 update maybe you could take a look? Just thinking out loud...personally, I look forward to the day we don't need these at all.

Thanks again,

-Nick

Redsand1080
05-08-2012, 08:19 PM
Actually that should be pretty easy to add fluids. I'm pretty sure I already have the functionality in there to handle this. I added support for ramps when I included the ramp shader a while back. So basically my script would approach this problem the way Jared suggests, not Duncan's method. As soon as I can make some time I'll add that in.

-Justin

nbreslow
05-08-2012, 08:33 PM
Yep - his method is good too! Nice, thanks a lot for even considering it.

Good stuff,

-Nick

dagon1978
05-21-2012, 09:26 AM
Hey Mat,

I will definitely look into making that happen. Shouldn't be much of a problem. Would you want that as a radio button, so it would be kind of like a 'mode' for one of the existing buttons, or a totally different button? A radio button seems to me like it might be the best way, take up less space in the UI.

So you found the mia_material ambient occlusion tool. :) I asked if anyone else would find it useful a while back and no one said anything so I just left it out. I use it all the time on my end, though. I thought it made the UI a little clunky without a slider and was just too lazy to implement it so I left it out. It's worked great for me though...glad you found it useful as well!

-Justin

a radio button would be perfect, something like "brake connections", sorry for the late answer, too busy as always :D
thank you in advance

mat

p.s.
for me the AO tool is just perfect, even without a fancy ui, itīs pretty useful ;)

Redsand1080
05-21-2012, 04:09 PM
@Dagon: Right on. As soon as I can make room for some more script writing I will make that happen. Thanks for the feedback!

@nbreslow: I'll upload the new version tonight. The crazy thing is I already implemented that behavior on my own local copy and just never uploaded it. I started having to do a bunch of sky shots with clouds and needed it to work with maya fluids. Sorry for the late posting...I've been slammed with other work and it slipped my mind!

-Justin

nbreslow
05-21-2012, 04:26 PM
No worries! Whenever you get a chance, totally understand. I have been going through the Gnomon Intro to Fluid Effects DVD in my spare time and really like some of the results I have gotten. I anticipate having to use Fluids more at work so your gamma tool is right on time. :) Thanks again, will check back.

-Nick

Redsand1080
05-22-2012, 01:49 PM
Changes:

1) Added support for maya fluids.
2) Fixed mip_gamma_gain to be classified as a utility.

As always, run it on a test scene first to make sure no new bugs were introduced in the process. I tested it on my end...but better safe than sorry. :)

-Justin

nbreslow
05-22-2012, 03:28 PM
Many thanks Justin! Just downloaded and working fine, going to test it further later today. Best gamma correction tool out there, you're the man!

-Nick

jimjunky
06-28-2012, 07:23 PM
DELETED: not relevant and possibly waffle!

Reflectivity just a multiplier of reflective colour?

p0p0
07-25-2012, 07:28 AM
justin, it seems the script will not do anything if i make changes to the default color swatches then run your script. so is it an error or i should have make any adjustment after i executed the script ?

Redsand1080
08-01-2012, 04:24 PM
Hmmmm...are you saying that if you change the color of one of the color swatches from the default color to a different color, say blue, then the script will not work? Or are you saying that after you run the script you can no longer make changes to the default color swatch?

13xbmspec
08-03-2012, 08:30 PM
Thanks so much for writing this amazing script! I've been promoting it for awhile now. :thumbsup:

Redsand1080
08-04-2012, 03:06 PM
Thanks so much for writing this amazing script! I've been promoting it for awhile now. :thumbsup:

Not a problem. :) Glad it's been helping out. Hard to believe that 2 years later we still need to use a script like this in Maya. When I first wrote it, I thought it would be rendered obsolete almost immediately by Maya's color management system. Well...I see just how wrong I was about that and I'm glad now that I decided to write it anyways.

Redsand1080
02-28-2013, 01:29 PM
Don't want this to get locked just yet since there's still a use for it. Plus I may have one more update in a little while and want to be able to let people here know about it. :)

dagon1978
02-28-2013, 02:17 PM
Don't want this to get locked just yet since there's still a use for it. Plus I may have one more update in a little while and want to be able to let people here know about it. :)
thumbs up for an update :buttrock:

nbreslow
02-28-2013, 07:42 PM
Great tool - use it all the time. Updates are appreciated, thank you for maintaining this for us!

-Nick

Redsand1080
05-21-2013, 01:16 AM
1.) Added support for MILA shaders.

Started doing basic tests where i only used color swatches and got tired of gamma correcting them real quick. lol.

I don't think I introduced any bugs but I did go mucking around a bit so it's possible. Let me know if you find any and I'll get it fixed.

Thanks!

-Justin

Redsand1080
05-21-2013, 05:08 AM
1) Fixed a bug I introduced in v2.1 that wouldn't update file textures anymore.

Anyone who downloaded the last one please re-download or your file textures won't update. Sorry about that, don't know how I missed that one. Was too hasty with my confidence in my edits. That'll learn me. :)

Hamburger
05-24-2013, 01:23 AM
Sweet tool man!

Although I notice two things.

1) It didn't seem to add a gammaCorrect node between a ramp shader and a vrayMtl (that was referenced into the scene).

2) If you press the Update all shaders twice, the whole scene gets double gamma corrected. Maybe there is a way to already detect that a gammaCorrect node has been addded so it skips over? I'm not sure.

At any rate, great tool and thanks for sharing.

Redsand1080
05-24-2013, 01:04 PM
Thanks! Glad it's helped out.

1) It didn't seem to add a gammaCorrect node between a ramp shader and a vrayMtl (that was referenced into the scene).

Interesting...that *should* work. I'll test it this weekend.

2) If you press the Update all shaders twice, the whole scene gets double gamma corrected. Maybe there is a way to already detect that a gammaCorrect node has been addded so it skips over? I'm not sure.

This should definitely not be happening. I put checks in there to prevent that. Has not been doing that on my end. If I can reproduce the problem I can find out what's wrong. But it's not doing that on my end thus far.

pollos
05-24-2013, 07:51 PM
I have just recently learned about working linearly, and I'm just wondering how relevant this tool still is. I am using 2013 and 2014, and I guess the only issue with these versions is the colour swatches, since we now have the colour management input and output profiles for textures and stuff. So basically I am asking is this tool still useful in 2013/14 for gamma correcting maya's swatches?

edit: maybe it would have been good to read some of the posts before posting. sounds like you just updated it, but my question still stands, is it only useful for maya's swatches now?

Redsand1080
05-24-2013, 10:48 PM
is it only useful for maya's swatches now?

For the most part. Depends on how you like to work. If you want to use Maya's color management then yes, you put it in 'color swatches only' mode and use it to automate the correction of all the swatches maya's color management won't correct.

Hope that helps.

-Justin

Redsand1080
05-26-2013, 03:36 PM
2) If you press the Update all shaders twice, the whole scene gets double gamma corrected. Maybe there is a way to already detect that a gammaCorrect node has been addded so it skips over? I'm not sure.


Doh! You're right. It did not used to do this but I was mucking around in parts I hadn't touched in a while, bad idea usually. One simple little mistake broke it. lol.

Thanks for pointing it out! I'll check on the Vray issue as well.

-Justin

Redsand1080
05-26-2013, 03:57 PM
Fixed the bug Hamburger pointed out that would double correct gamma nodes.

Hamburger
05-27-2013, 04:37 AM
I'll give it a crack and report back if anything else pops up. Good script. Thanks again. :beer:

pollos
05-27-2013, 03:06 PM
Been using it for a few days and aside from that double correcting bug, everything seems great. Thanks for making this!

Redsand1080
05-27-2013, 05:18 PM
Been using it for a few days and aside from that double correcting bug, everything seems great. Thanks for making this!

Not a problem. That should be fixed now. Didn't used to do that. Temporary bug I introduced changing the way a couple things worked.

Let me know if you notice anything else.

-Justin

Redsand1080
05-27-2013, 05:19 PM
I'll give it a crack and report back if anything else pops up. Good script. Thanks again. :beer:

Not a problem. Glad it's helped you out!

Still need to check on the vray thing. I don't have it installed anymore. I'll have to go get the trial again. Is that still happening for you? Seems to work with the mia just fine.

-Justin

Prodeguerriero
07-30-2013, 02:21 AM
Hey man,

I just started to tackle the whole linear workflow bit in Maya 2014 and I ended up here after some research on making my life easier while gamma correcting everything.

So, first of all, thanks a lot! I tried it whilst half way through doing everything manually on my project, and I was doing exactly the same thing, which I guess is not surprising. I do have a couple of questions/ideas for you:

1) I see that the script doesn't apply the gamma correction node if values are == 1 && == 0. Does it have some kind of threshold(as in: ignore if value >= 0,995) or is it simply for full integers?

2) While doing it by hand, for the sake of full control I added a multiply divide node with this settings:
Mode = divide
Input 1 = 1,1,1
Input 2 = 2.2, 2.2, 2.2
Then I linked the output to each gamma node's gamma input. If you do this you can always revert to uncorrected gamma swatches by simply editing the multiplyDivide node.
If you added this, it would be really appreciated :D

Cheerio and thanks again!

Prodeguerriero
07-30-2013, 02:28 PM
Damn, double post!

CGTalk Moderation
07-30-2013, 02:28 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.