Discussion:
[Maya-Python] More performance in VP2 for a custom locator?
Andrea Pinto
2016-12-03 17:39:57 UTC
Permalink
Hello everyone,
I am trying to create a custom locator, drawing a circle always face to
camera

I noticed when duplicate the locator 500 times, the scene is very very slow.
but If I create 500 spaceLocator that isn't happens

Can you know why?

thanks a lot
Andrea
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/2cc9aa04-b735-4aac-bdfb-5d3470790b0c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Chad Vernon
2016-12-03 20:09:20 UTC
Permalink
It depends on your draw calls. Make sure you are not reading plug data in the draw function.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/16a556d4-4019-4f91-916c-8b74fd7d6bf8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Andrea Pinto
2016-12-04 09:32:51 UTC
Permalink
Hi chad! thanks for reply.

I started from the footPrintNode example
https://github.com/autodesk-adn/Maya-devkit/blob/master/win/devkit/plug-ins/scripted/pyFootPrintNode.py

Yesterday I tried the footPrint in maya 2016/2017 and I had the same
result, viewport 1 e 2 very slow.

Sorry I am noob
thanks again
Post by Chad Vernon
It depends on your draw calls. Make sure you are not reading plug data in
the draw function.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/f4e8a3c9-2600-4811-9ee1-bf7ebed5ce0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Andrea Pinto
2016-12-04 10:10:34 UTC
Permalink
This example hasn't any problems in viewport, I will try to study it.

https://github.com/autodesk-adn/Maya-devkit/blob/master/win/devkit/plug-ins/scripted/pyFootPrintNode_GeometryOverride.py
Post by Andrea Pinto
Hi chad! thanks for reply.
I started from the footPrintNode example
https://github.com/autodesk-adn/Maya-devkit/blob/master/win/devkit/plug-ins/scripted/pyFootPrintNode.py
Yesterday I tried the footPrint in maya 2016/2017 and I had the same
result, viewport 1 e 2 very slow.
Sorry I am noob
thanks again
Post by Chad Vernon
It depends on your draw calls. Make sure you are not reading plug data
in the draw function.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/85ee7f5b-5cec-46da-a214-b3316ec17efc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Chad Vernon
2016-12-04 22:10:42 UTC
Permalink
The problem with the first example is that getMultiplier function. It's reading the plug value to get the multiplier and is called in both the boundingBox function and prepareForDraw function. The second example looks like it caches the plug values and only reads them when they change.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/34375492-eea9-4bfd-895e-ca0239479d9a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Andrea Pinto
2016-12-05 01:31:04 UTC
Permalink
I tried again the first example.
drawing only a simple circle, but nothing it is still slow.

Can you suggest to me a way to create a custom shape face the camera?

In the attachment a snapshot of the my custom locator
The scene becomes slow with 40 locators :(

<Loading Image...>
Post by Chad Vernon
The problem with the first example is that getMultiplier function. It's
reading the plug value to get the multiplier and is called in both the
boundingBox function and prepareForDraw function. The second example looks
like it caches the plug values and only reads them when they change.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/f5da8b29-7045-4376-b3b7-9cf188f9a406%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Alex Hrazhdan
2016-12-07 22:44:51 UTC
Permalink
Hi, Andrea. the significant slowdown is because of one shader per override
locator instance, and because of transparency
(MShaderInstance::setIsTransparent())...
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/164292a7-63b8-4c02-b8b5-88f1cf49be5e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Andrea Pinto
2016-12-10 01:00:11 UTC
Permalink
Hi Alex thanks, Do you mean I have to create a MShaderIstance?
I am using the MPxDrawOverride method of the footPrintNode example.
In that example the footPrint isn't trasparent, but it is slow.

I don't know, Probably I have to find a way to don't create the position
list and triangles for every update.
I am creating the circle face the camera, multiplying every point with
cameraPath.inclusiveMatrix() and objPath.inclusiveMatrix().inverse()
Post by Alex Hrazhdan
Hi, Andrea. the significant slowdown is because of one shader per override
locator instance, and because of transparency
(MShaderInstance::setIsTransparent())...
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/dad8bcbb-dc99-4b68-9e91-f75ba501ddfa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Alex Hrazhdan
2016-12-10 10:39:59 UTC
Permalink
*Hi Andrea. Isn't it more efficient to draw simple sphere than circle? In
that case you dont have to multiply vectors by matrix every draw update...*
*And instad of MPxDrawOverride, I recoment to use MPxGeometryOverride...
You can declare couple of MShaderInstance as static variables and use it
for every locator instance in different cases (selection lead, selection
active, defoult state). *
*But in that case you will lose your ability to switch color per locator
instance.*
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/d3bae49e-9c5f-493e-b334-ec4e8fe1f952%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Andrea Pinto
2016-12-10 13:03:24 UTC
Permalink
thanks again for your advice, you are right, the sphere was my first idea.
My fault I would like to do something more 2D hehe.
Create different shapes when changing the segments.
Surely in c++ would be better.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/8b8f5b9f-4e68-4add-9fce-ac206f877470%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Andrea Pinto
2017-02-03 13:47:39 UTC
Permalink
<Loading Image...>

Hi! I was working about it again in these Days.
In the geometryOverride I tried to print out the semanticName of the
vertexBufferDescriptor
The result is only "POSITION", it hasn't a semantic "Normals"

How I can create the Normals? or Do you have some solution for this problem?

Is it possible to use a geometryOverride and drawOverride togheter?

thanks in advance
Hi, sorry if I continue to ask some question here, I was trying to create
a sphere with MPxGeometryOverride.
This is the result.
Wireframe is ok, but the shaded it is strange.
Is it a problem with the normals?
<https://lh3.googleusercontent.com/-72oOsjB4-8A/WFkcftvxmJI/AAAAAAAAc4M/s5gJgljP2Zc9r8TQ9s-2X_nXiezNGgu4ACLcB/s1600/sphere_geoOverride.jpg>
Post by Andrea Pinto
thanks again for your advice, you are right, the sphere was my first idea.
My fault I would like to do something more 2D hehe.
Create different shapes when changing the segments.
Surely in c++ would be better.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/bbaa2e4d-a8fb-461f-96c6-f874114cc3b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Andrea Pinto
2017-02-08 16:42:09 UTC
Permalink
Hello! Yesterday I saw the example of apiMeshShape.
More or less I understand how to create the shape.
I'll try to follow that example.
Post by Andrea Pinto
<https://lh3.googleusercontent.com/-72oOsjB4-8A/WFkcftvxmJI/AAAAAAAAc4M/s5gJgljP2Zc9r8TQ9s-2X_nXiezNGgu4ACLcB/s1600/sphere_geoOverride.jpg>
Hi! I was working about it again in these Days.
In the geometryOverride I tried to print out the semanticName of the
vertexBufferDescriptor
The result is only "POSITION", it hasn't a semantic "Normals"
How I can create the Normals? or Do you have some solution for this problem?
Is it possible to use a geometryOverride and drawOverride togheter?
thanks in advance
Hi, sorry if I continue to ask some question here, I was trying to create
a sphere with MPxGeometryOverride.
This is the result.
Wireframe is ok, but the shaded it is strange.
Is it a problem with the normals?
<https://lh3.googleusercontent.com/-72oOsjB4-8A/WFkcftvxmJI/AAAAAAAAc4M/s5gJgljP2Zc9r8TQ9s-2X_nXiezNGgu4ACLcB/s1600/sphere_geoOverride.jpg>
Post by Andrea Pinto
thanks again for your advice, you are right, the sphere was my first idea.
My fault I would like to do something more 2D hehe.
Create different shapes when changing the segments.
Surely in c++ would be better.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/fd2bb429-3a1f-429c-99b0-d027db481125%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Andrea Pinto
2017-09-01 06:04:34 UTC
Permalink
Hi, after so long, I resume this discussion.
I wanted ask you.
Do you know if there is a way to update the function populategeometry in
the method geometryOverride when I am scaling the transforme node.

I would like to have the shape with same size multiplying it with inverse
matrix
I mean I did that, but it update when I deselect and select the transform
node after the scaling

do you know how can I update it directly with scaling?

thanks in advance
Andrea
Post by Andrea Pinto
Hello! Yesterday I saw the example of apiMeshShape.
More or less I understand how to create the shape.
I'll try to follow that example.
Post by Andrea Pinto
<https://lh3.googleusercontent.com/-72oOsjB4-8A/WFkcftvxmJI/AAAAAAAAc4M/s5gJgljP2Zc9r8TQ9s-2X_nXiezNGgu4ACLcB/s1600/sphere_geoOverride.jpg>
Hi! I was working about it again in these Days.
In the geometryOverride I tried to print out the semanticName of the
vertexBufferDescriptor
The result is only "POSITION", it hasn't a semantic "Normals"
How I can create the Normals? or Do you have some solution for this problem?
Is it possible to use a geometryOverride and drawOverride togheter?
thanks in advance
Hi, sorry if I continue to ask some question here, I was trying to
create a sphere with MPxGeometryOverride.
This is the result.
Wireframe is ok, but the shaded it is strange.
Is it a problem with the normals?
<https://lh3.googleusercontent.com/-72oOsjB4-8A/WFkcftvxmJI/AAAAAAAAc4M/s5gJgljP2Zc9r8TQ9s-2X_nXiezNGgu4ACLcB/s1600/sphere_geoOverride.jpg>
Post by Andrea Pinto
thanks again for your advice, you are right, the sphere was my first idea.
My fault I would like to do something more 2D hehe.
Create different shapes when changing the segments.
Surely in c++ would be better.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/a4420d13-f959-460e-afc2-913d645f3459%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...