Juraj Posted December 3, 2015 Share Posted December 3, 2015 Hello, I would like to ask you if there is some sort of equivalent to VEX in Maya. I am not experienced in Maya and I don't know all its functions. Recently I tried to do a simple task on geometry - to compute facing ratio between vertex normal and light direction, and then map the result to vertex color. Well, I managed to create simple MEL script and it works but it's extremly slow and inefficient when compared to similar solution in Houdini Also is there a solution to run this dynamically? (without need of clicking shelf button) Maya has some great nodes but I don't know how to extend them or create my own. Also many people tell me that a lot of studios have Maya centered pipeline and therefore its beneficial to have skills in Maya. Do you think it is worth trying to mimick Houdini functions in Maya? Here is mentioned MEL script. global proc facing(){ // facing ratio to vertex color // selection order: geometry, light float $start = `timerX`; // start timer string $prevTool = `currentCtx`; // record current tool string $sel[] = `ls -sl`; // selection to array int $nvtx[] = `polyEvaluate -v $sel[0]`; // number of vertices float $xform[] = `xform -q -m -ws $sel[1]`; // xform mtx from light vector $light = <<0,0,1>>; // init light vector var $light = pointMatrixMult($light,$xform); // mult with xform mtx $light = unit($light); // mormalize for ($i = 0 ; $i < $nvtx[0] ; $i++) { // iterate over all vertices string $vtx = $sel[0] + ".vtx[" + $i + "]"; // current vertex float $N_array[] = `polyNormalPerVertex -q -normalXYZ $vtx`; // return array of normals vector $N = <<$N_array[0] , $N_array[1] , $N_array[2]>>; // save first normal to vector var float $factor = clamp(0,1,dot($N,$light)); // compute angle between N and light vector polyColorPerVertex -g $factor $vtx; // assign vertex color } select -r $sel[0]; // select colored object string $pVtxTool = `artAttrColorPerVertexToolScript 4`; // initialize the paintVertex tool artAttrPaintVertexCtx -e -sao "smooth" $pVtxTool; // set it to smooth for ($i = 0 ; $i <= 6 ; $i++) { artAttrPaintVertexCtx -e -clear $pVtxTool; // smooth vertex colors } select -r $sel; // restore selection setToolTo $prevTool; // restore tool float $end = `timerX`; // end timer print ("\nnumber of processed vertices: " + $nvtx[0] + "\ntime to execute: " + ($end - $start) + "sec"); // print stats } 1 Quote Link to comment Share on other sites More sharing options...
mestela Posted December 4, 2015 Share Posted December 4, 2015 Not built-into maya, no. You might be able to do something with SOuP: http://www.soup-dev.com/ The fastest thing maya has script-wise is the expression language used for particles, which last I checked isn't multithreaded, and doesn't have anywhere near the language scope of vex. You can prototype stuff in python and make calls to the maya API, but again its not multithreaded, to make it fast you'd need to code it in C++. Another option might be SeExpr, which I _think_ is multithreaded, but it seems to be primarily for pattern generation. Someone made a deformer, but again, I don't think it is capable of the effect you're describing. https://github.com/taikomatsu/SeExprMeshMaya Quote Link to comment Share on other sites More sharing options...
Juraj Posted December 4, 2015 Author Share Posted December 4, 2015 Thanks for reply, I will look into those extensions of Maya. This SeExpr looks promising. Quote Link to comment Share on other sites More sharing options...
Juraj Posted December 5, 2015 Author Share Posted December 5, 2015 After I have seen some demos of Fabric Engine I think that this is the way to go in the future. It should have great performance and it is independent of 3D package so Maya shouldn't complicate workflow much Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.