Load BItmapTexture with gamma

Load BItmapTexture with gamma

denisVFX
Contributor Contributor
1,516 Views
4 Replies
Message 1 of 5

Load BItmapTexture with gamma

denisVFX
Contributor
Contributor

I’m new to maxscritpt, and I have a problem with gamma while loading Bitmaptexture
I want to create a VrayMaterial and connect desired bitmap textures to certain channels with gamma overrides for certain channels, or leave "Automatic" gamma if needed. Or maybe after creation and connecting a bitmap I want to change gamma values for all bitmaps in scene with certain pattern (diffuse - Automatic, glossiness - 1.0, Normal Map 1.0 and so on... ) How I can access to gamma?
for example I have a such code:

 

meditMaterials[activeMeditSlot] = VRayMtl ()
mat = meditMaterials[activeMeditSlot]
mat.texmap_diffuse = Bitmaptexture fileName:"d:\\text.png"

It creates a Vray material, Bitmap Texture and connects it to a diffuse material slot.  And it makes gamma "Automatic". But I didn't find a way to set it for example 1.0.

I think t’s not a new question, maybe it was described in other topics, but I didn’t find it.
Can anybody help me please?...

0 Likes
Accepted solutions (1)
1,517 Views
4 Replies
Replies (4)
Message 2 of 5

Swordslayer
Advisor
Advisor
Accepted solution

filename argument is automatic, you want to use the bitmap one:

 

mat.texmap_diffuse = BitmapTexture bitmap:(openBitmap @"d:\text.png" gamma:1.0)
Message 3 of 5

denisVFX
Contributor
Contributor

That's exactly what I need! Thank you!

 

But also I need to access to gamma value for bitmaps which are already in scene. How can I do this? I need to check if gamma value is right and change it if needed...

0 Likes
Message 4 of 5

Swordslayer
Advisor
Advisor

You can query the inputGamma, it will return either #auto or a numeric value:

mat.texmap_diffuse.bitmap.inputGamma

It's a read-only property so if you need to change it, you have to once again assign a new bitmap (reusing the filename of the existing with) with openBitmap.

Message 5 of 5

denisVFX
Contributor
Contributor
Thank you very much for a quick reply!
0 Likes