THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 20/06/2007 at 03:08, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 10.102
Platform: Windows ;
Language(s) : C++ ;
---------
Hello there again!
I'm having problems getting a grip of the InitBakeTexture(...) and BakeTexture(...) functions. The documentation isn't helping me that much in that case and the forum search did come up with nothing concerning BakeTexture, so I am again starting a new thread.
The basic idea of what I want to do is the following:
For an export into a real-time 3D-Engine I want to be able to also evaluate all the fancy shaders, noises and so on. To make that easy I thought I could just bake the result of one material channel into a bitmap, one for every channel. So I want to end up with a bitmap for the color channel of the material, one for the bump channel, one for the specular color channel and so on, if the respective channels used something else than just a basic bitmap in the first place.
So I had a look at InitBakeTexture(...) and BakeTexture(...) and gave it a shot, but no success yet. The reason for that might be I don't understand some of the parameters too well. Normally I'm not that bad at playing around a bit with a function to get a grasp of its workings, but this time I think that's just too much guessing. These are the parameters that are not clear to me:
InitBakeTexture(...) :
return value BaseDocument*:
I suppose this is a render document to use with
BakeTexture(...) later, which is what I do currently.
Please tell me if that is wrong.
params I don't understand:
The two UVWTag*: ideally I'd want to end up with a
bitmap containing UV from [0,0] to [1,1], like a
'normal' texture would.
Currently I use a UVWTag containing the
UV-coords for a simple quad, which I create
before calling the function for both UVWTag*.
What is 'destuvw' there for?
BaseThread* th (=NULL) : I assume this should be a
thread to perform the baking process. Where would
I get such a thread?
BakeTexture(...) :
BaseDocument* doc: I assume I should use the document
acquired through InitBakeTexture(...) here.
Correct?
BaseThread* th: Here the thread seems absolutely
necessary, but I don't have a clue how to get
one to use here?
BakeProgressHook* hook: do I absolutely need that one
or could I just wait until the state of 'info' is
BAKE_STATE_COMPLETE?
If I absolutely need it: What is that function
supposed to do (i.e. what should it handle)?
BakeProgressInfo* info : Seems to report the current
state of the baking process, so I should be able
to just do a
while(info.state != BAKE_STATE_COMPLETE);
to wait for the baking process to complete,
right?
It would be great if someone could clarify those parameters to me and how they interact. A simple example for a baking process would be great, too, but explanations are worth more to me normally.
Thx for reading, your time and your help.
PS: Currently, InitBakeTexture does not return an error code, but BakeTexture returns 3003, which is BAKE_TEX_ERR_NO_TEXTURE_TAG. So I guess something's wrong with my use of InitBakeTexture(...).