Xgen API help (c++)

Xgen API help (c++)

tim-bot
Advocate Advocate
1,499 Views
7 Replies
Message 1 of 8

Xgen API help (c++)

tim-bot
Advocate
Advocate

Hello, i'm having some trouble figuring out how to do a few things with the xgen api. i've used the samples to get a custom XgRenderer set up. it works great for a single frame. but i can't seem to figure out how to get the motion samples properly. Initially, it only gives a single sample. i've found that i can use _description->addSample() to add samples, and that will cause it to emit additional samples. but i can't seem to figure out how to go about getting the added sample (which, addSample is looking for an XgDescription), to have a time offset. i'd like to modify the frame by half a frame. the only place i can seem to find a frame modification is in the _description->palette()->setFrame() function. which i've tried to modify before addSample, but it just ends up giving me the same thing. there doesn't appear to be a copy function available, as the copy constructor is protected. so i'm at a loss for how to properly get this to work the way i want.

 

my second question, i see the ProceduralCallbacks in the samples, and they look like they've got motion samples in hand already. but i can't for the life of me figure out how those things are initiated through maya's xgen interface. and there doesn't appear to be any python code in the xgen plugin folder that has any samples of calling up any of the procedural callbacks

 

i appreciate your time, any help would be greatly appreciated. thanks!

0 Likes
Accepted solutions (1)
1,500 Views
7 Replies
Replies (7)
Message 2 of 8

cheng_xi_li
Autodesk Support
Autodesk Support

Hi,

 

For getting motion samples from different frames, I think you can use MGlobal::viewFrame to change global time and get data from outRenderData.

 

ProceduralCallbacks should be called each frame during batch rendering. From what I am understanding, it is designed for getting data from the Renders(e.g. Render Settings or geometry data like Arnold Standin). 

 

Yours,

Li

0 Likes
Message 3 of 8

tim-bot
Advocate
Advocate

hey @cheng_xi_li , thank you for the response!

for the outRenderData, you're meaning something like this: https://knowledge.autodesk.com/support/maya/learn-explore/caas/CloudHelp/cloudhelp/2017/ENU/Maya/fil...

hadn't seen that previously, but i'll definitely give it a go. 

does this work with core xgen too do you know? or just interactive grooms as it's suggesting? because we are not using interactive grooms for our workflow. 

 

And yea, with the procedurals, that makes sense, i was totally looking at them the wrong direction. for some reason i though they were something xgen feed into, but it makes sense now that these actually feed into xgen. thanks for clarification on that. 

0 Likes
Message 4 of 8

cheng_xi_li
Autodesk Support
Autodesk Support
Accepted solution

Hi,

 

I need to correct some of my previous clarification. Sorry for the misleading.

 

The ProceduralCallback actually could get data from XGen. And it is probably the easiest way to get data from XGen Core.

 

The code of xgenArnoldProcedureCallback actually is an Arnold extension.

 

The code's reading data from XGen  works like this:

 

1. Initialization of the callback in Procedural::Init

It's Arnold node's entry point and where we set callbacks.

initPatchRenderer( parameters.c_str() ); //Use current procedural

initFaceRenderer( pProc, f ); //A new procedural for each face

 

2. Getting data from XGen in Procedural::flush( const char* geomName, PrimitiveCache* pc )

 

The XGen data is stored in PrimitiveCache.

 

When you click at the batch rendering, it will call the callbacks and let Arnold get data from XGen. Also, if there is standin when XGen needed, it is provided through this class too. 

 

Yours,

Li

 

Message 5 of 8

tim-bot
Advocate
Advocate

Hey @cheng_xi_li , thank you for your continued help on this. i'm defintly getting closer now. I've got my procedural set up, but i'm stuck again on the in_xgen_args for the PatchRenderer::init function. I'm pretty sure i've got most of it working. the only thing that seems to be giving me trouble is the -geom parameter. i tried to use the associated geometry name from xgapi::boundGeometry, but that's not working. seems like it needs a file name. In the examples i see that they're using a .caf file path. but i can't find any .caf files around the file or in any of the xgen directories. is this something that i can programatically generate?

I also tried to use just the name of the maya scene, which kind of seemed like it was working almost, but not really. just gave some other messages.

 

Here's the last part of the log:

16:08:09 (1) No pref specified for: XG_RENDER_:pSphere1. Popping may result.
16:08:09 (1) No base geometry specified for: XG_RENDER_:pSphere1. Cant render patches on this geometry.
16:08:09 Caf Error. Removing patch: XG_RENDER_:pSphere1
16:08:09 (1) Preprocessing of S:/TEMP/XgenToAlembic/Test__collection9.xgen took 0.007 seconds.

 

Any help would be greatly appreciated, Thanks!

Message 6 of 8

tim-bot
Advocate
Advocate

Ok, sorry, my fault, i was putting in the wrong geometry name. i was getting the shape instead of the transform name for the  -patch parameter.

Also, i exported the scene to archives, so now i'm using .abc instead of the caf file for the -geom parameter. that appears to enable the PatchRenderer to initialize now. though, it's crashing on the nextFace function, but hopefully i can figure that one out soon.

Message 7 of 8

tim-bot
Advocate
Advocate

Definilty getting closer now. but for anyone else that's doing this, i was just using default return values in some of the getters, which was causing the access violation. i now have it processing through everything after i've adjusted all the getters to return valid values.

Message 8 of 8

957714080
Explorer
Explorer

Hi, I'm also looking into xgen, but there are too few examples on the Internet. I'm also stuck on the -geom parameter. Could you give me some tips?

0 Likes