MATERIAL override in LOP/SOLARIS, reading primvar

   1537   7   2
User Avatar
Member
19 posts
Joined: March 2020
Offline
Hi everyone! been testing out USD on a project.

in SOPs, I was able to have a

1. texture file name on as an attribute on PRIM.
2. and via using material override, I was able to "change" the texture file on the material.



I was trying to replicate this on SOLARIS, but was having a hard time.
In fact did some research on the forum, sounds like it might not be possible. I am running REDSHIFT.



After searching online forums, I tried the above, but not working. not sure if I have done it wrong, or if it is REDSHIFT issue?

thank you in advance for all your help!

Attachments:
Screenshot_502.jpg (32.4 KB)
Screenshot_504.jpg (64.8 KB)

User Avatar
Staff
4517 posts
Joined: July 2005
Offline
I don't know if redshift is capable of this, but I would expect it is... The key thing is that your material needs to have a "primvar reader" node to let it know it should be looking for the textureReader primvar on the geometry to determine which texture to load. Attached is an example that shows a couple of different ways of setting such primvars. In both cases the material is a simple USD preview surface with a UV Texture node driving the diffuse color, and a primvar reader node driving the file input of the UV Texture node.

Attachments:
material_variation.hip (200.9 KB)

User Avatar
Member
19 posts
Joined: March 2020
Offline
Thank you for your response and the sample file! i had a look and learned few new things!

I apologize if my wording was bit confusing due to terms, still learning the USD terms.

I have also attached a sample HIP file.





so basically I have a situation where each SOP primitives (as in each mesh faces) need to have different texture applied to them.
so each SOP primitive will have s@mytexture = "random_texture.jpg". However, this is a single MESH.

with HOUDINI, I could use the and use material override to get material to read different texture file for different faces.

However, I was having difficulty achieving this with SOLARIS.

Further assistance would be greatly appreciated!!
Edited by alteredgene - April 3, 2024 00:41:55

Attachments:
SOLARIS_materialVariationPrimAttrib.hip (147.8 KB)
Screenshot_505.jpg (110.4 KB)

User Avatar
Staff
4517 posts
Joined: July 2005
Offline
Sorry, I'm a bit confused... Your hip file works as is, at least when rendering with karma... I actually thought this would work with Houdini GL as well but it appears not.
User Avatar
Member
174 posts
Joined: Jan. 2015
Offline
Just a little heads-up regarding Redshift.

To use primvar strings with Redshift, you need to feed the string into this OSL shader [github.com] using the "RS String User Data" node.
Edited by Heileif - April 3, 2024 19:18:38
User Avatar
Member
19 posts
Joined: March 2020
Offline
Thank you for all your responses.

@mtucker, yes you are right, it works in karma. my apologies. since your example worked on the viewport, when I did not see my viewport showing the result, I just assumed I did something wrong.

However, I am trying to get the setup running in REDSHIFT, and still having problem.

@Heilieif, thank you for the comment. I have downloaded the OSL, and have it setup. the setup seems to be working (I can at least see the default texture showing up from "RS string user date". however, its not reading the .png files I have setup as an attribute.

NOTE I had to replace .rat files to .png files to get them rendering in REDSHIFT.

also attached the HIP file with redshift setting.



Attachments:
Screenshot_508.jpg (70.7 KB)
Screenshot_506.jpg (193.2 KB)
Screenshot_507.jpg (121.3 KB)
SOLARIS_materialVariationPrimAttrib.hip (180.7 KB)

User Avatar
Member
3 posts
Joined: July 2023
Offline
Have you found a proper solution for this?
User Avatar
Member
162 posts
Joined: Nov. 2016
Offline
Hi!

In Redshift, the string user data works only on instances point attributes, no on point/vertex mesh attributes.
  • Quick Links