5
$\begingroup$

I'm doing the animation inside the geo nodes and the materials are applied to the mesh, not the object. There seems to be some easy way to fix this, but I can't find it. Here is a simple example. enter image description here

Tried every texture coordinate output enter image description here

EDIT: Initially, I needed to fix this for the text. I thought that the solution for the cube and for the text would be the same)

enter image description here

On the final scene in the Rotation Instances and Translate Instances I have math calculation. And I use Realize instances to extrude Text by Solidify Modifier.

enter image description here

$\endgroup$
0

3 Answers 3

5
$\begingroup$

Your object coords are just the object space coordinates of your vertices, interpolated across faces. GN's "position" is in object space. If you want to do a GN transform without affecting these coords, you can capture their object coords-- that is, their object-space position-- with a Capture Attribute node and output the result to a new, vector-type attribute, then reference that attribute in your shader instead of your object coords:

enter image description here

Shown are two cubes with different GN node trees that differ only in the rotation in the transform.

Edit: You've edited your question to expand your problem. There are a lot of complicating factors in your edited question. They are addressable, but not easily:

enter image description here

The first part of this is, we're going to capture the the XY position of our realized text, and transfer from untransformed instances to transformed instances by index-- but we'll only output our transformed instances. Because the transformed and untransformed versions are identical other than transform, their indices should match up exactly how we expect.

You'll notice as well that I'm joining with our original geo-- with everything masked out. I'll explain in a second.

enter image description here

Now, we have our solidify modifier. Keep in mind that previous to this modifier, our geo has no object space Z position, it's all zero. So we couldn't have created a Z value for our object coords previously. We need to mark the verts we created via the solidify modifier somehow, and one of the few ways that we can do that is by outputing a vertex group on the shell. I created a VG named "solid", then we'll designate that as an output group for the shell.

That's also why we need to join with our original, completely masked geometry. If we don't do that, we'll lose the VGs on our original geo, and there will be no solidify group to which to assign solidify-generated vertices.

Now we have our proper, pre-transform object-space coords, but only in XY. We need to assign those some Z values. We can do that with a new GN tree that creates Z values on the basis of whether or not those vertices were created by the solidify modifier or not. If they weren't, we're going to leave them at z=0, because that's where we've instanced our text. If they were created by the solidify modifier, as evidenced by belong to the input VG, we're going to move them to -0.18. Why that number? That's how thick our solidify is. (If we wanted, we could link these two numbers via a driver.)

enter image description here

Finally, we have a fully 3D vector that we can use in lieu of object coordinates in our material, just as with the cube.

$\endgroup$
3
  • $\begingroup$ I have edited my question to expand the understanding of my problem. I tried to apply your method to the text, but I did not succeed. $\endgroup$
    – Kogoduos
    Jan 24 at 17:01
  • $\begingroup$ Omg, all these internal processes in nodes are not easy to understand :) I repeated on the test text and everything works perfectly, now I will try to apply this to my animation. Thanks a lot! $\endgroup$
    – Kogoduos
    Jan 24 at 23:48
  • 1
    $\begingroup$ Great answer, a few tips from me: you don't have to pass Index node to the Transfer Attribute node - it will use it by default (just like an image texture in shader uses UV map by default and you don't have to pass it there); because of your Join Geometry trick, you don't have to assign the material if it's already assigned to the object on the first slot (if it's in another slot you can assign material index instead); and a 3D texture like voronoi would work better to show that both XY and Z coordinate calculating works. $\endgroup$ Jan 25 at 0:52
4
$\begingroup$

"Object" texture coords means texture space relative to the object. Since transform moves points inside the object, it looks like the object is moving inside texture space, because the object itself doesn't move

You can convert your object to instance, in this case transform will move instance as an object inside the object and texture space will be moved.

Example for 3.1:

enter image description here

In 3.0 you can use instance on points with one point input.

$\endgroup$
4
  • $\begingroup$ Thanks! I'm trying to apply this already to my scene, where each individual letter is animated and doesn't get better yet. Maybe because I'm using nodes Realize Instances. I will try more $\endgroup$
    – Kogoduos
    Jan 23 at 23:28
  • $\begingroup$ Yes, It's because then you use Realize Instances, Instances converts back to mesh $\endgroup$
    – Crantisz
    Jan 24 at 8:08
  • $\begingroup$ I have edited my question to expand the understanding of my problem. I tried to apply your method to the text, but I did not succeed. $\endgroup$
    – Kogoduos
    Jan 24 at 17:01
  • $\begingroup$ Why don't you remove realize instances? $\endgroup$
    – Crantisz
    Jan 24 at 17:20
2
$\begingroup$

Either generate your own UV's using various Vector math nodes and output it through the Group Output node and give it a name, or use the pre-generated primitive UV's by using the uv_map named attribute.

enter image description here enter image description here

$\endgroup$
2
  • $\begingroup$ Thanks! This works well, but if I have, for example, text and I animate each letter separately, it no longer works correctly. $\endgroup$
    – Kogoduos
    Jan 23 at 23:23
  • $\begingroup$ I have edited my question to expand the understanding of my problem. I tried to apply your method to the text, but I did not succeed. $\endgroup$
    – Kogoduos
    Jan 24 at 17:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.