PDA

View Full Version : uv's and rendermans subdiv scheme


dougie0047
08-29-2009, 04:18 AM
Hello. I'm just wondering if there is a way to get the uv's to smooth the same way that the geometry does when using the subdiv scheme in renderman. When I turn it on, the uv's just stay the same, and thus my textures no longer matches the geometry.

Thanks

Doug

noizFACTORY
08-29-2009, 05:43 AM
There's "facevarying" attribute one can add for subdiv scheme and its mostly exposed in the renderman attribute node. This fixes the problem you're facing.
-Sachin

dougie0047
08-29-2009, 01:13 PM
thanks for your reply Sachin,

this may be another stupid question, but: where do I find the renderman attribute node?
It doesn't show up anywhere where I'm used to looking for nodes, like the hypershade or hypergraph.

thanks

Doug

noizFACTORY
08-31-2009, 07:21 AM
thanks for your reply Sachin,

this may be another stupid question, but: where do I find the renderman attribute node?
It doesn't show up anywhere where I'm used to looking for nodes, like the hypershade or hypergraph.

thanks

Doug

I'm not too familiar with RfM but in MayaMan, one usually adds a model attribute to the geomtery and can find the attribute right next to the render as sub-div option.

I think you should look at the "Add Renderman Attribute" section in the attribute editor of your geometry.

According to RfM docs:

RenderMan for Maya provides full support for Maya polygons, including Maya's UV mapping tools. A single polygon is a face, with any number of edges and corners (vertices). A polygon mesh is composed of many individual polygons, a polygonal mesh. Polygons tend to be easier to model than NURBS since a polygonal mesh can be any arbitrary topology, whereas NURBS must be carefully organized patches. Polygons have several inherent disadvantages, however, when compared to NURBS or subdivision surfaces:

1) Polygons are susceptible to faceting artifacts
2) Polygons require dense geometry to approximate smooth surfaces

3) Polygons do not displace satisfactorily (due to their essentially discontinuous topology)


For users of Maya Unlimited, there are often benefits to be gained by converting polygons to subdivision surfaces, especially when displacements are being used. The caveat here is to make sure that the polygonal geometry is not too dense, which could create an inefficient subdivision surface.

dougie0047
08-31-2009, 10:17 PM
thanks for your reply noizFACTORY,

yes, I know about adding renderman attributes. If I didn't I wouldn't have had the subdiv scheme on the object in the first place. The problem is not that, but rather that it is only the geometry itself that gets subdivided, but not the uv's. This means that the textures do not display or render correctly. I have looked everywhere for this supposed "face varying" attribute but cannot find it. Am wondering if this something that can only be added if you compile your own shader, which would be a shame since I don't know how to yet. Neither can I find the renderman attribute node. It does not show up in neither the attr. editor, the hypergraph or the hypershade, or the outliner for that matter. I find nodes like renderman globals etc. but not the "renderman attribute(s)" node...
Can anyone help???

thanks,

Doug

leif3d
09-01-2009, 12:43 AM
Have you tried posting this in the Pixar forum?

noizFACTORY
09-01-2009, 08:12 PM
thanks for your reply noizFACTORY,

yes, I know about adding renderman attributes. If I didn't I wouldn't have had the subdiv scheme on the object in the first place. The problem is not that, but rather that it is only the geometry itself that gets subdivided, but not the uv's. This means that the textures do not display or render correctly. I have looked everywhere for this supposed "face varying" attribute but cannot find it. Am wondering if this something that can only be added if you compile your own shader, which would be a shame since I don't know how to yet. Neither can I find the renderman attribute node. It does not show up in neither the attr. editor, the hypergraph or the hypershade, or the outliner for that matter. I find nodes like renderman globals etc. but not the "renderman attribute(s)" node...
Can anyone help???

thanks,

Doug

Hey,

I know that you know how to add renderman attributes. I was simply telling you how I do it in MayaMan which you obviously did not get.

If you simply looked up "facevarying" or "subdiv scheme" in the manual or google, you'd get a ton of results one of which explains the attributes in detail. Quote from the RfM Manual:

Subdivision Surfaces

The RenderMan Interface includes support for subdivision surfaces. Ordinary cubic B-spline surfaces are rectangular grids of tensor-product patches. Subdivision surfaces generalize these to control grids with arbitrary connectivity. The API for subdivision surfaces looks a lot like RiPointsPolygons, with additional parameters to permit the specification of scheme-specific and implementation-specific enhancements.

A subdivision surface, like a parametric surface, is described by its control mesh of points. The surface itself can approximate or interpolate this control mesh while being piecewise smooth. Furthermore, its control mesh is not confined to be rectangular, which is a major limitation of NURBs and uniform B-splines. In this respect, the control mesh is analogous to a polygonal description. But where polygonal surfaces require large numbers of data points to approximate being smooth, a subdivision surface is smooth —meaning that polygonal artifacts are never present, no matter how the surface animates or how closely it is viewed.

RiSubdivisionMesh ( RtToken scheme, RtInt nfaces, RtInt nvertices[], RtInt vertices[],
RtInt ntags, RtToken tags[], RtInt nargs[],
RtInt intargs[], RtFloat floatargs[], ..parameterlist...)
RiSubdivisionMesh defines a subdivision mesh or surface obeying the subdivision scheme specified by scheme. The only standard scheme is "catmull-clark", specifying the Catmull-Clark subdivision method. Implementations may also support other schemes. The subdivision mesh is made up of nfaces faces. The array nvertices, of length nfaces, contains the number of vertices in each face. The array vertices contains, for each face vertex, an index into the vertex primitive variable arrays. The array vertices has a length equal to the sum of all the values in the array nvertices. All the arrays are 0-based.
parameterlist is a list of token-array pairs where each token is one of the standard geometric primitive variables, a variable that has been defined with RiDeclare, or is given as an inline declaration. The parameter list must include at least position ("P") information. The array of values for a primitive variable contains n elements of the type corresponding to the token. If the variable is vertex or varying, n is equal to the maximum value in the array vertices plus one; if the variable is facevarying, then n is equal the sum of all entries in the vertices array. Primitive variables that are vertex will be interpolated according to the subdivision rules (just as "P" is), whereas varying and facevarying data will be interpolated linearly across faces (as is done for a RiPointsPolygons). If the variable is uniform, the array contains nfaces elements of the associated type. If the variable is constant, a single element of the associated type should be provided. A component is either a face, a vertex, or a chain of edges. Components of the subdivision mesh may be tagged by the user to have various implementation-specific properties. The token array tags, of length ntags, identifies these tags. Each tag has zero or more integer arguments, and zero or more floating-point arguments. The number of arguments provided with each tag is specified by the array nargs, which has a length of ntags x 2. For each tag, nargs contains an integer specifying the number of integer operands found in the array intargs, followed by an integer specifying the number of floating-point operands found in the array floatargs. Thus, the length of intargs is equal to the sum of all the even-numbered elements of the array nargs. The length of floatargs is equal to the sum of all the odd-numbered elements of the array nargs.

The standard tags are "hole", "crease", "corner", and "interpolateboundary". The "hole" tag specifies that certain faces are holes. This tag has n integer arguments, one for each face that is a hole, and zero floating-point arguments. Each face is specified by its index in the nvertices array.

The "crease" tag specifies that a certain chain of edges should be a sharp crease. This tag has n integer arguments specifying a chain of vertices that make up the crease, and one floating-point argument that is expected to be RI_INFINITY. Each sequential pair of vertices in a crease must be the endpoints of an edge of the subdivision mesh. A mesh may have any number of independent "crease" tags. Individual renderer implementations may choose to expand the functionality of the "crease" tag by making use of tag values other than RI_INFINITY.

The "corner" tag may be used to mark certain vertices as sharp corners. This tag has n integer arguments containing the vertex numbers of the corners and either one or n floating-point arguments that are expected to be RI_INFINITY. Individual renderer implementations may choose to expand the functionality of the "crease" tag by making use of tag values other than RI_INFINITY.

The "interpolateboundary" tag controls how interpolation boundary face edges are interpolated. This tag has one optional integer argument and zero floating-point arguments. If the integer argument is not specified it is assumed to have a value of 1. A value of 0 specifies that no boundary interpolation behavior should occur (the default behavior when this tag is not specified). A value of 1 indicates that all the boundary edge-chains are sharp creases and that boundary vertices with exactly two incident edges are sharp corners. A value of 2 indicates that all the boundary edge-chains are sharp creases; boundary vertices are not affected.

RIB BINDING
SubdivisionMesh scheme nvertices vertices tags nargs intargs floatargs
...parameterlist...
The number of faces is determined implicitly by the length of the nvertices array. The number of tags is determined implicitly by the length of the tags array, and must match the value as determined from the nargs array.

EXAMPLE
SubdivisionMesh "catmull-clark" [4 4 4 4 4 4 4 4 4] [ 0 4 5 1 1 5 6 2 2 6 7
3 4 8 9 5 5 9 10 6 6 10 11 7 8 12 13 9 9 13 14 10 10 14 15 11 ]
["interpolateboundary"] [0 0] [] [] "P" [-60 60 0 -60 20 0 -60
-20 0 -60 -60 0 -20 60 0 -20 20 45 -20 -20 45 -20 -60 0 20 60 0
20 20 45 20 -20 45 20 -60 0 60 60 0 60 20 0 60 -20 0 60 -60 0]


You see that word in bold and red? That's what does the trick for us most of the time. Now, how do you go about adding that in RfM would be up to someone who is familiar using that product which I'm not and I had clearly mentioned that already. I can only see a check box for the subdiv scheme to use for rendering and did not find anything else in the hidden attributes section (accessible from the "Manage Attributes" option which is what I was asking you to do when I asked you to look in the add attributes section but of course, you already know this) to help you add this into the exported geometry. And I think neither does RfM (basic) allow you to add your own Ri Attributes to the geometry. Honestly, something like this is usually implemented in all RenderMan avatars and mostly accessible and exposed in so called geometry attributes that you add. So maybe, RfM does it by default.

Also, I don't exactly understand what you mean by "the uv's just stay the same". How can they simply stay the same? Do they stretch or start giving you artefacts or what? More or less, it comes down to using "facevarying" interpolation instead of the defaut linear interpolation that poly faces go through (and hence the uvs too) during a subdivision. As already mentioned, you could probably try posting in RfM forums to get an exact response if you simply want to know which option to switch on, etc. etc.

Both 3Delight and Air (through MayaMan) have these attributes in their equivalent geometry attribute notes. Maybe try rendering with 3Delight and check that option to see if it really helps. If not, then maybe the issue lies somewhere else (maybe the uv layout itself?).

Sorry if I have been of only so much help since I only "know" so much.

-Sachin

CGTalk Moderation
09-01-2009, 08:12 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.