Texture Memory/Buffer of Custom Material [CLOSED]

On 30/01/2015 at 14:27, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   15 
Platform:   Windows  ;   
Language(s) :     C++  ;

Hi Plugin-Cafe,

in a custom material plugin I have a TEXTURE as an element in a channel. When I select a texture from my disk, the image gets loaded and is displayed as a small thumbnail, like this:
_<_img src="https://dl.dropboxusercontent.com/u/15216944/c4dforum/texturememory.png" height="159" width="600" border="0" /_>_

Is it possible to access the memory of the texture within C4D? So, for example, if I load a texture with 512x512x24 (like in the image above) I would like to get some form of representation in C++. In this case a pointer of type uchar8* and the info that this texture has 3 channels. Another form like a VPBuffer or BaseBitmap would be fine as well (actually even better!).

For clarification, this is the resource file:

If it is possible to access the image memory, is this image already gamma corrected, if I select "linear workflow" in C4D?


On 02/02/2015 at 12:27, xxxxxxxx wrote:

Hi Andreas,

nice to see you again in this forums :slightly_smiling_face:
Basically the texture data type holds nothing more than the path to the image. So no, I don't think you can get a byte-accessible representation from it directly.
But you can of course simply init a BaseBitmap with the path and filename. I think, you already discussed with Sebastian in another thread, how to correctly merge path and filename (actually I think you corrected our SDK docs...), so I'm just saying the obvious.
Which makes me think, I must have missed some part of your question. And I'd like to apologize beforehand...

On 02/02/2015 at 23:58, xxxxxxxx wrote:

Hey Andreas,

thanks for the quick reply!

You are right about the loading part, but I thought that since I can see the thumbnail, C4D might already have loaded the image from the disk. In some sense deep in the API the whole byte data has to be touched once. Maybe C4D does not keep the data, reduces the resolution and discards the original data. But that does not matter, since we cannot access it.^^

The other part of the question was about gamma corrected input images. But I guess that I have to let the user check a box if the texture is already gamma corrected or not. The whole thing about gamma is a bit strange because most of the artists (and I think all of the programmers including myself) only start slowly to grasp the importance of linear workflow. I will write my own gamma correction and might let the user select an advanced mode where the gamma can be changed (other than 2.2).

Thanks again, I set this post to [CLOSED]