Material texture in two different positions at the same time

Material texture in two different positions at the same time

yavaBBL49
Enthusiast Enthusiast
1,105 Views
9 Replies
Message 1 of 10

Material texture in two different positions at the same time

yavaBBL49
Enthusiast
Enthusiast

I've been trying to wrap my head around this issue for so long, because it happens like 10-20% of the times on imported CAD objects, while most times it doesn't happen, and I never figured out what's the cause of that.

 

Basically, you often want your decal to be applied on multiple contiguous objects. For example, on a car you may have a decal on the side that is applied on BOTH the main body and onto the doors at the same time as the last item of the multipass material of the car body (OBJECT A) and the car doors (OBJECT B, C, etc.).

 

What happens sometimes is that, I create my decal, I project it onto OBJECT A, aka the car body in this example, adjust it into the right position and that's it. Now I just need to drag and drop my decal also onto OBJECT B (car door) multipass material and it will be in the right position, because it's obvious since the decal is a planar projection from the side with 180° angle, right? But nope, sometimes this doesn't happen. You apply the decal to OBJECT B and you find that there is no decal, how is that possible? Then you select OBJECT B, click "Manipulate" to see where the decal actually is positioned within the space, and with great surprise you find out it's on a totally different position, what the heck!? So, how is it exactly possible that my decal, a single material, is projected onto position X for the OBJECT A and position Y for the OBJECT B, at the same time? This doesn't make any sense at all for me. If I project a planar decal perfectly ortogonal to the side of my object, I expect it to be continuous from one component to the others, because that's just the logical way you would expect it to work...

 

So I'm here left guessing if this is an unwanted bug or there is some weird behaviour I didn't take into account.

The only thing I could think of was of a vertex/face normal problem, but when switching to vertex/face normal rendering, I see my entire object is perfectly green, so can't be that?

 

 

0 Likes
Accepted solutions (2)
1,106 Views
9 Replies
Replies (9)
Message 2 of 10

sinje_thiedemann
Autodesk
Autodesk
Accepted solution

Hi,

it is important to know that the planar projection is defined in object space, not in world space. That means that the projection plane is setup with regards to the local coordinate system of the object to which the material is assigned.

Of course, you can still assign the same material to another object. But it only aligns well on the other object, if it is in the same coordinate system.

 

To make this more concrete:

In your example, when the projection looks wrong on one object, the two stone blocks are only contiguous in world space, but not in the object space of the first block for which you setup the projection.

Objects A and B have different world transformations (translation, rotation) in this case. The transformation is not necessarily set directly on the objects, but could be on parent nodes.

 

The only solution that I know of is to bake the transformations into the vertices of the objects (afterwards the objects will have the same local coordinate system, essentially). In VRED this is called "Flush Transformation", available in Scene > Optimize > Flush Transformation Nodes (Adjust Face Normals). You do not need to do this for the whole scene, just for the subgraph in which both objects are. Of course this is only an option if you do not need the original 3D transformation for other purposes.

 

Kind regards

Sinje

0 Likes
Message 3 of 10

yavaBBL49
Enthusiast
Enthusiast

First of all, thank you a lot for your reply. I imagined this was the case, because when working in "Isolate View", I could see the decal correctly applied as I'm working locally on one object node, while when working in "Global View" with my entire object visible, I see the same decal is located in different positions basesd on which node I'm working with.

 

So you are saying all I need to do is select both the objects nodes for which I'm interested in applying the same decal contiguously and then optimize them with the option "Flush Transformation Nodes (Adjust Face Normals)" ticked? Nope, I think you said I have to optimize the entire parent node in which both Object A and Object B are in, so also all the other subtrees within this parent node get also optimized, but that's the correct operation to do because the relevant transform information is contained in the parent node, not on the object-specific nodes.

 

I'm just not entirely sure of what happens to my objects then, what kind of properties I lose with my objects, specifically: how do Translation, Rotation and Scales Transformation get affected by only optimizing with "Flush Transformation Nodes (Adjust Face Normals)"? Because, at this point, I think they are all indirectly resetted to 0 despite having their specific options not ticked in the optimize window.

 

Anyway, I'll try what you suggested and let you know if I can finally fix my issue.

0 Likes
Message 4 of 10

sinje_thiedemann
Autodesk
Autodesk

I think you said I have to optimize the entire parent node in which both Object A and Object B are in, so also all the other subtrees within this parent node get also optimized


Yes, that's right. In the end it really depends on how the scenegraph looks like and on which nodes the transformations are set. The goal is to have the same world transformation for Object A and B.

There can be different scenarios:

  • One object is not transformed at all (incl parent transformations), and the other one is, then it would be sufficient to get rid of (flush) the transformations of the other object.
  • Both objects are transformed differently, then both need to be flushed. Then it makes sense to select their first common parent node and to flush that one.

 


I'm just not entirely sure of what happens to my objects then, what kind of properties I lose with my objects, specifically: how do Translation, Rotation and Scales Transformation get affected by only optimizing with "Flush Transformation Nodes (Adjust Face Normals)"? Because, at this point, I think they are all indirectly resetted to 0 despite having their specific options not ticked in the optimize window.


The "Flush Transformation Nodes (Adjust Face Normals)" is an operation that does all in one, it resets all transformations (translation, rotation, scale) to zero (or, one for scale).

The other options (Flush Transformation Translations/Rotations/Scales) are for specifically to just flush that one kind of transform value, e.g. just translations, but keep rotations and scales. It will do so for the entire subgraph of the selected node, including the selected node.

One more special option is "Flush Selected Transformation" which will not flush the entire subgraph, but just the transformation of the single selected node, which can also make sense in some cases.

 

0 Likes
Message 5 of 10

yavaBBL49
Enthusiast
Enthusiast

So, I selected everything in my Scene Graph, and ticked all the Flush options in the Optimize Dialog Box. Result? The decal got shifted, but it still isn't contiguous over the two objects. I can't understand why it's like that, could it be a bug? I literally selected any possible node and flushed everything, yet the axis icon didn't disappear somehow (the one that appears next to a node to signal that it has some transformations applied).

 

I checked also before flushing, all parent nodes had no tranformations applied, just all the node groups at the same depth level had tranformations. Even flushing everything, they still retained their axis icons, so maybe that's why I still can't get the same world transformations for my objects? I have no clue honestly about why it didn't work at this point.

0 Likes
Message 6 of 10

Christian_Garimberti
Advisor
Advisor
Accepted solution
Hi,
If you can not flush transformations, maybe that is a shared node.
While import a cad model, by default, all the same parts are imported as shared nodes. This is useful to speed assigning materials, but can cause problems in other situation, like the flush transformation or, for example, baked shadows.
You can unshare a single node by right click on the node, edit, unshare.
You can unshare node and his tree by using the unshare subtree.
After that you can flush transformations.

Best
Chris

Christian Garimberti
Technical Manager and Visualization Enthusiast
Qs Informatica S.r.l. | Qs Infor S.r.l. | My Website
Facebook | Instagram | Youtube | LinkedIn

EESignature

0 Likes
Message 7 of 10

yavaBBL49
Enthusiast
Enthusiast

Thank you, that did the trick!

 

Just a few more questions about the "Unshare" function, as I didn't understand the parts here highlighted in red:

1) "Remove a referenced connection. Changes made to one object no longer affect its former reference. Internal clones are preserved."

2) "Unshare: All clone connections from nodes in the selected subtree are disrupted to other parts of the scenegraph."

 

This is what I understood, but I guess it's wrong, so could you please better explain the difference between the three functions as well? I just don't wanna end up using a function that does more than what I actually require.

 

7y2goOr

0 Likes
Message 8 of 10

Christian_Garimberti
Advisor
Advisor

The difference between "Unshare" and "Unshare subtree" is the scope of the command.

All tge two command works in the subtree of the selected node:

The "Unshare subtree" disrupt clones if they are only in the selected tree. if there are clones outsides, they are not disrupted.

The "Unshare" evaluate all clones also if they have clones outside the subtree selected.

 

"Unshare selected node" works only on the node selected.

 

https://help.autodesk.com/view/VREDPRODUCTS/2020/ENU/?guid=VRED_Scene_Graph_Scene_Graph_Edit_Menu_ht...

 

Best

Chris

Christian Garimberti
Technical Manager and Visualization Enthusiast
Qs Informatica S.r.l. | Qs Infor S.r.l. | My Website
Facebook | Instagram | Youtube | LinkedIn

EESignature

0 Likes
Message 9 of 10

sinje_thiedemann
Autodesk
Autodesk

Hi,

while typing this rather lengthy explanation I saw that Chris posted a shorter one. Thanks!

Nevertheless, maybe the details below are interesting for you.

 

My summary would be: Your goal is to unshare the geometry nodes for which you want to flush the transformation. Which Unshare functions are working best for you depends on how the clones are setup. The most "radical" unshare is "Unshare Subtree" - no clones left afterwards in the selected subtree. What you could do, is to first try the normal "Unshare", and if Flush still does not work, then a "Unshare Subtree".

 

----

 

Unshare - Disrupts all clone connections from nodes in the selected subtree to other parts of the Scene Graph.

 

With "Internal clones", cloned nodes within the selected sub graph are meant.

 

Here is a simple example.

The 4 Box nodes are clones. Two of the cloned boxes are under GroupA. 2 other cloned boxes are under GroupB ("other parts of the Scenegraph" ).

 

If you select a clone, all connected clones are highlighted with orange text. You can also use the context menu > Select All Clones to find all instances.

Cloned nodes are also underlined. There are two kinds of underlining (solid and dotted), but this is currently not important.

4 cloned boxes4 cloned boxes

 

 

If you "Unshare" GroupA, the two boxes under GroupA will still be clones of each other, but their connection to the Boxes under GroupB will be broken:

 

2 cloned boxes after Unshare on "GroupA"2 cloned boxes after Unshare on "GroupA"

 

 

 

Unshare Subtree - Disrupts all clone connections in the selected subtree.

=> No cloned nodes any more afterwards in the selected subtree. E.g. in this case, the boxes under GroupA would not be clones of each other any more, but all independent.

 

 

Unshare Selected Node - Disrupts only the clone connection of the selected node.

That is a special case that is only useful in certain scenarios, if the cloned node is in a hierarchy of clones.

What is important to know about cloned nodes in VRED - it is not only about having the same properties, but also about having the same the child nodes.

In the example above we do not have a clone hierarchy, only single cloned boxes.

Let's say you have two cloned doors which consist of many parts. The complete door node hierarchy is cloned. That means if you add a new child node to one hierarchy, a clone of that child node will be added to the other door as well. If you transform one part it will be transformed in the other door as well. If there is a reason that you want to break that clone hierarchy, you could select the top most door node and do "Unshare Selected Node" which will break the clone hierarchy. But, if there are 100 screw nodes (all clones, 50 of them in one door and 50 in the other door), these 100 clones will still belong to each other.

 

Best regards

Sinje

 

Edit: strange image formatting

Message 10 of 10

yavaBBL49
Enthusiast
Enthusiast

I want to really thank both of you for your help, all your answers were helpful for me to get a neat overview.

 

Now I got a much clearer understanding of how clones work in VRED and all the possible options offered by the Unshare function, expecially the one related to the clone hierarchy, which is actually very helpful in some use case scenarios I was ignoring. I just wish that all the software documentation was as much clear as in the answers in this thread, and also with the image examples provided in here.

0 Likes