Jump to content

How to show different textures using attribute [ Redshift ]


wyy

Recommended Posts

So I have point attribute named - frame. And I have multiple files named "code (1).png", "code (2).png", "code (3).png"....  To pass attribute to material network I use RSUserDataColor node, but I'm not sure how to pass that value to the texture string, pls help me.

image.png.37a8983ec9e3577bb3219c7e82603cba.png


image.png.abfd2f4a32813bb9fdfd3011b2d3f499.png

hip_file.zip

Edited by wyy
Link to comment
Share on other sites

  • 4 weeks later...

Hello there.

I hope this topic is still actual.

I made some tests with your scene.

First of all I renamed your textures. There is not a good style having whitespaces in file names. Then I added zero padding to numbers:
image.png.e0a05e5f6edc11a1f67ad99d9faa3cb4.png

Next. If you want to use animation texture in RS shader you should get it via COP network. It appears that RS doesn't like expressions in a texture name:
image.png.e9fc1faf4a7c0e33486c77b01aa1dd58.png

Make It like this:
image.png.e05ee08f4a1c73b275c0d357233ea6a0.png

image.png.33e3ce65b57986b7c152bab8f309e699.png

image.png.d16e44e534a278808328ec6ee9c2ff1c.png

It works. But every element has the same texture

frame1
image.png.26694c6f6c34cec65d05ad83ea9eb2bd.png

frame2

image.png.d46f23f10ee45e7feea6de7a53f36d6e.png

Unfortunately Maxon has not made ability to connect anything to the filename channel of the RS texture sampler. So we can not use geometry attribute in there. (or I did not find how to) But I found this. We can use shader switcher if there are not so many textures to switch.

I added primitive attribute "texturenum" and gave it values according to the piece number and and the frame number:

image.png.d3f42e23f5fae06840f5b93c74c5fc48.png

image.png.b67ab4687a60dfdeb1b81c03186e28fb.png

Then I promoted this attribute to vertices as RS gets user data from vertices.

image.png.e61f273cc01cf2523fc0c93256fdedd7.png

And the modified the shader:

image.png.ca9514332846f37d985914c7af6692c4.png

Now it works like a charm. But It convenient only for relatively small amount of textures.

frame1

image.png.c65d86cc4c2be71872cf16fed8ee2e5e.png

frame2

image.png.7cbc342ead445abf8ec890d3395b025e.png

If we want to rule every texture thru the attribute we can make appropriate shader parameters and override them in Material node

image.png.13b7e212fcdb7c46ed4fdcac5029ea74.png

image.png.0f0ef766dfc6a1bbc9540a3279c1466b.png

As in previous example I added "texturenum" primitive attribute and created variable TEXTURENUM. I'll use it to override texture name:

image.png.5df6ce1435747f6daaa470bd668465c5.png

image.png.252a0098052204ec9ea9fe1b185730cf.png

And voilàRSTexturesByAttribute.7z

Link to comment
Share on other sites

You could try the trick of placing your entire material into a subnet. Then go up one level and create a file parm on the subnet.  Browse to your file sequence, and then create a relative reference to the file name field on the Texture Sampler node.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...