Developing a ptexWriter

113 views
Skip to first unread message

Paul-Jozef Torrevillas

unread,
Apr 23, 2014, 5:36:59 PM4/23/14
to pt...@googlegroups.com
I'm planning on developing a maya plugin for a ptex writer.  I'm a bit lost in the documentation,
would someone mind outlining what is needed to use the ptex API to write out ptx files?



PJ

Brent Burley

unread,
Apr 24, 2014, 11:56:29 AM4/24/14
to pt...@googlegroups.com
The only class that's needed is the PtexWriter class.  Sample usage is shown in wtest.cpp in the src/tests dir.  I can answer other specific questions you might have.

Cheers,

Brent

Lixuan Zhu

unread,
Nov 23, 2014, 10:09:45 PM11/23/14
to pt...@googlegroups.com
Hey,

I have a question. PtexReader's "getData" can read texture data at any resolution(mipmap).

Should I create a mipmap for each face texture by myself using PtexWriter? According to the documentation, it looks like PtexReader will generate mipmap automatically.

It seems PtexWriter has "WriteFace" allows me to pass in resolution for the face(FaceInfo argument).

Best regards,
Tyler

Brent Burley

unread,
Nov 24, 2014, 10:36:44 AM11/24/14
to pt...@googlegroups.com
There is currently no support for supplying custom mipmaps.  I think I left in a stub version of an api for doing so, but if you look you will notice that it is "ifdef'd" out.  I haven't yet found a good use case for custom mipmaps but it would be easy to add support for them.  Note that certain aspects of the filtering such as the lerping implementation assume a box filter, and missing resolutions are box filtered on the fly.

--

---
You received this message because you are subscribed to the Google Groups "ptex" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ptex+uns...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Paul-Jozef Torrevillas

unread,
Apr 20, 2015, 8:19:45 AM4/20/15
to pt...@googlegroups.com
Hi Brent,

I'm reading through the adjacency data requirements for ptex and I was hoping you could answer a few questions for me.  

I'm trying to create a mapper in Maya and I am a little confused as to how to determine where edge 0 should be defined.  

In the api, I noticed a comment mentioning that edge zero is the bottom?  

But how is the bottom defined?  

Are there any examples of this mapping using the maya api?



Thanks.


PJ

Brent Burley

unread,
Apr 20, 2015, 10:49:28 AM4/20/15
to pt...@googlegroups.com
Hi PJ,

Edge 0 is the edge from the first vertex to the second vertex.  Likewise, edge 1 is from the second to the third, edge 2 is from the third to the fourth, and edge 3 is from the fourth back to the first.  Implicitly, the intrinsic uv's are defined as (0,0) at the first vertex, (1,0) at the second vertex, (1,1) at the third, and (0,1) at the fourth.  The labels bottom, right, top, and left correspond to edges 0..3 if you look at the face in its canonical orientation. Hopefully this figure is helpful: http://ptex.us/adjdata.html.

Unfortunately, I don't have any code that writes a Ptex file from Maya that I can share with you.

Brent

Paul-Jozef Torrevillas

unread,
Apr 21, 2015, 6:55:43 PM4/21/15
to pt...@googlegroups.com
Thanks for the info Brent.  I'm going over the adjacent data doc you have provided.

What I'm getting confused on is where to start the unwrapping at.  
With a given geometry, maya faceid 0 may not contain maya edge 0.  
With a given geometry, maya edgeid 0 may not be connected to maya vertid 0
With a given geometry, maya vertid 0 may not be connected to maya vertid 1
With a given geometry, maya faceid 0 may not be connected to maya vertid 0

I guess I'm lost to how and where I need to start my unwrapping in Maya.
Do I start with maya edge 0 and just pick a direction?
Do I start with maya faceid 0 and just pick an edge and direction?
Do I start with maya vertex 0 and just pick a face and edge direction?

Sorry for all the questions, hopefully I'm not being too confusing.


PJ

Brent Burley

unread,
Apr 21, 2015, 8:14:48 PM4/21/15
to pt...@googlegroups.com
Note that the edge ids for Ptex are local, i.e. 0..3 for each quad face, whereas Maya's edge ids span the whole mesh.  Really two different animals.

Are you just trying to compute the adj data from a Maya mesh, or do you mean more by "unwrapping"?  I'm afraid I can't help you with the Maya api.  However, what I have done previously to determine adjacency is, given a mesh topology as a list of vert ids per face, I build a map from vert id pair to face pair for each edge for the whole mesh, then I loop around each face and use the map to find the adj faces, then loop around each adj face to find which edge points back to the original face to get the orientation.  Does that make sense?

Brent

Paul-Jozef Torrevillas

unread,
Apr 22, 2015, 5:27:38 PM4/22/15
to pt...@googlegroups.com
Hi Brent,

Yes, I'm just trying to compute adj data.  Didn't mean to be confusing with saying "unwrapping".  

I think I understand what you are saying except for the last part, I'm still trying to grasp it.
"which edge points back to the original face to get the orientation."

I'm going to give this a shot.

Thanks for the explanation and suggestion Brent!  Really appreciate it.


PJ

Leonid Onokhov

unread,
Apr 23, 2015, 8:08:50 AM4/23/15
to pt...@googlegroups.com
Maybe this can help you get the idea on how to geneate adjacency data
from faces/vertices
https://github.com/sopvop/ptex-tools/blob/master/src/ptex_utils/make_constant.cpp

Of course it's a bit easier with maya mesh, the only problem would be
non-quad faces.
Reply all
Reply to author
Forward
0 new messages