MaxScript - Major Double GAMMA issues

MaxScript - Major Double GAMMA issues

Morne3D
Enthusiast Enthusiast
868 Views
2 Replies
Message 1 of 3

MaxScript - Major Double GAMMA issues

Morne3D
Enthusiast
Enthusiast

Hi all

I'm busy with a script, to RESET all gamma values to default. However, I'm have major intermittant issues and struggling to get to the bottom of it. Sometimes it works and simetimes it doesn't. Then suddenly, after running it a couple of times, modifying and essentially going back to the beginning, code that didn't work 5 minutes ago, suddenly works.

I'm getting double GAMMA issues, sometimes in the viewport AND in the material editor for bitmaps. Other times JUST the viewport. Then suddenly for no reason it starts to work. I tried with various different versions of Max at different offices (2014-2016), with the same results in each.

 

FreeSceneBitmaps()
gc light:true
IDisplayGamma.gamma = 2.2
IDisplayGamma.affectColorPickers = true
IDisplayGamma.affectMEdit = true
fileingamma = 2.2
IDisplayGamma.colorCorrectionPrefMode = #gamma
IDisplayGamma.colorCorrectionMode = #gamma
fileoutgamma = 2.2

I also tried using ONLY IDisplayGamma.colorCorrectionPrefMode = #gamma or only IDisplayGamma.colorCorrectionMode = #gamma
I also tried freeing bitmpas between each command.
I also tried using code and setting all gamma to 1 and then this code. Same result

I tried on a simple scene with a box and 2 bitmaps applied to different faces.
I also tried switching between realistic and shaded viewports, same story

 

What am I missing here?

0 Likes
869 Views
2 Replies
Replies (2)
Message 2 of 3

Morne3D
Enthusiast
Enthusiast

I have some more info on this. So, when I get to a stage when the Material displays correctly in the material editor, but Double Gammad in the viewport, I instance the diffuse texture from the material that is not displayng correctly in the viewport, and instance the diffuse to a new STANDARD material and also a NEW VRaymtl. I tried with both new materials without re-running the script, and then like magic, the viewport displays correctly. If I then apply the original material again (still without running the script), the viewport again displays double gammad. (Even though the new and old material is identical)

Very, very weird!

So I wonder if instead of just assinging the values, which they may already have, I should do a bunch of "if then" or "case of" checks and see what the current values are, and if they're not what it's suppose to be, only then set it to the correct value.

Makes no sense as it's just extra code because
a = 1
a = 1
a = 1
basically says a is 1 (a will always be 1 even if you assing it 1 again)

Just trying to think out the box here because it's a VERY WEIRD issue.

0 Likes
Message 3 of 3

Morne3D
Enthusiast
Enthusiast

Tests with if statement is looking promising

 

0 Likes