Jump to content
Sign in to follow this  
palosanto

Turning off a specific texture

Recommended Posts

I need to be able to turn on/off a specific texture in a material.  The 'selection' texture tag parameter does exactly that, if it's empty the texture shows and renders normally but any other entry, number or string turns the texture off.    I want to have a toggle as one of many other things I'm doing in an Xpresso custom panel.
How can I make the 'selection' parameter input anything say "1"  to turn the texture off or leave the field empty to enable the texture.
A boolean doesn't work because its either TRUE or FALSE and it outputs one of this two words as a string in the field so it always results on the texture being turned off. Tu be turned on, the field needs to be empty.
I could use a String type data field and leave it empty to display the texture or enter anything to turn it off but I wander if there is a better way.

 

Tag.jpg

Share this post


Link to post

Use condition node. With bool (or integer user data which you get more options) drive output of condition node in string mode...

Share this post


Link to post

The field is a string so using an empty string or a "somethingortheother" string is quite correct for this specific purpose.

 

The reason why this is a string and not a link is, you can put in symbolic and inherited textures that are "found by name", e.g. "R1" which exists only in the virtual object hierarchy.

 

I actually wish there were a different way to switch off selected texture tags in C4D - after all, you may have a valid selection, which you would need to restore after having a temporary invalid selection in that field for a while... this can be cumbersome.

Share this post


Link to post
  • Topic Author
  • Author of the topic Posted
    12 hours ago, bezo said:

    Use condition node. With bool (or integer user data which you get more options) drive output of condition node in string mode...

    Thanks but I'm not sure if I followed what you suggest:
    - I made the input to the Condition switch a boolean (Texture control node)
    - The two constants for the switch are an empty string and a non-empty string
    - The Condition output fills the "Selection" field in the Texture tag

    But it doesn't work ...  can you see what's wrong?


    UPDATE: I had the data type wrong in Condition.  It works now. 🙂

     

     

    Condition.jpg

    Share this post


    Link to post

    not needed to create extra nodes for string names, simply open condition node and set names there...

    Hide_mat_xp.zip

    Share this post


    Link to post
  • Topic Author
  • Author of the topic Posted

    ah!  thanks

    Share this post


    Link to post

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    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.

    Sign in to follow this  

    • Recently Browsing   0 members

      No registered users viewing this page.

    ×
    ×
    • Create New...

    FORUMS INFO:

    Dear members, we are aware of few more bugs that are still present withing the theme.We just wanted to let you know that we are working to fix them as soon as possible.
     

    NEW MEMBERS:

    Please be aware that we are manually approving all new registrations, due to spam prevention. Please be patient in case you cannot login right away, we will approve you within 12h or less if we decide you are not potential spammer. 

     

    Thanks for understanding! :cowboypistol: