beyond 8 bits with C++ texturing ?

So it seems I can’t go beyond the limit of 8 bits

> 
> NewTexture->PlatformData->PixelFormat = EPixelFormat::PF_B8G8R8A8;

Tried to change to 16 bits here and where it was requested else where.
I got a message saying that it is not supported.

So procedural texturing, creating textures with C++ in unreal is limited to 8 bits ?
I applied a manual C++ filter on some textures , I managed to make it work but the blur is not quality because the texture is 8 bits and because of the 8 bit system it’s limited to max 255 range, very short range where if some values change from the blur so does the color. The texture getting blured in some parts instead of getting a blur I get a slight tone in color change because averaging is within 255 limit and it’s easy to trip the next color in rbg int 8 bit code.

Anyone at least has some suggestion or something, how I could improve this, is there no way to go 16 bits ?

You can’t change the format just by setting it there - you must set the correct format when you create your texture - you can go up to 32bit floats per channel…

I did change where I needed too, it’s not the only location I changed.
What about floats ?
Images are INT not float, the channels with pixel values are int initially.
It’s what I do load an image texture, blur it with C++ and then crate a new texture, but I can’t go beyond 8 bit for my new texture
How can I write a image with float values since pixels are represented in ints, I need to write the pixel data.

I’m not talking about vertexes or meshes but image textures.

In UE, all pixel values are represented as floats, either between 0.0->1.0 for color describing pixels and -1.0->1.0 for normal maps. Images that are stored as bytes/ints are converted to floats before you use them in shaders.

So there is a way in unreal but it’s with pixels in int not floats.
I never herd of this of images in float values.

" either between 0.0->1.0 "
Yes but that is int to float conversion on 0 to 1 scale /255 when you convert int 255 to float between 0.0f to 1.f

Pretty much the buffers for unreal that I have and work with handle int not float when it comes to images, even FColor to handle pixel data is a special type of int.

For example saving assets, part of the lining I got.

NewTexture->Source.Init(TextureWidth, TextureHeight, 1, 1, ETextureSourceFormat::TSF_BGRA8, PixelsOP);

You sure ? is there some place I can look. I would like to see this.

There is no 16bit “int” format - Float16 and Float32 are the next steps up - if you want to work with 16bit ints - just multiply the pixel value by 65535.0f…

Here’s a good document:

So I get an image, convert 16 bit image to float ranges from the channels I get then what do I do ?
I can do that in unreal, have done it many times for meshing with heighmap system

But I need a buffer and mechanism that will create an actual texture in unreal , a package. How can you write a texture in an unreal folder with floats ?

You need to save the texture as a real 2d texture in the folder.
I have that but it’s with int and 8 bits.

You just lock the texture in the usual way - if you’re using 16bit floats, you’ll need to calculate the value differently, but if you’re using 32bit floats, just cast the memory pointer to (float*) or (FLinearColor*).

What I ended up doing for rdTexTools was create a baseclass (c++) and made subclasses for each pixel format that convert between them with Read’s and Write’s. Then I just access the texture memory (after locking it) and work with all formats as 32bit float…

Thanks I will have a look at that page to see what it is.

1 Like

i pulled it off with 8 bits, now the image is displaying proper and I get proper blur.
I had to change some things, seems unreal C++ is not accepting some orders that are fine outside unreal with C++

But thanks for the info, I will want to go beyond 8 bits eventually.

1 Like