is it possible to change a material depending on whether it is intersecting with another object?Fake Bool operation with OSL shaderIs it possible to copy a certain property of a certain material to other materials?Material that's only visible if seen through another materialHow to find and change material for certain faces?Holdout plus glass shader problem!How to render material with alpha channel seen through material with haloHow to change edit material assignments after joining meshesHow to link a variable of a material to another material?How can i change the color of a material created with the PBR addonswap one material with another

What's the biggest difference between these two photos?

Why would an airport be depicted with symbology for runways longer than 8,069 feet even though it is reported on the sectional as 7,200 feet?

Bit floating sequence

The meaning of "offing" in "an agreement in the offing"

What makes an ending "happy"?

Schrodinger's Cat Isn't Meant To Be Taken Seriously, Right?

How strong is aircraft-grade spruce?

Are professors obligated to accept supervisory role? If not, how does it work?

How to finish my PhD?

Template default argument loses its reference type

The Green Glass Door, Revisited

How can faith be maintained in a world of living gods?

Does the word voltage exist in academic engineering?

Did "Dirty Harry" feel lucky?

Entering the US with dual citizenship but US passport is long expired?

Do you need to burn fuel between gravity assists?

Yet another calculator problem

Should I tip on the Amtrak train?

I won a car in a poker game. How is that taxed in Canada?

After a few interviews, What should I do after told to wait?

indexes are not created on localdb

Problem with ls inside bash script

How invisible hand adjusts stock prices if company is listed on multiple exchanges, under multiple currencies, and one of the currencies plunges?

Furthest distance half the diameter?



is it possible to change a material depending on whether it is intersecting with another object?


Fake Bool operation with OSL shaderIs it possible to copy a certain property of a certain material to other materials?Material that's only visible if seen through another materialHow to find and change material for certain faces?Holdout plus glass shader problem!How to render material with alpha channel seen through material with haloHow to change edit material assignments after joining meshesHow to link a variable of a material to another material?How can i change the color of a material created with the PBR addonswap one material with another






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2












$begingroup$


Let's say I have a sphere, halfway intersecting with a cube(which is invisible to the camera). I want to change the material of the part of the sphere that is intersecting with the box, similar to this image:



like this










share|improve this question









$endgroup$













  • $begingroup$
    With a cube, it wouldn't be necessary, but in some situations, OSL might help
    $endgroup$
    – Robin Betts
    4 hours ago

















2












$begingroup$


Let's say I have a sphere, halfway intersecting with a cube(which is invisible to the camera). I want to change the material of the part of the sphere that is intersecting with the box, similar to this image:



like this










share|improve this question









$endgroup$













  • $begingroup$
    With a cube, it wouldn't be necessary, but in some situations, OSL might help
    $endgroup$
    – Robin Betts
    4 hours ago













2












2








2





$begingroup$


Let's say I have a sphere, halfway intersecting with a cube(which is invisible to the camera). I want to change the material of the part of the sphere that is intersecting with the box, similar to this image:



like this










share|improve this question









$endgroup$




Let's say I have a sphere, halfway intersecting with a cube(which is invisible to the camera). I want to change the material of the part of the sphere that is intersecting with the box, similar to this image:



like this







materials geometry






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 8 hours ago









snipers500snipers500

921 silver badge7 bronze badges




921 silver badge7 bronze badges














  • $begingroup$
    With a cube, it wouldn't be necessary, but in some situations, OSL might help
    $endgroup$
    – Robin Betts
    4 hours ago
















  • $begingroup$
    With a cube, it wouldn't be necessary, but in some situations, OSL might help
    $endgroup$
    – Robin Betts
    4 hours ago















$begingroup$
With a cube, it wouldn't be necessary, but in some situations, OSL might help
$endgroup$
– Robin Betts
4 hours ago




$begingroup$
With a cube, it wouldn't be necessary, but in some situations, OSL might help
$endgroup$
– Robin Betts
4 hours ago










3 Answers
3






active

oldest

votes


















1














$begingroup$

You could create 2 spheres on the exact same position, each with its own texture, then 1 cube. Give each sphere a Boolean modifier, one with the Difference mode, the other with the Intersect mode, and both with the cube as Object. This way, when you'll move the cube, it will both hide a sphere and reveal the other one.



enter image description here






share|improve this answer











$endgroup$














  • $begingroup$
    Thanks, I ended up using this method, (which also happened to be the way I made the reference image, so I'm just dumb)
    $endgroup$
    – snipers500
    7 hours ago






  • 1




    $begingroup$
    Could work with only one cube, I think. using intersection and difference.
    $endgroup$
    – lemon
    6 hours ago










  • $begingroup$
    oh yes of course, I'm going to correct
    $endgroup$
    – moonboots
    6 hours ago


















3














$begingroup$

An update, thanks to moonboots comments:



It is possible using Cycles:



enter image description here



The shader simply tests if the transparent depth is at least 1 as the cube is transparent but also we don't want more than one (as if not the cube shape may appear in non ortho views):



enter image description here








share|improve this answer











$endgroup$














  • $begingroup$
    I thought you had the solution but actually what you propose is to display another texture through the cube transparency, which is not exactly what he's looking for, at least it's what I understand
    $endgroup$
    – moonboots
    6 hours ago










  • $begingroup$
    @moonboots, don't get what you mean
    $endgroup$
    – lemon
    6 hours ago










  • $begingroup$
    Could you please share your file?
    $endgroup$
    – moonboots
    6 hours ago










  • $begingroup$
    @moonboots, sure: updated above
    $endgroup$
    – lemon
    6 hours ago






  • 1




    $begingroup$
    so yes, that's what I thought, actually the new texture is not displayed at the objects intersection but where the transparency happens, which is not the same... On the left what is supposed to happen, on the right what happens with your method: zupimages.net/up/19/36/tl1c.jpg
    $endgroup$
    – moonboots
    6 hours ago


















-1














$begingroup$

"Dynamic paint" could be the way to go. Check YouTube for a tutorial on that. For example: https://www.youtube.com/watch?v=PcWXFtnh2bk






share|improve this answer









$endgroup$

















    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "502"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );














    draft saved

    draft discarded
















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fblender.stackexchange.com%2fquestions%2f151049%2fis-it-possible-to-change-a-material-depending-on-whether-it-is-intersecting-with%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    $begingroup$

    You could create 2 spheres on the exact same position, each with its own texture, then 1 cube. Give each sphere a Boolean modifier, one with the Difference mode, the other with the Intersect mode, and both with the cube as Object. This way, when you'll move the cube, it will both hide a sphere and reveal the other one.



    enter image description here






    share|improve this answer











    $endgroup$














    • $begingroup$
      Thanks, I ended up using this method, (which also happened to be the way I made the reference image, so I'm just dumb)
      $endgroup$
      – snipers500
      7 hours ago






    • 1




      $begingroup$
      Could work with only one cube, I think. using intersection and difference.
      $endgroup$
      – lemon
      6 hours ago










    • $begingroup$
      oh yes of course, I'm going to correct
      $endgroup$
      – moonboots
      6 hours ago















    1














    $begingroup$

    You could create 2 spheres on the exact same position, each with its own texture, then 1 cube. Give each sphere a Boolean modifier, one with the Difference mode, the other with the Intersect mode, and both with the cube as Object. This way, when you'll move the cube, it will both hide a sphere and reveal the other one.



    enter image description here






    share|improve this answer











    $endgroup$














    • $begingroup$
      Thanks, I ended up using this method, (which also happened to be the way I made the reference image, so I'm just dumb)
      $endgroup$
      – snipers500
      7 hours ago






    • 1




      $begingroup$
      Could work with only one cube, I think. using intersection and difference.
      $endgroup$
      – lemon
      6 hours ago










    • $begingroup$
      oh yes of course, I'm going to correct
      $endgroup$
      – moonboots
      6 hours ago













    1














    1










    1







    $begingroup$

    You could create 2 spheres on the exact same position, each with its own texture, then 1 cube. Give each sphere a Boolean modifier, one with the Difference mode, the other with the Intersect mode, and both with the cube as Object. This way, when you'll move the cube, it will both hide a sphere and reveal the other one.



    enter image description here






    share|improve this answer











    $endgroup$



    You could create 2 spheres on the exact same position, each with its own texture, then 1 cube. Give each sphere a Boolean modifier, one with the Difference mode, the other with the Intersect mode, and both with the cube as Object. This way, when you'll move the cube, it will both hide a sphere and reveal the other one.



    enter image description here







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited 6 hours ago

























    answered 7 hours ago









    moonbootsmoonboots

    21.2k2 gold badges15 silver badges32 bronze badges




    21.2k2 gold badges15 silver badges32 bronze badges














    • $begingroup$
      Thanks, I ended up using this method, (which also happened to be the way I made the reference image, so I'm just dumb)
      $endgroup$
      – snipers500
      7 hours ago






    • 1




      $begingroup$
      Could work with only one cube, I think. using intersection and difference.
      $endgroup$
      – lemon
      6 hours ago










    • $begingroup$
      oh yes of course, I'm going to correct
      $endgroup$
      – moonboots
      6 hours ago
















    • $begingroup$
      Thanks, I ended up using this method, (which also happened to be the way I made the reference image, so I'm just dumb)
      $endgroup$
      – snipers500
      7 hours ago






    • 1




      $begingroup$
      Could work with only one cube, I think. using intersection and difference.
      $endgroup$
      – lemon
      6 hours ago










    • $begingroup$
      oh yes of course, I'm going to correct
      $endgroup$
      – moonboots
      6 hours ago















    $begingroup$
    Thanks, I ended up using this method, (which also happened to be the way I made the reference image, so I'm just dumb)
    $endgroup$
    – snipers500
    7 hours ago




    $begingroup$
    Thanks, I ended up using this method, (which also happened to be the way I made the reference image, so I'm just dumb)
    $endgroup$
    – snipers500
    7 hours ago




    1




    1




    $begingroup$
    Could work with only one cube, I think. using intersection and difference.
    $endgroup$
    – lemon
    6 hours ago




    $begingroup$
    Could work with only one cube, I think. using intersection and difference.
    $endgroup$
    – lemon
    6 hours ago












    $begingroup$
    oh yes of course, I'm going to correct
    $endgroup$
    – moonboots
    6 hours ago




    $begingroup$
    oh yes of course, I'm going to correct
    $endgroup$
    – moonboots
    6 hours ago













    3














    $begingroup$

    An update, thanks to moonboots comments:



    It is possible using Cycles:



    enter image description here



    The shader simply tests if the transparent depth is at least 1 as the cube is transparent but also we don't want more than one (as if not the cube shape may appear in non ortho views):



    enter image description here








    share|improve this answer











    $endgroup$














    • $begingroup$
      I thought you had the solution but actually what you propose is to display another texture through the cube transparency, which is not exactly what he's looking for, at least it's what I understand
      $endgroup$
      – moonboots
      6 hours ago










    • $begingroup$
      @moonboots, don't get what you mean
      $endgroup$
      – lemon
      6 hours ago










    • $begingroup$
      Could you please share your file?
      $endgroup$
      – moonboots
      6 hours ago










    • $begingroup$
      @moonboots, sure: updated above
      $endgroup$
      – lemon
      6 hours ago






    • 1




      $begingroup$
      so yes, that's what I thought, actually the new texture is not displayed at the objects intersection but where the transparency happens, which is not the same... On the left what is supposed to happen, on the right what happens with your method: zupimages.net/up/19/36/tl1c.jpg
      $endgroup$
      – moonboots
      6 hours ago















    3














    $begingroup$

    An update, thanks to moonboots comments:



    It is possible using Cycles:



    enter image description here



    The shader simply tests if the transparent depth is at least 1 as the cube is transparent but also we don't want more than one (as if not the cube shape may appear in non ortho views):



    enter image description here








    share|improve this answer











    $endgroup$














    • $begingroup$
      I thought you had the solution but actually what you propose is to display another texture through the cube transparency, which is not exactly what he's looking for, at least it's what I understand
      $endgroup$
      – moonboots
      6 hours ago










    • $begingroup$
      @moonboots, don't get what you mean
      $endgroup$
      – lemon
      6 hours ago










    • $begingroup$
      Could you please share your file?
      $endgroup$
      – moonboots
      6 hours ago










    • $begingroup$
      @moonboots, sure: updated above
      $endgroup$
      – lemon
      6 hours ago






    • 1




      $begingroup$
      so yes, that's what I thought, actually the new texture is not displayed at the objects intersection but where the transparency happens, which is not the same... On the left what is supposed to happen, on the right what happens with your method: zupimages.net/up/19/36/tl1c.jpg
      $endgroup$
      – moonboots
      6 hours ago













    3














    3










    3







    $begingroup$

    An update, thanks to moonboots comments:



    It is possible using Cycles:



    enter image description here



    The shader simply tests if the transparent depth is at least 1 as the cube is transparent but also we don't want more than one (as if not the cube shape may appear in non ortho views):



    enter image description here








    share|improve this answer











    $endgroup$



    An update, thanks to moonboots comments:



    It is possible using Cycles:



    enter image description here



    The shader simply tests if the transparent depth is at least 1 as the cube is transparent but also we don't want more than one (as if not the cube shape may appear in non ortho views):



    enter image description here









    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited 5 hours ago

























    answered 7 hours ago









    lemonlemon

    21.7k1 gold badge19 silver badges55 bronze badges




    21.7k1 gold badge19 silver badges55 bronze badges














    • $begingroup$
      I thought you had the solution but actually what you propose is to display another texture through the cube transparency, which is not exactly what he's looking for, at least it's what I understand
      $endgroup$
      – moonboots
      6 hours ago










    • $begingroup$
      @moonboots, don't get what you mean
      $endgroup$
      – lemon
      6 hours ago










    • $begingroup$
      Could you please share your file?
      $endgroup$
      – moonboots
      6 hours ago










    • $begingroup$
      @moonboots, sure: updated above
      $endgroup$
      – lemon
      6 hours ago






    • 1




      $begingroup$
      so yes, that's what I thought, actually the new texture is not displayed at the objects intersection but where the transparency happens, which is not the same... On the left what is supposed to happen, on the right what happens with your method: zupimages.net/up/19/36/tl1c.jpg
      $endgroup$
      – moonboots
      6 hours ago
















    • $begingroup$
      I thought you had the solution but actually what you propose is to display another texture through the cube transparency, which is not exactly what he's looking for, at least it's what I understand
      $endgroup$
      – moonboots
      6 hours ago










    • $begingroup$
      @moonboots, don't get what you mean
      $endgroup$
      – lemon
      6 hours ago










    • $begingroup$
      Could you please share your file?
      $endgroup$
      – moonboots
      6 hours ago










    • $begingroup$
      @moonboots, sure: updated above
      $endgroup$
      – lemon
      6 hours ago






    • 1




      $begingroup$
      so yes, that's what I thought, actually the new texture is not displayed at the objects intersection but where the transparency happens, which is not the same... On the left what is supposed to happen, on the right what happens with your method: zupimages.net/up/19/36/tl1c.jpg
      $endgroup$
      – moonboots
      6 hours ago















    $begingroup$
    I thought you had the solution but actually what you propose is to display another texture through the cube transparency, which is not exactly what he's looking for, at least it's what I understand
    $endgroup$
    – moonboots
    6 hours ago




    $begingroup$
    I thought you had the solution but actually what you propose is to display another texture through the cube transparency, which is not exactly what he's looking for, at least it's what I understand
    $endgroup$
    – moonboots
    6 hours ago












    $begingroup$
    @moonboots, don't get what you mean
    $endgroup$
    – lemon
    6 hours ago




    $begingroup$
    @moonboots, don't get what you mean
    $endgroup$
    – lemon
    6 hours ago












    $begingroup$
    Could you please share your file?
    $endgroup$
    – moonboots
    6 hours ago




    $begingroup$
    Could you please share your file?
    $endgroup$
    – moonboots
    6 hours ago












    $begingroup$
    @moonboots, sure: updated above
    $endgroup$
    – lemon
    6 hours ago




    $begingroup$
    @moonboots, sure: updated above
    $endgroup$
    – lemon
    6 hours ago




    1




    1




    $begingroup$
    so yes, that's what I thought, actually the new texture is not displayed at the objects intersection but where the transparency happens, which is not the same... On the left what is supposed to happen, on the right what happens with your method: zupimages.net/up/19/36/tl1c.jpg
    $endgroup$
    – moonboots
    6 hours ago




    $begingroup$
    so yes, that's what I thought, actually the new texture is not displayed at the objects intersection but where the transparency happens, which is not the same... On the left what is supposed to happen, on the right what happens with your method: zupimages.net/up/19/36/tl1c.jpg
    $endgroup$
    – moonboots
    6 hours ago











    -1














    $begingroup$

    "Dynamic paint" could be the way to go. Check YouTube for a tutorial on that. For example: https://www.youtube.com/watch?v=PcWXFtnh2bk






    share|improve this answer









    $endgroup$



















      -1














      $begingroup$

      "Dynamic paint" could be the way to go. Check YouTube for a tutorial on that. For example: https://www.youtube.com/watch?v=PcWXFtnh2bk






      share|improve this answer









      $endgroup$

















        -1














        -1










        -1







        $begingroup$

        "Dynamic paint" could be the way to go. Check YouTube for a tutorial on that. For example: https://www.youtube.com/watch?v=PcWXFtnh2bk






        share|improve this answer









        $endgroup$



        "Dynamic paint" could be the way to go. Check YouTube for a tutorial on that. For example: https://www.youtube.com/watch?v=PcWXFtnh2bk







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 8 hours ago









        mccmcc

        4141 silver badge10 bronze badges




        4141 silver badge10 bronze badges































            draft saved

            draft discarded















































            Thanks for contributing an answer to Blender Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fblender.stackexchange.com%2fquestions%2f151049%2fis-it-possible-to-change-a-material-depending-on-whether-it-is-intersecting-with%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

            Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

            François Viète Contents Biography Work and thought Bibliography See also Notes Further reading External links Navigation menup. 21Google Bookspp. 75–77Google BooksDe thou (from University of Saint Andrews)ArchivedGoogle BooksGoogle BooksGoogle BooksGoogle booksGoogle Bookscc-parthenay.frL'histoire universelle (fr)Universal History (en)ArchivedAdsabs.harvard.eduPagesperso-orange.frArchive.orgChikara Sasaki. Descartes' mathematical thought p.259Google BooksGoogle BooksGoogle Bookspp. 152 and onwardGoogle BooksGoogle BooksScribd.comGoogle Books1257-7979Google BooksGoogle BooksGoogle BooksGoogle BooksGoogle BooksGoogle BooksGallica.bnf.frGoogle BooksGoogle Books"François Viète"Francois Viète: Father of Modern Algebraic NotationThe Lawyer and the GamblerAbout TarporleySite de Jean-Paul GuichardL'algèbre nouvelle"About the Harmonicon"cb120511976(data)1188044800000 0001 0913 5903n82164680ola2013766880073431702w6vt1sb70287374827140948071409480