Using Primvar in Solaris to assign materials to parts of geo

   1449   19   2
User Avatar
Member
35 posts
Joined: June 2021
Offline
Hi,

I have a project where I bought an Old Book HDA so I could have a rigged book on a table and I need to assign different words and photos to different pages of the book. The Pages geo is one object but there is an attribute called "class" that is unique to each page number, so I figure there's a way to get different photos and text on different pages using that attribute. I'd like to assign a different material (that I will create containing different digital photos in the base color) to each page.

I'm in Solaris/Karma CPU so I would be using the primvar "class" I think.

Attached is a screenshot.

The project with all the assets and textures is 3GB but I can respond with a download link if needed.

thanks!

Attachments:
Houdini_Pages_Assign.png (8.9 MB)

-Dan Huiting
User Avatar
Member
725 posts
Joined: July 2005
Offline
The Component Geometry, SOP Import, and Scene Import LOPs have a parameter called Partition Attributes. If you set the class primvar there, it should give you a USD GeomSubset per page under the mesh prim. You can assign different materials to those GeomSubsets.
User Avatar
Member
35 posts
Joined: June 2021
Offline
Siavash Tehrani
The Component Geometry, SOP Import, and Scene Import LOPs have a parameter called Partition Attributes. If you set the class primvar there, it should give you a USD GeomSubset per page under the mesh prim. You can assign different materials to those GeomSubsets.

Thank you! This is a great idea and I will try it now. Is there a way to assign a marker to the class primvar so I can tell which page number is which in the viewport?

I know how to do this outside of Solaris with markers, but in solaris that button on the right of the viewport that normally does the markers is missing.
-Dan Huiting
User Avatar
Member
8723 posts
Joined: July 2007
Offline
since you are using Karma CPU you can also create primitive string attribute containing path to the photo or texture directly

this will translate into uniform primvar on stage

then in material
if you are using VEX you can use Bind VOP set to string to import it and plug into texture ports of principled shader
or in MtlX you can use MtlX Geometry Property Value or USD Primvar Reader set to String to import it and plug into USD UV Texture
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
35 posts
Joined: June 2021
Offline
Thank you both so much!

I got it working. Scene is not finished but you get the idea...

Now I just need to learn Substance painter and get some texture on the pages and create the book cover

thanks,
Dan

Attachments:
Screenshot 2024-07-18 at 11.13.50AM.png (8.9 MB)

-Dan Huiting
User Avatar
Member
35 posts
Joined: June 2021
Offline
...I forgot one question:

I need to have pages be two sided so each side has a different material. Is this possible in MTLX?
-Dan Huiting
User Avatar
Member
144 posts
Joined: May 2021
Online
dhuiting
Now I just need to learn Substance painter and get some texture on the pages and create the book cover

It is worth exploring the new 20.5 Copericous context.

"Professionally Incorrect"'s Youtube demonstrates a technique for book covers:
Houdini 20.5 Release Day Live Stream! Come Hang out! [www.youtube.com]

Texturing is also a strong point of the new context.
Using Custom Geometry in COP's | Intro to COPs | Houdini 20.5 [www.youtube.com]

You can look into the Slap Comp to bring in the Solaris render as well for post-process.
Brave, Big-hearted Rebel
------
Design the Future, Now.
PHENOM DESIGN
------
Processing smarter, not harder on a M3 MAX 36GB
User Avatar
Member
725 posts
Joined: July 2005
Offline
dhuiting
Thank you both so much!

I got it working. Scene is not finished but you get the idea...

Now I just need to learn Substance painter and get some texture on the pages and create the book cover

thanks,
Dan

Right on Dan. As far as your other question, you can do two-sided materials in a Karma Material Builder using the Karma Ray Import VOP and setting the Variable Name to ray:backface. The output can then be used in a MtlX Mix node to mix between two inputs, including materials.
Though it does look like the pages have thickness? Looks like there are some normals issues with the edges too.
User Avatar
Member
35 posts
Joined: June 2021
Offline
Siavash Tehrani
dhuiting
Thank you both so much!

I got it working. Scene is not finished but you get the idea...

Now I just need to learn Substance painter and get some texture on the pages and create the book cover

thanks,
Dan

Right on Dan. As far as your other question, you can do two-sided materials in a Karma Material Builder using the Karma Ray Import VOP and setting the Variable Name to ray:backface. The output can then be used in a MtlX Mix node to mix between two inputs, including materials.
Though it does look like the pages have thickness? Looks like there are some normals issues with the edges too.


Thank you! This is so helpful!! I will look into this. I don't know what I would do without this forum.
-Dan Huiting
User Avatar
Member
35 posts
Joined: June 2021
Offline
PHENOMDESIGN
dhuiting
Now I just need to learn Substance painter and get some texture on the pages and create the book cover

It is worth exploring the new 20.5 Copericous context.

"Professionally Incorrect"'s Youtube demonstrates a technique for book covers:
Houdini 20.5 Release Day Live Stream! Come Hang out! [www.youtube.com]

Texturing is also a strong point of the new context.
Using Custom Geometry in COP's | Intro to COPs | Houdini 20.5 [www.youtube.com]

You can look into the Slap Comp to bring in the Solaris render as well for post-process.

Thank you! I would love to learn COPS and do all of this within Houdini without having to subscribe to Substance Painter, so I will go through these 2 videos this weekend and check it out.

Also, what's the "Slap Comp" and how do I bring in the Solaris render?
-Dan Huiting
User Avatar
Member
35 posts
Joined: June 2021
Offline
Siavash Tehrani
Though it does look like the pages have thickness? Looks like there are some normals issues with the edges too.

The pages have thickness yes, there's a poly extrude somewhere, and then some bend and twist effects. I noticed the edges of the pages round a little at the ends which I don't like. Is that what you were seeing with the normals? Can I just add a normal node at the end of the chain in SOPS to fix this?

The HDA I bought for this Old Book rig is SOOO complicated. Far above my knowledge. There is a lot of wrangles with VEX, and complicated For Each loops, and a whole section where bones are rigged that I don't understand. Every time I've tried to make changes to the actual pages geo I've ended up with strange results, so I'm trying to figure out how to fix the normals in a way that is doable for me. I can post screenshots of the nodes or message you a link to download the project file if that would help.

Anyway, thanks for all your help!
-Dan Huiting
User Avatar
Member
144 posts
Joined: May 2021
Online
dhuiting
Also, what's the "Slap Comp" and how do I bring in the Solaris render?

Here is a tutorial on this:
Houdini 20.5 - toon shading using copernicus [www.youtube.com]
Brave, Big-hearted Rebel
------
Design the Future, Now.
PHENOM DESIGN
------
Processing smarter, not harder on a M3 MAX 36GB
User Avatar
Member
35 posts
Joined: June 2021
Offline
Thank you all! This is all very helpful and I am getting through the Youtube videos now.

You're the best!
-Dan Huiting
User Avatar
Member
35 posts
Joined: June 2021
Offline
Siavash Tehrani
Looks like there are some normals issues with the edges too.

Still trying to get the normals and UVs right. There is a smearing effect on the edge of the book cover that I don't know how to fix.
I went back into SOPs and deleted uv attribute, added Labs Auto UV node set to "unwrap" and the UVs look better now, but the material still has the smear effect on the edges (see screenshot)

Also, I added a normal node at the end of the chain in SOPs (for the book cover) and that didn't fix the issue either.

What can I try to fix the normals and get this to look right? Happy to send DL link to project if needed.

thanks,

Attachments:
weird smear on material.png (866.8 KB)
weird edges.png (888.0 KB)
NEW UV with Labs AutoUV_uv view.png (863.5 KB)
New UV with auto UV_perpective view.png (706.0 KB)
added new normal node.png (965.6 KB)

-Dan Huiting
User Avatar
Member
35 posts
Joined: June 2021
Offline
Siavash Tehrani
dhuiting
Thank you both so much!

I got it working. Scene is not finished but you get the idea...

Now I just need to learn Substance painter and get some texture on the pages and create the book cover

thanks,
Dan

Right on Dan. As far as your other question, you can do two-sided materials in a Karma Material Builder using the Karma Ray Import VOP and setting the Variable Name to ray:backface. The output can then be used in a MtlX Mix node to mix between two inputs, including materials.
Though it does look like the pages have thickness? Looks like there are some normals issues with the edges too.

I tried the ray:backface which worked if I unchecked the "thicken pages" box on the HDA (it's a polyextrude and a bevel in a "for each piece or point" loop) but the text is backwards now. I guess I could just reverse the texture in photoshop to fix that, but I really like thick thicker pages look.

There is a class attribute assigned to each page in a connectivity node and that's how I have different materials on different pages, but I'm wondering how to do this with the thickness. I could manually select only those polygons and create groups, but I would have to do that 160 times with 160 groups. (There are 80 pages.)

I thought of grouping based on normal direction somehow but the pages are animated and change direction when they turn over. How should I get an attribute that is an integer to be on each side of the thickened pages?
-Dan Huiting
User Avatar
Member
725 posts
Joined: July 2005
Offline
The pages should be topologically consistent, so if you do your face selections inside of a for-loop and create the attribute there, it should be valid for all pages.

Attachments:
pages.mp4 (13.9 MB)
pages.hip (490.7 KB)

User Avatar
Member
35 posts
Joined: June 2021
Offline
Siavash Tehrani
The pages should be topologically consistent, so if you do your face selections inside of a for-loop and create the attribute there, it should be valid for all pages.

This is awesome. Thank you so much for the video. I'm wondering what button you are pushing to select the top points in the video in addition to the edge loop (a + mmb).
-Dan Huiting
User Avatar
Member
725 posts
Joined: July 2005
Offline
No problem. And it's Shift+H after you have an enclosed selection, super handy.
User Avatar
Member
35 posts
Joined: June 2021
Offline
Siavash Tehrani
No problem. And it's Shift+H after you have an enclosed selection, super handy.


Awesome! thanks so much.
-Dan Huiting
User Avatar
Member
3 posts
Joined: July 2023
Offline
Hey guys, this seems to be the perfect place for my question.
I am also working on something quite similar. A vellum simulation that contains lots of paper sheets that are blown around in the wind, I have also partitioned my geo in the Sop-Import. But instead of assigning a unique texture to each partitioned piece of geo I want to automate it a bit. I basically want a specific primvar for each partitioned geo that contains the path to the texture. At the sop level I created a string attribute on the primitives that contains a unique texture path for each primitive (this was done with the help of the class attribute). The problem now is, that this String attribute/primvar only exists on the "parent geo" but not on the GeomSubset. In the end I would love to read in this primvar, that is unique for every geo in feed it into the file in the texture node on the material level.
I am using Redshift and would realise this via an OSL-Node called UberTexture.
Is this the right track I am on and if so, how could I get the texture_path attribute on the subsets?
Edited by viscu - Aug. 4, 2024 07:22:58

Attachments:
Screenshot 2024-08-04 at 12.59.47.png (1.4 MB)
Screenshot 2024-08-04 at 13.07.50.png (627.3 KB)

  • Quick Links