New Gamma Correction Tool!


#21

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


#22

Thank You man … definitely very useful!


#23

You rock! Thanks’ a bunch!


#24

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

Thanks,

Justin


#25

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.


#26

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.


#27

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.


#28

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


#29

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 :smiley:


#30

** 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. :slight_smile:

Thanks,

Justin


#31

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.


#32

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.


#33

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?


#34

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


#35

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.


#36

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


#37

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.


#38

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.


#39

Alrite mate. Just wondering were i can get the new updates from.


#40

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