Make this eye node work well with armature modifier

Hello Kent, this video is very helpful.

I want to ask about a question.

When using this eye node along with armature modifier.

All the texture will be offset if you move/rotate the bone that you assign to the mesh.

Is there anyway to prevent it work from offset with Armature modifier? 

If it cannot, is there anyway I can make the eye move/rotate as the bone transform?



  • of Nodes & Noodles(gcs_dev) replied

    Hi there! I haven't seen the tutorial video but I'm guessing Kent uses the Object output of a Texture Coordinates node for the procedural material.
    If this is the case, you can bake the Object coordinates to a texture and then use that texture as texture coordinates in the procedural material.
    Please ask again here if you need help doing this.

  • spikeyxxx replied

    Theoretically, I think you should be able to use drivers for the Location, Rotation and Scale of the Mapping Node.

    That is: drive the X Location of the Mapping Node to minus(!) the X Location of the Armature > Bone, and so on...

    This works for the Location without any problems, but the Rotation is not so straightforward.

    But still, just an idea;)

    ggcs_dev 's proposition of baking the Object Coordinates to a texture sounds a lot easier!

  • PT Binh(zhuk0v1811) replied

    Can you show me how to bake the Object coordinate to a texture? This is first time I heard about it :D

  • spikeyxxx replied

    Make a new texture and plug the Object Coordinates into a Viewer Node (Emission). Select the Texture Node with the texture you created and Bake the Emit pass.

    Then you get something like this and you can use the Image Texture instead of the Object Coordinates.

  • of Nodes & Noodles(gcs_dev) replied

    spikeyxxx is on the right track but there's a little more to do in order to account for minus numbers, and numbers greater than 1, which can't be represented by a texture.
    Could you please post a screenshot of your sphere with the armature deactivated so I can see where the Origin of the sphere is?

  • PT Binh(zhuk0v1811) replied

     ggcs_dev

    I deactived armature and this is the right view of the eye.

    Could you check it?

  • of Nodes & Noodles(gcs_dev) replied

    Ok, it looks to me like the left side of the eye is probably all black indicating minus numbers, so we'll have to fix that.

    Here's the process, step-by-step, from beginning to end:

    1. UV unwrap your sphere (the automatically generated UV map will work fine)
    2. Create a new Image texture 1024*1024 (resolution isn't very important but I wouldn't go lower than 512*512) and set it to 32 Bit. We'll name it "Tex Coordinates" for this example.
    3. Open the Shader Editor and copy the setup below: (This setup assumes that all three dimensions of the object are the same. If this is not the case, you'll need a Value node and Multiply by 0.5 for any dimension which is different from the others.)
      Copy and paste the dimension of your object into the Value node (highlighted by the green circles)
    4. Bake your texture as you did before.


    Now to use your new Tex Coordinates image copy the setup below:

    This Combine node (highlighted in green) is now your texture coordinates node.


    I hope this is clear enough. Please do ask again if you need more help.



  • of Nodes & Noodles(gcs_dev) replied

    It's cases like this that make me REALLY miss the old "Bake to Vertex Colors" option. Does anyone know why that was removed?

  • Kent Trammell replied


    spikeyxxx
    ggcs_dev You both have shared some clever information here. Thanks so much for taking the time to help a fellow member so thoroughly!

    Admittedly I've never thought to bake the object coordinates to a texture. That's kinda brilliant.

    Alternatively zhuk0v1811 could parent the eyeball object directly to the bone instead of using vertex weights.

  • of Nodes & Noodles(gcs_dev) replied

    Thanks Kent! The idea came to me a while ago when I wanted to use my procedural wood on a curved-back chair.

    Directly parenting the object to the bone is definitely much simpler and quicker! Why oh why do I complicate my life so???

  • spikeyxxx replied

    Absolutely brilliant ggcs_dev! Thanks for sharing!

    (I've never used Bake to Vertex Colors, but that was Blender Internal... Maybe Eevee will get baking at some time and have that functionality????)

  • of Nodes & Noodles(gcs_dev) replied

    Thanks so much Spikey! 

    I still reckon @theluthier 's solution of parenting the object to the bone instead of using vertex weights is much more efficient and easier, but it (nearly) never hurts to have one more node-based trick in our arsenal.

  • spikeyxxx replied

    Man, it's that simple...

    Thanks Kent!

  • of Nodes & Noodles(gcs_dev) replied

    spikeyxxx Right!? I'm headbutting my desk for not thinking of that!

  • PT Binh(zhuk0v1811) replied

    ggcs_dev , spikeyxxx , @theluthier 

    Oh god thanks you guys so much for helping me out.

    Kent' solution is so simple and it work very well.

    gcs_dev and spikyxxx method of using bake coordinate is very creative.

    I will save this trick, it will be useful in someday.

  • of Nodes & Noodles(gcs_dev) replied

    You're very welcome! It's quite clear which of us three is the professional tutor, right? Bravo @theluthier !