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: 

for_each gets the wrong sequence, some values are right, some are wrong.

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
g2m.agent
255 Views, 2 Replies

for_each gets the wrong sequence, some values are right, some are wrong.

Basically, I want to build the face_offset sequence. this is my python code:

size = 18 # array_size(face_vertex)
max_iter = 6 # max_iterations

i = 1 # current_index
res = [] # result.
while i<=max_iter:
    n = int(size*(1/max_iter)*i)
    res.append(n)
    i += 1
    
print(res)    
# [3, 6, 9, 12, 15, 18]

this is my graph: 

The result should be as above: [3, 6, 9, 12, 15, 18]
But one value is wrong, why? ? [3, 6, 9, 12, 14, 18]

maya_2Su7DCeODK.png

 

2 REPLIES 2
Message 2 of 3
mjcg91
in reply to: g2m.agent

This is probably related to float rounding. Have you tried converting the one_over result to int before multiplying?

 

You could also use a sequence_array node to do stuff like this. 

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

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

the one_over result is sometimes 0.1111, after the integer becomes 0
I use divide instead of one_over to get the correct result.
sequence_array is fine too. Thank you.

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

Post to forums