Re: User data blob from XSI to Mental Ray

Date : Tue, 11 Mar 2008 22:15:17 -0400
To : XSI(at)Softimage.COM
From : "Vince Fortin" <vfortin(at)gmail.com>
Subject : Re: User data blob from XSI to Mental Ray
Hope you don't mind, Felix, but I find myself guilty of nosing about your dump folder once in a while and every time I do find something new and inspiring. How about setting up a RSS feed?

On Tue, Mar 11, 2008 at 1:58 PM, andreas gebhardt <gebhardt(at)betacarotin.de> wrote:

Not sure if this helps but all polygon meshes are sent to MR like this
-> http://www.sukio.de/dump/MR_user_data_blob_location.png
to allow splitting geometry into chunks for better handling triangle
heavy cases.



Amaan Akram wrote:
> Hi Ben,
>
> Thanks very much for sending the code. It seems perfectly
> straightforward, but unfortunately, it does not work for me.
>
> Your code integrated just fine, queried the proper object, but it
> heads straight to the following line of code
>    if( !found_userdata )
>   {
>       mi_error("base object data not found");
>       return( miTRUE );
>   }
>
> This is all a bit new to me and a bit strange. When I put userdata on
> the state->instance object (the geometry shader primitive), I can
> query the userdata just fine at:
> <object_name>/Polygon Mesh_Inst(0)  level.
>
> But when the userdata is placed on an object other than the geo shader
> primitive, the userdata gets placed in <object_name>[i] level. I
> confirmed this by outputting to an .mi file (as suggested by Philipp).
> So when I query an object at this level (<object_name>[i]), I can read
> the userdata just fine.
>
> I must admit I am quite new at this whole shader writing thing & I am
> not able to figure out why userdata gets put in a separate place in
> the scene DAG when we are dealing with object tags other than
> state->instance (which is where the wireframe example in the SDK
> fetches its userdata from).
>
> Thanks!
> Amaan
>
> Ben Rogall wrote:
>> Here's a chunk of code from my Binder addon. It's from the geoshader
>> and the spdl points to the null object with the UserDataBlob (for
>> some reason it's never worked for me to just put the blob under the
>> geoshader primitive itself).
>>
>> ------------------------------------------------------------------------------------------------
>>
>>    miTag dataTag;
>>    miUint dataLabel;
>>    miBoolean found_userdata = miFALSE;
>>    void * p_userdata = NULL;
>>
>>    miTag * objects = &params->objects[ params->i_objects ];
>>
>>    miTag objtag = miNULLTAG;
>>    if(!mi_query(miQ_INST_ITEM, NULL, objects[ 0 ], (void *)&objtag))
>>    {
>>        mi_error("objtag not found");
>>        return( miTRUE );
>>    }
>>
>>    mi_query(miQ_INST_DATA, NULL, objects[ 0 ], (void *)&dataTag);
>>
>>
>>    for( ; ; )
>>    {
>>         if(!mi_query( miQ_DATA_LABEL, NULL, dataTag, (void
>> *)&dataLabel  ))
>>            break;
>>
>>        if( dataLabel == 6789 ) //found userdatablob
>>        {
>>            found_userdata = miTRUE;
>>            mi_query( miQ_DATA_PARAM, NULL, dataTag, &p_userdata ); //
>> get pointer to the blob
>>
>>            break;
>>        }
>>
>>        if( !mi_query( miQ_DATA_NEXT, NULL, dataTag, (void *)&dataTag ) )
>>            break;
>>    }
>>
>>    if( !found_userdata )
>>    {
>>        mi_error("base object data not found");
>>        return( miTRUE );
>>    }
>>
>> -----------------------------------------------------------------------------------------------
>>
>>
>> Hope it helps,
>> Ben
>>
>>
>>
>>
>>
>> Amaan Akram wrote:
>>> Hi Philipp,
>>>
>>> Thanks for replying
>>>
>>> Yes, when I put a userdatablob on the geoshader primitive itself,
>>> and run the following command, I get access to the user data set in
>>> XSI.
>>>     mi_query( miQ_INST_DATA, NULL, state->instance, (void
>>> *)&userdata_tag );
>>>
>>>
>>> My geoshader's SPDL has an object list defined where I go and select
>>> the object with the userdatablob defined. This is what I am doing in
>>> my code where I can't get any user data back
>>>
>>> ------------------------------------------------------------------------------
>>>
>>>    //get miTag to the object selected in the Object List in the
>>> geoshader SPDL
>>>    ...
>>>    ...
>>>    //traverse scene DAG and arrive at the parent of the object instance
>>>    ...
>>>    ...
>>>    miTag child_tag;
>>>    mi_query( miQ_GROUP_KID, NULL, parent_tag, &child_tag,
>>> child_index );
>>>    int tagtype =  mi_db_type(child_type);
>>>    if(tagtype==miSCENE_INSTANCE)
>>>    {
>>>            mi_query( miQ_INST_DATA, NULL, child, (void
>>> *)&userdata_tag );
>>>            if(!userdata_tag)
>>>                mi_warning("null userdata");
>>>    }
>>> ------------------------------------------------------------------------------
>>>
>>>
>>> Any ideas? :(
>>>
>>> Thanks
>>> Amaan
>>>
>>
>> ---
>> Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in
>> body:
>> unsubscribe xsi
>>
>
>
> ---
> Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in
> body:
> unsubscribe xsi
>

---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi


Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.