LOD Asset using retainattrib

   5200   7   1
User Avatar
Member
5 posts
Joined: 11月 2018
Offline
I’m just starting to look into using Houdini to solve some of our pipeline issues now.
The first thing I’m looking at is creating a tool (Houdini Asset) to aid with LOD (Level Of Detail) creation.
Can you help, or point me in the right direction of who I should contact in relation to questions I have?

My first question is in relation to the new polyReduce node in Houdini.
I have created a simple Asset using this and have exposed some of the properties so that we can use them in Maya.
In particular I want the artists in Maya to be able to use the “retainattrib” parameter using vertex colours to control and weight the reduction. In Houdini this is simple setting the retainattrib parameter to “Cd”. In Maya I have no idea how to tell Houdini to use the existing vertex colours (and ideally set the vertex colorSet name to be used) for this purpose. Any advise?
User Avatar
Member
394 posts
Joined: 5月 2017
Offline
Hey Andrew.

You should be able to use Cd for the retainattrib and the engine plugin will pick that up in Maya. If you want to use a second or third colour set you would use Cd2 or Cd3. There's some more info here,
https://www.sidefx.com/docs/maya/_maya__mesh.html#Maya_Mesh_Input_ColorSets [www.sidefx.com]

Mike
User Avatar
Member
5 posts
Joined: 11月 2018
Offline
Ok, there seem to be several bugs/issues I'm finding here (Maya 2017 Update5).

Firstly the “Retain Attribute” Parameter was appearing as a String UI type at first. It seems to randomly get the Parameter UI types wrong. For example I exposed the “Hard Points” and “Hard Edges” and one appeared as a string and one as an incorrect Enum with only one option which was “@|pSphere1|pSphereShape1”

Secondly after the “Retain Attribute” was exposed and set to “Color (Cd)”, it made no difference to the result of the poly reduce, even though the mesh had vertex colours.

Any ideas?

Edited by Andrew.Seymour - 2018年12月5日 03:08:17

Attachments:
paramsAndAttrsError.jpg (343.0 KB)

User Avatar
Member
146 posts
Joined: 10月 2017
Offline
There is a bug in the plugin, unrelated to Update 5, where if a string parm has is able to have a menu, the attribute editor UI can get confused, depending on whether there would be any valid menu items at the time the plugin node is sync'd.

You don't necessarily need to expose that attribute though, The plugin will take the existing maya color sets, and copy them to houdini colors Cd, Cd2, …, so just specifying Cd inside the asset should get you the first maya color set
User Avatar
Member
5 posts
Joined: 11月 2018
Offline
I still can't get it to read the vertex colour even after reducing the asset to only have the percentage to keep as an exposed parameter. I've checked the tickbox in Houdini for “Retain Density By Attribute”, and set the Attribute to “Cd”

It works in Houdini, but not in Maya:





On another note, I've noticed that if the mesh in Maya has Vertex Alpha of a constant of 1.0 on all vertices, then when the asset is applied to the mesh that Houdini sees the Mesh as having 0.0 in the Alpha instead. If I paint a few vertices with a value other than 1.0 as in the attached example then the alpha values come through correctly.

Attachments:
houdiniVertexColorNotBeingRead.jpg (1.1 MB)
lod_houdini_01.ma (1.8 MB)
lod.hip (138.8 KB)
lod_asset.hda (3.5 KB)

User Avatar
Member
5 posts
Joined: 11月 2018
Offline
Ok, I think I'm making some progress.
I had to use a attribpromote from Point to Vertex (Cd) outside the Asset in order to preview in Houdini, and then an attribpromote Vertex to Point (Cd) inside the Asset to get the polyReduce node to use the vertex colour info in Maya.

I really think this needs explaining in the Houdini Maya workflow docs and tutorials. The fact that Houdini generally seems to use Points for data whereas Maya Maps to vertex or vertex face.

Now I've added a Python node to set the variable names as below, with my polyReduce node set to use Cd2 param. Unfortunately the order of the ‘maya_colorset_name’ tuple seems to make no difference as to which is being used for Cd2. Am I misunderstanding how maya_colorset_name maps to maya_colorset_mapped_Cd? In the example below I expected the ‘colorSet1’ to be used for my polyReduce node, but it doesn't

node = hou.pwd()
geo = node.geometry()
 
attributes = {
    'maya_uv_name': ['uvSet1', 'uvSet2'],
    'maya_uv_mapped_uv': ['uv', 'uv2'],
    'maya_uv_current': 'uvSet',
 
    'maya_colorset_name': ['colorSet_Lod', 'colorSet1'],
    'maya_colorset_mapped_Cd': ['Cd', 'Cd2'],
    'maya_colorset_mapped_Alpha': ['Alpha', 'Alpha2'],
    'maya_colorset_current': 'colorSet1',
}
 
for attr_name, attr_count in attributes.items():
    geo.addAttrib(hou.attribType.Global, attr_name, attr_count, transform_as_normal=False, create_local_variable=False)
    geo.setGlobalAttribValue(attr_name, attr_count)
Edited by Andrew.Seymour - 2018年12月5日 11:22:54
User Avatar
Member
5 posts
Joined: 11月 2018
Offline
The mapping between Maya colorsets and attributes in Houdini seems to be broken. It looks like it was broken on an earlier version of Houdini from reading posts too.

I've attached the simple source files I'm trying to use

In the Python node (Which I have to keep outside of the Asset, otherwise I get errors in Maya and no geometry created??), I set the mapping from the Maya colorSets to the Houdini Attributes like so:

    'maya_colorset_name': ['colorSet1', 'colorSetLod'],
    'maya_colorset_mapped_Cd': ['Cd', 'Cd2'],

However if I reverse the order of the maya_colorset_name,

'maya_colorset_name': ['colorSetLod', 'colorSet1'],

there is no reversal of effect in Maya. It's like it makes no difference what's in ‘maya_colorset_name’.

Can anybody test this for me? There seems to be very little information on this online.
Edited by Andrew.Seymour - 2018年12月6日 08:35:58

Attachments:
lod.hip (215.3 KB)
lod_houdini_01.ma (4.6 MB)
lod_asset.hda (4.2 KB)

User Avatar
Member
146 posts
Joined: 10月 2017
Offline
For inputs from maya to houdini the mapping attrs are there to inform the asset of how the mapping took place, there is currently no way to specify how the plugin names the color attributes when initializing the input.

So that if your asset wants to use a particularly named maya asset for some purpose it could use those mapping attributes look up which houdini color to use. e.g. in your LOD asset, you could have a python expression that looked up the color name that corresponded to colorSetLod, only promoted that color, and the alpha with the same index as the matching color, and used the promoted color in the polyreduce

You might want to modify the mapping of those attributes in the asset if you want to change the color mapping on output back to Maya: e.g. if:
- if you want to change the mapping of houdini color attributes to color sets maya output
- if you wanted to rename the color sets on output
- if you renamed the color attrs in the asset and you want to maintain the original mapping on output
- create a mapping for geometry originating in houdini.
  • Quick Links