[Solved] Is there a way to change the image gamma using DzTextureModifier?
Esemwy
Posts: 578
The "Image Editor" has the ability to read and edit image gamma, so logically, so should DzTextureModifier, except I can't find a method or property that allows me to do so. Has anybody figured out how to do this?
Post edited by Esemwy on
Comments
This is definitely possible. I wrote the following code snippets prior to being aware of documentation for some of what is used. I just used a method similar to Rob's self_discovery script to find methods and variables, then tried using them in obvious ways.
I believe Rob has documented some of what I used since then and you might find documentation here.
I found the texture maps and DzTextureModifiers by examining properties of a material. I did this in a loop, iterating over the return from DzMaterial.getPropertyList().
Later in my code when I'm editing the values, I use the following code.
It has been quite awhile since I wrote the script that this code is from. I believe "texs" is the array I built in the first code block (called props there). So, "texMod" is a DzFloatColorProperty, DzFloatProperty or a DzColorProperty. The gamma doesn't/didn't actually use the DzTextureModifier object, perhaps because gamma is used by both 3Delight and Iray, while the other properties in the DzTextureModifier object only apply for Iray.
So, if you really only want to set the gamma, you can actually do that on a DzColorProperty using get/setDefaultMapGamma or you can do it on a DzTexture using get/setGamma. I'm not sure what the difference is, one might be only associated with the property and the other with the texture. The DzTextureModifier is definitely only associated with the property.
You're entirely correct. I did not need the DzTextureModifier after all. Calling DzNumericProperty::getMapValue() returns a DzTexture on which I can call setGamma(). I was led astray by the fact that the other properties in the "Image Editor" dialog are controlled by the DzTextureModifier.
Thanks!
Can you please share that code of what you have done to solve this "problem"? I need to change the gamma & the offset too.
Thank you very much.
But how do you know which channel to set the gamma value? If you want only the Base Color? Or if you want only the Translucency Color?
I posted a script in the substance painter discussion a while back. I think it should have all the elements you’re looking for.
https://www.daz3d.com/forums/discussion/comment/1940251/#Comment_1940251