Jump to content

R8 image problem


photo

Recommended Posts

We programmatically create an image that we upload to the GPU very often. To reduce the stall we'd want to keep the image size as small as possible and hence chose the R8 format.

When we create a 146x146 sized image we get a strange problem.

 

The image looks fine in this preview

post-225-0-91538900-1327481661_thumb.png

 

But when we see it in the material preview (the eye icon on the diffuse texture), we find it is distorted

post-225-0-61439500-1327481710_thumb.png

 

And this is how it comes up in the game too (distorted).

 

Strangely this doesn't happen when we create an image of double this size (292x292). We wouldn't want to do that though, as the stall becomes more obvious.

Link to comment

These are the APIs we use</div>

C++

=======

 

Unigine::ImagePtr m_pImgFoW;
...
memcpy_s(m_pImgFoW->getPixels2D(), nBytes, m_pBufferR8Downscaled, nBytes);
m_pImgFoW->blur(1);
#ifdef _DEBUG
 m_pImgFoW->save("FoW.tga");
#endif

 

In unigine script

==============

Material mat = engine.materials.findMaterial("mesh_terrain_base");
int idTex  = mat.findTexture("fow");

mat.setImageTextureImage(idTex, img);

Link to comment
×
×
  • Create New...