Page 1 of 1
"float to int" and "texture switch"
Posted: Fri Jan 24, 2025 1:25 pm
by chocbot
We got a character from another company, where I need to apply different textures in one material based on groups. I have tried a simplified version for now - I have a float mask attribute, which does render correctly and then use the "float to int" node in octane and feed that into a "texture switch" but no success. How is this supposed to work?
Cheers
Re: "float to int" and "texture switch"
Posted: Sun Jan 26, 2025 12:00 pm
by galleon27
Just plug the textures into a gradient node like this:
Float to int expects float values as input but Float Vertex Attribute outputs Color values. That's why it's not working
Re: "float to int" and "texture switch"
Posted: Mon Jan 27, 2025 8:21 am
by chocbot
galleon27 wrote:Just plug the textures into a gradient node like this:
Screenshot 2025-01-26 125720.png
Float to int expects float values as input but Float Vertex Attribute outputs Color values. That's why it's not working
Thanks but yeah in that case I usually use the "tool mix texture" but in my current case it's a texture set and five groups, so I need to switch between 5 textures multiple times, so that workflow is quite impractical.
Re: "float to int" and "texture switch"
Posted: Mon Jan 27, 2025 8:39 am
by chocbot
skientia wrote:Is the setup identical to this example? Demonstrative setup in Standalone:
The project file (can be copy-pasted directly to Standalone, XML format)
Code: Select all
<?xml version='1.0' encoding='utf-8'?>
<OCS2 version='14000011'>
<graph id='1' type='1' name='clipboard'>
<graph id='7' type='1' name='texture-switch-variant-sets-demo' position='-5.3690085 87.309479'>
<attr name='color' type='8'>1 1 1</attr>
<node id='8' type='9' name='Int value' position='-102.131 -110.55948'>
<attr name='value' type='4'>1 0 0</attr>
</node>
<node id='9' type='33' name='tex__albedo_var2' position='-138.631 -14.309479'>
<attr name='value' type='8'>0.69999999 0.69999999 0.69999999</attr>
</node>
<node id='10' type='33' name='tex_roughness_var2' position='195.46506 -56.678596'>
<attr name='value' type='8'>0.69999999 0.69999999 0.69999999</attr>
</node>
<node id='11' type='33' name='tex__albedo_var1' position='-280.63098 -14.309479'>
<attr name='value' type='8'>0.69999999 0.69999999 0.69999999</attr>
</node>
<node id='12' type='33' name='tex_roughness_var1' position='35.035675 -55.642815'>
<attr name='value' type='8'>0.69999999 0.69999999 0.69999999</attr>
</node>
<node id='13' type='130' name='Universal material' position='259.36902 93.690521'>
<attr name='compatibilityVersion' type='2'>14000011</attr>
<pin name='transmissionType'>
<node id='14' type='57'>
<attr name='value' type='2'>0</attr>
</node>
</pin>
<pin name='albedo' connect='57'/>
<pin name='diffuseBrdf'>
<node id='15' type='57'>
<attr name='value' type='2'>1</attr>
</node>
</pin>
<pin name='metallic'>
<node id='16' type='31'>
<attr name='value' type='6'>0</attr>
</node>
</pin>
<pin name='edgeTint'>
<node id='17' type='33'>
<attr name='value' type='8'>1 1 1</attr>
</node>
</pin>
<pin name='specular'>
<node id='18' type='31'>
<attr name='value' type='6'>1</attr>
</node>
</pin>
<pin name='brdf'>
<node id='19' type='57'>
<attr name='value' type='2'>0</attr>
</node>
</pin>
<pin name='roughness' connect='55'/>
<pin name='anisotropy'>
<node id='20' type='6'>
<attr name='value' type='8'>0 0 0</attr>
</node>
</pin>
<pin name='rotation'>
<node id='21' type='31'>
<attr name='value' type='6'>0</attr>
</node>
</pin>
<pin name='spread'>
<node id='22' type='6'>
<attr name='value' type='8'>0.5 0 0</attr>
</node>
</pin>
<pin name='index4'>
<node id='23' type='6'>
<attr name='value' type='8'>1.5 0 0</attr>
</node>
</pin>
<pin name='metallicMode'>
<node id='24' type='57'>
<attr name='value' type='2'>0</attr>
</node>
</pin>
<pin name='index'>
<node id='25' type='6'>
<attr name='value' type='8'>0 0 0</attr>
</node>
</pin>
<pin name='index2'>
<node id='26' type='6'>
<attr name='value' type='8'>0 0 0</attr>
</node>
</pin>
<pin name='index3'>
<node id='27' type='6'>
<attr name='value' type='8'>0 0 0</attr>
</node>
</pin>
<pin name='hasCaustics'>
<node id='28' type='11'>
<attr name='value' type='1'>0</attr>
</node>
</pin>
<pin name='coating'>
<node id='29' type='33'>
<attr name='value' type='8'>0 0 0</attr>
</node>
</pin>
<pin name='coatingRoughness'>
<node id='30' type='31'>
<attr name='value' type='6'>0.063199997</attr>
</node>
</pin>
<pin name='coatingIndex'>
<node id='31' type='6'>
<attr name='value' type='8'>1.5 0 0</attr>
</node>
</pin>
<pin name='filmwidth'>
<node id='32' type='31'>
<attr name='value' type='6'>0</attr>
</node>
</pin>
<pin name='filmindex'>
<node id='33' type='6'>
<attr name='value' type='8'>1.45 0 0</attr>
</node>
</pin>
<pin name='sheen'>
<node id='34' type='33'>
<attr name='value' type='8'>0 0 0</attr>
</node>
</pin>
<pin name='sheenRoughness'>
<node id='35' type='31'>
<attr name='value' type='6'>0.2</attr>
</node>
</pin>
<pin name='dispersion_coefficient_B'>
<node id='36' type='6'>
<attr name='value' type='8'>0 0 0</attr>
</node>
</pin>
<pin name='dispersionMode'>
<node id='37' type='57'>
<attr name='value' type='2'>1</attr>
</node>
</pin>
<pin name='opacity'>
<node id='38' type='31'>
<attr name='value' type='6'>1</attr>
</node>
</pin>
<pin name='fake_shadows'>
<node id='39' type='11'>
<attr name='value' type='1'>0</attr>
</node>
</pin>
<pin name='refractionAlpha'>
<node id='40' type='11'>
<attr name='value' type='1'>0</attr>
</node>
</pin>
<pin name='bumpHeight'>
<node id='41' type='6'>
<attr name='value' type='8'>0.001 0 0</attr>
</node>
</pin>
<pin name='smooth'>
<node id='42' type='11'>
<attr name='value' type='1'>1</attr>
</node>
</pin>
<pin name='smoothShadowTerminator'>
<node id='43' type='11'>
<attr name='value' type='1'>0</attr>
</node>
</pin>
<pin name='roundEdges'>
<node id='44' type='137'>
<attr name='compatibilityVersion' type='2'>14000011</attr>
<pin name='roundEdgesMode'>
<node id='45' type='57'>
<attr name='value' type='2'>1</attr>
</node>
</pin>
<pin name='roundEdgesRadius'>
<node id='46' type='6'>
<attr name='value' type='8'>0 0 0</attr>
</node>
</pin>
<pin name='roundEdgesCurvatureRoundness'>
<node id='47' type='6'>
<attr name='value' type='8'>1 0 0</attr>
</node>
</pin>
<pin name='roundEdgesSampleCount'>
<node id='48' type='9'>
<attr name='value' type='4'>8 0 0</attr>
</node>
</pin>
<pin name='roundEdgesConsiderOtherObjects'>
<node id='49' type='11'>
<attr name='value' type='1'>0</attr>
</node>
</pin>
</node>
</pin>
<pin name='priority'>
<node id='50' type='9'>
<attr name='value' type='4'>0 0 0</attr>
</node>
</pin>
<pin name='matte'>
<node id='51' type='11'>
<attr name='value' type='1'>0</attr>
</node>
</pin>
<pin name='customAov'>
<node id='52' type='57'>
<attr name='value' type='2'>4096</attr>
</node>
</pin>
<pin name='customAovChannel'>
<node id='53' type='57'>
<attr name='value' type='2'>0</attr>
</node>
</pin>
<pin name='layer'>
<node id='54' type='144'>
<attr name='pin_count' type='2'>0</attr>
</node>
</pin>
</node>
<node id='55' type='40005' name='Texture switch' position='61.035675 -8.6428146'>
<attr name='optionCount' type='2'>2</attr>
<pin name='index' connect='8'/>
<pin name='Input 1' dynamicType='5' connect='12'/>
<pin name='Input 2' dynamicType='5' connect='10'/>
</node>
<node id='56' type='68' name='Note' position='158.11853 131.76161'>
<attr name='value' type='10'>• int value: controls the switch numerical value, here simultaneously.
• Example with "Albedo" variable 1 and 2
↳ tex_albedo_var1 is the "base color" of a typical "PBR" asset texture "channel", and var2 is a variant of it
↳ changing the “Int value” from 1 to 2, switches the "texture set" from var1 to var2 for both the "Albedo" and "Roughness since Int Value node is plugged in both.</attr>
<attr name='color' type='8'>0.5 0.5 0.5</attr>
<attr name='size' type='3'>800 23</attr>
</node>
<node id='57' type='40005' name='Texture switch' position='-187.631 34.690521'>
<attr name='optionCount' type='2'>2</attr>
<pin name='index' connect='8'/>
<pin name='Input 1' dynamicType='5' connect='11'/>
<pin name='Input 2' dynamicType='5' connect='9'/>
</node>
</graph>
</graph>
</OCS2>
Hey, thanks for your response. What I'm trying to do should actually look like that:

But then with multiples of these texture switch constructs.
The red arrow is where I actually have a connection in Houdini, seems like this is what's not working. Probably like galleon27 said but there is no conversion node from vector to floats, or is there?
Re: "float to int" and "texture switch"
Posted: Mon Jan 27, 2025 8:50 am
by galleon27
chocbot wrote:galleon27 wrote:Just plug the textures into a gradient node like this:
Screenshot 2025-01-26 125720.png
Float to int expects float values as input but Float Vertex Attribute outputs Color values. That's why it's not working
Thanks but yeah in that case I usually use the "tool mix texture" but in my current case it's a texture set and five groups, so I need to switch between 5 textures multiple times, so that workflow is quite impractical.
Then just plug in more textures in gradient node.
Re: "float to int" and "texture switch"
Posted: Mon Jan 27, 2025 9:05 am
by chocbot
galleon27 wrote:chocbot wrote:galleon27 wrote:Just plug the textures into a gradient node like this:
Screenshot 2025-01-26 125720.png
Float to int expects float values as input but Float Vertex Attribute outputs Color values. That's why it's not working
Thanks but yeah in that case I usually use the "tool mix texture" but in my current case it's a texture set and five groups, so I need to switch between 5 textures multiple times, so that workflow is quite impractical.
Then just plug in more textures in gradient node.
Oh, I didn't understand you meant this could be used for more than two textures - that works, thanks!

Re: "float to int" and "texture switch"
Posted: Mon Jan 27, 2025 9:10 am
by chocbot
So I have a solution!
Though, I'd still be interested about the texture switch node's workflow? Is it not supposed to be used with attributes to control it? What's the use case then?