OGRECave / ogre-next

aka ogre v2 - scene-oriented, flexible 3D C++ engine
https://ogrecave.github.io/ogre-next/api/latest
Other
1.03k stars 227 forks source link

Red only specular for some new exported objects #423

Open cryham opened 10 months ago

cryham commented 10 months ago

Ogre Version: :3.0 Operating System / Platform: Debian 12 RenderSystem: GL3+ GPU: AMD Radeon RX 6600 XT (navi23, LLVM 15.0.6, DRM 3.49, 6.1.0-13-amd64)

IDK why but for my recent new meshes exported, I get red only specular, ignoring specular map. If I don't use specular map it's white again. That barrel is old, converted from old v1 .mesh rest is new with red specular issue. 28_00-16-41

material.json in here, log_cabin_01: https://github.com/stuntrally/stuntrally3/blob/main/data/materials/Pbs/all.material.json#L23805

meshes, textures in: https://github.com/stuntrally/stuntrally3/tree/main/data/objects2 log_cabin_01.jpg log_cabin_01.mesh log_cabin_01_norm.jpg log_cabin_01_spec.jpg log_cabin_02.mesh

blend files https://github.com/stuntrally/blendfiles/tree/master/models/LogCabin01

darksylinc commented 10 months ago

Mmm, very interesting.

I can guess what's happening already without running it: The JPG was saved as greyscale, thus OgreNext detects this and loads it as R8_UNORM to save memory.

So when used as a specular map, sampling texture.xyzw will return R 0 0 1 as per how the HW works.

One simple workaround is to convert the JPG to rgb. Ideally OgreNext should detect this and use a different swizzle.

cryham commented 10 months ago

Ah thanks. I had no idea. Indeed saving as RGB fixed this red. In GIMP from menu Image > Mode. Info from https://www.picozu.com/how-to-convert-a-grayscale-image-to-rgb-in-gimp So leaving this open for change in OgreNext then.