PDA

View Full Version : Simple vector math is not simple



mewnow
05-22-2019, 11:50 PM
Here is a simple node setup:
145053

I think the math behind the setup supposed to be A-B+B=A, but the result don't return A to me.
What I did wrong?

Bytehawk
05-23-2019, 04:44 AM
Aren't vectors normalized after each operation? I could be very wrong here. Been a while.
What I mean is

a = 1,1,1
b = 1,0,0
a + b = 1, 0.5, 0.5

Sensei
05-23-2019, 05:39 AM
Aren't vectors normalized after each operation? I could be very wrong here. Been a while.
What I mean is

a = 1,1,1
b = 1,0,0
a + b = 1, 0.5, 0.5

Absolutely they are not.
Your's 1,0.5,0.5 is not normalized.
Normalized means sqrt(x^2 + y^2+z^2)=1
sqrt(1^2+0.5^2+0.5^2) = 1.224745

Mewnow, try Const > Vector instead to see what it'll give you, instead of MDD Cache..
MDD Cache node is not part of LW 2019. I don't have it.
So, contact author.

Bytehawk
05-23-2019, 05:42 AM
thanks for correcting me. I haven't done a lot of 3d stuff lately.

mewnow
05-23-2019, 06:46 AM
Maybe I didn't made it clearly, sorry.
I want to find out the differences of 2 mdd caches, do some stuff, and add it back to the original one.
Yes, I know I did the wrong thing about this. But how to make it right?

@Sensei:
Yes, I try to math vector nodes, A(1 1 1) and B(1 0 0), so A-B = 0 1 1, next A-B+B=1 1 1.
And, I use DP Mdd Cache node, there is also MDD Displacement node in my LW11.6.3

EDIT: Maybe I should attach a simple scene file, sorry.
Here is my little scene file. 145055

Sensei
05-23-2019, 07:08 AM
@Sensei:
Yes, I try to math vector nodes, A(1 1 1) and B(1 0 0), so A-B = 0 1 1, next A-B+B=1 1 1.
And, I use DP Mdd Cache node, there is also MDD Displacement node in my LW11.6.3

If it works with constant vectors, but not works with MDD cache, then problem is the most likely inside of MDD Cache...

Did you try downloading the latest versions of DP Kit to check it? Maybe it has been fixed already.

mewnow
05-23-2019, 07:18 AM
Sensei: The native MDD Displacement node give me the same result, I have upload a simple scene file, maybe you have a look at it. Thanks.

Sensei
05-23-2019, 07:39 AM
What effect should I see?

There is pulsing ball no matter if I plug MDD Displacement directly or through sub+add network with uvball_stage1.mdd.
uvball_stage2.mdd it slightly moves in one direction.

Show me some screen-shot..

I tried ATM LW 2018.0.7.

ps. I see one MDD Displacement uses uvball_stage1.mdd and other one uvball_stage2.mdd.
Shouldn't we focus on A-B+B=A the first? And then go forward with 2 mdds files..

mewnow
05-23-2019, 07:49 AM
Sorry, not clearly everytime.
I want to find out the differences between stage1 and stage2(make some stuff with the differences), then add the differences back to stage1, so the finally result should be stage2.

I find out the differences by stage2.mdd - stage1.mdd, this works fine. But I use a "Add" node to add it back to stage1, don't get the stage2.

Edit: What screen-shot? Displacement node setup?
145057

RebelHill
05-23-2019, 07:59 AM
Change your MDD nodes to match by coords, not by nodes.

mewnow
05-23-2019, 08:07 AM
@RebelHill:
Yeah, it works.
I would like to use DP MDD Cache, but it don't have a match by coordinates option, if this can be solved?

RebelHill
05-23-2019, 08:16 AM
Dont think so... you tried turning on the world coord option. Doubt it makes a difference, but you never know.

dpont
05-24-2019, 01:22 AM
I think I found a workaround,
the issue is caused by the second evaluation of the same MDD Cache node,
one for Adding and then for Subsracting,
in this case the node editor seems to miss/decal point iteration (?),
so if you use a different MDD Cache for Adding and Substracting
using a copy of the node, this should work,
note that it shouldn't use more memory,
because it uses instance of the MDD file.

Denis.

'updated)
...To be clear, I noted this issue only in LW2015 and previous versions,
where this tip may help,
but no such issue in LW2018-2019,
because there's no more iteration, we can now
match the exact evaluated point.

Otterman
05-24-2019, 02:10 AM
....and this is why I hate nodes and yet to embrace LW2019. Not one single Newtek tutorial to explain this sh*t!

RebelHill
05-24-2019, 06:28 AM
Not sure why you think NT would have stuff explaining third party tools... but aside from that specific case, there's TONS of material covering nodes spread about, if not from NT, then from others.

mewnow
05-24-2019, 07:42 PM
so if you use a different MDD Cache for Adding and Substracting
using a copy of the node, this should work


Thanks for the workaround, it works very well. This is very important for V11.6.3 user like me.



What effect should I see?

I tried ATM LW 2018.0.7.

As Denis said, you saw the final effect as stage2 maybe you were on V2018, and I'm on V11, thanks for help anyway.

Sensei
05-24-2019, 09:55 PM
I think I found a workaround,
the issue is caused by the second evaluation of the same MDD Cache node,
one for Adding and then for Subsracting,
in this case the node editor seems to miss/decal point iteration (?),
so if you use a different MDD Cache for Adding and Substracting
using a copy of the node, this should work,
note that it shouldn't use more memory,
because it uses instance of the MDD file.

What did you mean?
Your node->Copy() function does something else than user can do manually picking up the all fields by himself/herself in UI (and making settings-equal version of node) ?
If yes, that's very bad...
LW uses node->Copy()/node->Load()/node->Save() internally to e.g. implement undo AFAIR..
If you will put MessageBox() to node->Copy()/node->Load()/node->Save()
you should see that they are called much more often than you expect..

dpont
05-24-2019, 11:49 PM
What did you mean?
Your node->Copy() function does something else than user can do manually picking up the all fields by himself/herself in UI (and making settings-equal version of node) ?
..

No, I meaned that older version had a limitation,
node must be evaluated once only,
for another operation of the same MDD,
user need to add another node, or a copy.


Denis.

Sensei
05-24-2019, 11:58 PM
Ah, right, because it had internal vertex index counter/"pointer", which is incremented each time Evaluate() is called to the next data.
I had to use newer version, because could not see any bad effect. Therefor asked him to show screen-shot what he see. But now all is clear.