Hi,
I would like to make a geometry fur shader.
To generate hair primitives exactly on a surface, I use mi_geoshader_tesselate to get tesselated primitives.
It works fine if a surface is a simple mesh or a mesh with subdiv approx, but if a displacement shader (and displace approx.) is applied to the surface, mi_geoshader_tesselate simply returns instance whose boxes are not properly displaced.
Does anyone know how to get tesselated primitives of meshes with displacement shader?
My test shader is as follows.
Code:struct testGeoShader { miTag surface; ///< Tag of surface }; miBoolean testGeoShader(miTag *result, miState *state, struct testGeoShader *paras) { miTag surfaceTag = *mi_eval_tag(¶s->surface); miTag leaves; mi_geoshader_tesselate(state, &leaves, surfaceTag); miTag scan = leaves; while (scan != miNULLTAG) { miInstance* instance = (miInstance *)mi_db_access(scan); if (instance->boxes != miNULLTAG) { miBox* box = (miBox*)mi_db_access(instance->boxes); for (miUint p = 0; p < box->no_prims; ++p) { // Do something } mi_db_unpin(instance->boxes); } miTag next = instance->next; mi_db_unpin(scan); scan = next; } mi_geoshader_tesselate_end(leaves); return miTRUE; }


Reply With Quote