Community
Bifrost Forum
Welcome to the Bifrost Forum. This is the place for artists using Bifrost to ask and answer questions, browse popular topics, and share knowledge about creating effects procedurally using Bifrost. You can also visit the Bifrost Community on AREA to download an array of ready-to-use graphs, read Bifrost news and updates, and find the latest tutorials.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

do_while is not respecting the looping condition

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
mcw0
474 Views, 10 Replies

do_while is not respecting the looping condition

I'm using a "greater" node with a value of 0.001.  But here's my data dump.  It continued to run through the while loop even though the value was less than 0.001.

 

Capture4.PNG

10 REPLIES 10
Message 2 of 11
mjcg91
in reply to: mcw0

show graph

Maxime Jeanmougin - Technical Artist
https://maximejeanmougin.com

Join the Bifrost Addicts community on Discord:
https://discord.gg/bifrost-addicts
Message 3 of 11
mcw0
in reply to: mjcg91

Capture51.PNG

Message 4 of 11
mjcg91
in reply to: mcw0

At first sight, the value your are dumping is not the same as one used with the loop_condition.

 

get_from_array uses the do-while current_index, while get_from_array1 use the same index at each iterations.

 

 

Maxime Jeanmougin - Technical Artist
https://maximejeanmougin.com

Join the Bifrost Addicts community on Discord:
https://discord.gg/bifrost-addicts
Message 5 of 11
mcw0
in reply to: mjcg91

"get_from_array1" is only tracking one point.  I didn't need all the points to see if it was working.  But they are both getting their values from "length"

Message 6 of 11
mjcg91
in reply to: mcw0

If you loop keeps going, it's probably because he the value checked with loop_condition is still less than your threshold, so the two values are most likely different.

 

I would double check this by dumping the value from get_from_array.

 

 

Maxime Jeanmougin - Technical Artist
https://maximejeanmougin.com

Join the Bifrost Addicts community on Discord:
https://discord.gg/bifrost-addicts
Message 7 of 11
mcw0
in reply to: mjcg91

Is my logic correct?  Both "get_from_array" nodes are getting the same array from "length".  And "get_from_array1" is only looking at 1 specific index.  When the current index equals the index on "get_from_array1", shouldn't the values in both "get_from_array" nodes be the same?

 

I guess dumping all the indices from "get_from_array" would tell me that.  I just didn't feel like looking through all the values.

Message 8 of 11
mjcg91
in reply to: mcw0

If the current loop iteration's index used in get_from_array matches the index set on get_from_array1, then the values will definitely match, All i'm saying is that the values shown in the dump file is not relevant, and it most likely different than the values tested with the loop_condition. 

 

What you are doing with the loop_condition is test the length of a different element at each loop iterations. I don't know what this graph is doing aside from what I see, but since the result of all the length array is changing at each loop iterations, testing another element each time doesn't make sense to me.

I think what you should do is test the same array element at each iterations, to check if it's greater than your threshold.

Maxime Jeanmougin - Technical Artist
https://maximejeanmougin.com

Join the Bifrost Addicts community on Discord:
https://discord.gg/bifrost-addicts
Message 9 of 11
mcw0
in reply to: mcw0

Maxime, I did as you suggested and you are correct.  My logic is wrong.  But now I'm confused.  I'll have to dump a lot more data to figure out what's going on.

 

My resulting mesh is correct.  I was just trying to optimize speed and efficiency.

Message 10 of 11
mjcg91
in reply to: mcw0

Aside from the problem you're trying to solve, one thing you can do to optimize this graph is break the get_closest_location, keep sample_closest_accelerator, and put the build_closest_accelerator outside of your loop. Right now, you're building the acceleration structure at each loop iteration, which is a waste of performance. 

 More on this here: Create custom geometry queries 

Maxime Jeanmougin - Technical Artist
https://maximejeanmougin.com

Join the Bifrost Addicts community on Discord:
https://discord.gg/bifrost-addicts
Message 11 of 11
mcw0
in reply to: mjcg91

Thank you for the advice

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums