Sketchfab Forum

sRGB bump map glitches


(Rbr) #1

Im mixing normal & bump within the same texture and I encountered a glitch with bump when the texture is set to a sRGB colorspace which it needs to be in since the normal map sections are sRGB while linear "works" for the bump...

A video showing the glitch, kinda trippy :stuck_out_tongue: http://puu.sh/l5LjL/24124f7ade.mp4

Any ideas as to what is going on?


(Stephomi) #2

Thanks for the report!
Indeed there's a bug with bump + sRGB, we'll fix that.

That being said, I'm a bit confused.
In sketchfab, you can't mix detail maps, it's either normalmap or bumpmap.
We expect both these channels to be in linear space (most 3D softwares will expect that too).

If I'm not mistaken, your texture is a srgb normalmap (which should work fine though).


(Rbr) #3

Sorry for the confusion, originally it wasn't mixed (texture is mixed not the detail type) but the higher order object from the normal bake had too much of a subtle curve which caused banding from the lack of bit depth and coupled with sketchfabs compression it was undesirable. Using a bump map for that objects material and adding more supporting geometry was the better option.

Instead of redoing UV layouts and separating the bump from the texture which contains normals for other objects would have been a waste of valuable texture space and just adds more load time. Since the other objects have assigned materials I dont see any reason why a texture cant contain normal and bump parts within the same texture which have separate materials.


(Renatoaruffo) #4

Normalmap is a mathematical volume information, sRGB is correcting this color, so it is changing the volume information, that is why it should be linear, every program and engine that you set the sRGB on the normalmap it will be bugged. (Unreal, Unity, Marmoset, Maya, etc)

You should only correct the color on Color channels, like diffuse.

Normalmap, roughness/glossness, metallic, mathematical channels should be linear :smile:


(Shaderbytes) #5

how can you mix a texture if you have no control to tell the sketchfab shaders which channel in the image to read its values from? For shading properties that use greyscale values, like bumpmaps I would guess they read the first channel , probably red, Im just guessing though...


(Rbr) #6

You have control if the parts have separate materials... It's just an image you can mix whatever you want in it.

For a better example, You have two meshes both of which are UV mapped to the same texture. Mesh one will be assigned material 1 and mesh two will be assigned material 2. Mesh one will be textured with a bumpmap within it's UV space and mesh 2 with a normal map. In sketchfab you set mat1 to be a bump and under mat2 you set to be a normal... That's what I mean by mix.


(Shaderbytes) #7

Oh I see what you are saying now , I do that thing quite a lot here on sketchfab , ie .. one texture that has different areas used by different materials.

I thought you meant storing different texture values within the different channels of the single image ( which of coarse you can do all sorts of clever things with .. if you have control of editing the shaders :wink: )


(Stephomi) #8

Yes we read it in the red channel.

Ok now i understand, I thought the same as @shaderbytes at first.

Well, it should work with most channels, except the normalmap because we "normalize" the texture.
Sometimes, people put the diffuse texture into the normalmap channel and thus, the model turns "blueish" (because of normalization).
Note that soon, we'll stop doing the normalization if the texture is used in another channel than the normalmap.

However, concerning the colorspace, if you explicitly change the colorspace, it is for the texture, not the channel.
So if you really want to have a texture with 2 different colorspaces... let's say a roughness (linear) data and (srgb) diffuse data in it, you should keep the colorspace to "auto".
"Auto" infers the colorspace depending of the channel.

Actually, as @renatoaruffo said, I strongly advise you to keep the colorspace to "auto", especially with normalmap :smile: