THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/04/2005 at 06:50, xxxxxxxx wrote:
Cinema 4D Version: 9.1
Platform: Windows ;
Language(s) : C++ ;
I have an object link and I would like to know how to safely retrieve the according RayObject in a shader.
On 28/04/2005 at 08:01, xxxxxxxx wrote:
There is no direct way, you just need to go through all the ray objects (from VolumeData) to find it. If you need to repeat it many times you can of couse build an array you can search faster but for a one off just do the search at the start and store the RayObject pointer.
On 28/04/2005 at 08:10, xxxxxxxx wrote:
Thanks Dave. Pity perfomancewise but well, can´t have everything.
On 28/04/2005 at 13:11, xxxxxxxx wrote:
If you are accesing it lots then create a table to look them up quicker, if you are only accessing them at the start then it doesn't matter since it won't take much time to run through the objects. I can't see why you would be accessing them during rendering, if this is what I think it is for you just need to know the RayObject pointers for that so you could fetch them at InitRender.
On 28/04/2005 at 14:39, xxxxxxxx wrote:
yes it is for what you think it is for
Thank you, that´s how I am doing it now.
On 23/05/2005 at 09:13, xxxxxxxx wrote:
I still have a problem here. The RayObject pointers of primitives and/or deformed objects in InitRender don´t seem to match the ones during rendering.
Anybody an idea how to retrieve the correct rayobject for a primitive or deformed object for a baselink object?
dorig = (BaseObject* )data->GetObjectLink(INST_MASTER,is->doc); if(!dorig) return LOAD_OK;
orig = NULL;
VolumeData* vd = is->vd;
RayObject* temp = vd->GetObj(i);
/*there are 3 objs in the scene and this condition is never true, which is quite impossible as it´s an object from within this scene. :) */
orig = temp;
On 23/05/2005 at 12:39, xxxxxxxx wrote:
Just a guess.. I think vd->GetObj(i) references an object in the cache of "dorig". It makes sense because generator objects store polygon geometry in their caches. And deformed objects store the deformed geometry in yet another cache.
On 23/05/2005 at 12:50, xxxxxxxx wrote:
Your guess was right.
As Michael said, the link from the rayobject will point to the cache, not the original document object which a baselink gives. You need to step through the cache until you find the original but this is not always possible. The cache is a complex beast!
On 23/05/2005 at 12:54, xxxxxxxx wrote:
thx Dave and Michael, you both helped me a lot. (was fighting with this the whole day and just couldn´t understand the original object doesn´t match. I think this should be a side note in the docs for GetObj()!!)