PDA

View Full Version : Curve and geometry shader



thecouze
December 19th, 2005, 18:43
I would like to attach a geoshader to a curve in Maya. I have been trying few things but it did not work. I just need to get the curve into my shader and collect the CVs coordinates.
Any help will be appreciated! Cheers
Gerome.

bart
December 19th, 2005, 22:39
Pass the curve as an input argument of type geometry to the geoshader.

In an mi file this would appear as the name of the object (shape node).

thecouze
December 20th, 2005, 19:38
I tried the following and it does not pick up my curve.

Below it is my simple code for getting the curve.

#include <shader.h>
#include <geoshader.h>

typedef struct {
miTag object;
} curveParm;


DLLEXPORT int curveToPlane_version(void) {return(1);}

DLLEXPORT miBoolean curveToPlane(
miTag *result,
miState *state,
curveParm *param )
{
miTag src_obj_tag = *mi_eval_tag( &param->object );
miObject *curveOBJ;

curveOBJ = (miObject*)mi_db_access( src_obj_tag );

if ( curveOBJ->type == miOBJECT_SPACECURVES )
{
mi_warning( " We have a curve " );
}
else if ( curveOBJ->type == miOBJECT_POLYGONS )
{
mi_warning( " We have a poly " );
}
else
{
mi_warning( " It is something else " );
}

return ( miTRUE );
}

and my .mi file

declare shader
geometry "curveToPlane" (
geometry "object"
)
version 1
apply geometry
#: nodeid 1093867
end declare



Nothing is happening. I feed the "curve"|geometry shader with this shader the following connection is done:
Connected curveToPlane1.outValue to nurbsSphere1.mentalRayControls.miGeoShader
then as my argument in the geo shader I feed it with the curveShape node and the following is connected:

connectAttr -f nurbsSphere1.message curveToPlane1.object;

However it seems to work with Poly, so I believe I am doing something wrong regarding NURBS inputs.
Any ideas? Cheers

ctrl_studio
December 22nd, 2005, 02:15
'geometry' keyword in mi declaration files does not work in maya.
and I'm not even sure you can pick up a curve anyway.
try in the first soomething like this ..

miTag src_obj_tag = *mi_eval_tag( &param->object );
if( !src_obj_tag) mi_info("oops.. I got a null tag !! ");
[....]


max

stefanminning
February 27th, 2009, 02:20
Sorry to revive an old thread like this.

I'm also trying to access a curve in a geometry shader in Maya. The problem is, I'm not even sure whether Maya actually translates the curves at all so I don't know if what I'm doing is simply wrong or if Maya is just preventing me from seeing the data.

Has there been any progress in this area? How would I go about accessing a curve's CVs in my shader?