[solved] foreach node messed up polygons

   3789   9   2
User Avatar
Member
479 posts
Joined: Dec. 2009
Offline
Hi, It seems the foreach node “moved” one of the input polygons and put in on top of the adjacent polygon after the node finishes the calculations embedded inside (see images below).

It seems as long as I have more than one polygon, the foreach node will move the last one and overlap it with the second last one…

Can anyone pls kindly advise why this happens?

Thanks!

- Ji
Edited by - June 4, 2012 10:50:08

Attachments:
00.PNG (54.7 KB)
01.PNG (60.9 KB)
untitled1.hipnc (173.9 KB)

User Avatar
Member
330 posts
Joined: July 2007
Offline
hi ,

change promotion method on attribpromote1 inside foreach1 from average to first match ..

does it affect other thing in an unwanted way ?
except the things that cannot be seen , nothing is like it seems .
User Avatar
Member
479 posts
Joined: Dec. 2009
Offline
thanks, Zarti!

However, it seems the polygon overlapping problem is still there after I followed your suggestion …

it seems the calculation performed for each of the polygons is still correct, it's just that the last polygon will be moved strongly and lay on top of the second last one…

- Ji
User Avatar
Member
330 posts
Joined: July 2007
Offline
strange , at the begining i thought the culprit could be the Connectivity SOP .

iirc , i replaced it with an attribcreate SOP generating the same attribute foreach was refering to .. connected both with a switch node to see any difference comming from connectivity .

maybe the attribute was comming from attribcreate when the output was ok , but i doubt . maybe i can retry later when i have Hou in front again .
except the things that cannot be seen , nothing is like it seems .
User Avatar
Member
339 posts
Joined: Aug. 2007
Offline
This might be a bug or the ForEach may simply not work this way, but it appears that the culprit is the nested ForEach that runs on points. I would trash that and instead do a forloop in a vopsop, you're just running vops inside there anyway, no need for the extra complexity.
May I ask what the final goal is here, it's lookin' wacky and there may be a simpler way to approach it.
Jesse Erickson
Fx Animator
WDAS
User Avatar
Member
330 posts
Joined: July 2007
Offline
oat
..

it seems the calculation performed for each of the polygons is still correct, it's just that the last polygon will be moved strongly and lay on top of the second last one…

- Ji

try this ;

- replace connectivity with an attribcreate
- put $PR + 1 on its first value ( yep! just add 1 )
- keep the name of attribute you assigned to connectivity

here this works . i changed the grid 's rows and columns and this way it keeps working .

maybe something wrong with zeros when doing foreach inside another foreach ? .. or maybe a bug ? not sure , but hope this works at least for your actual project .



.cheers
except the things that cannot be seen , nothing is like it seems .
User Avatar
Member
479 posts
Joined: Dec. 2009
Offline
Hi, Zarti, thanks a lot for your suggestion! it works (see attached cumu_dir_irradi_ZartiWay_v003.hipnc)

To tjeeds,

Hi, I agree with you that my approach is messy. I'm following your suggestion to use just one foreach node and use vopsop inside it… However I doesn't seem to get it work correctly, can you kindly help to take a look of the hip file I attached here? (cumu_dir_irradi_via_VOP_v003.hipnc)

What I want to do is to get the "cumulative effective radiance from multiple suns for each sensor on a surface“ which is explained via the following images (in Zarti's approach):
1. suppose we have 2 points representing two sun positions with their radiance values embedded as point attrib
2. the sensors are the centroids of the polygons in a grid
3. the context (obstruction) consists of the grid and a tall building

What I did previously are:
4. use the foreach node to calculate the ”cumulative effective radiance“ for each sensor (polygon) taking into consideration of the context
5. inside the foreach node, copy the suns to the centroid of the current polygon
6. for each sun, we use a VOPSOP to get 1) it's visibility from sensor, 2) its ”effective radiance contribution without obstruction“, and then each sun's ”actual effective radiance contribution“ to the current sensor is ”effective radiance contribution without obstruction“ multiplied by ”visibility“
7. get the sum of the ”actual effective radiance contribution“ from all suns, and pass that attrib to the current polygon
8. visualize the ”actual effective radiance contribution" for all the polygons

Hope I have explained my idea clearly….

- Ji

Attachments:
1 sun.PNG (95.6 KB)
2 sensors.PNG (83.5 KB)
3 context.PNG (58.8 KB)
4 for each polygon.PNG (90.6 KB)
5 copy sun to sensor.PNG (189.3 KB)
6 get sun visibility and contribution.PNG (180.3 KB)
7 sum contribution for all sun.PNG (264.1 KB)
8 get the cumulative effective radiance from all suns.PNG (241.1 KB)
cumu_dir_irradi_via_VOP_v003.hipnc (234.2 KB)
cumu_dir_irradi_ZartiWay_v003.hipnc (177.4 KB)

User Avatar
Member
479 posts
Joined: Dec. 2009
Offline
(some follow up) this is what I want to calculate and visualize:

(the bgeo file in the attached zip file is the daytime hourly sun positions for London on 22 March with the sun's irradiance value embedded for each position)

Attachments:
viz.PNG (39.9 KB)
cumu_sun.rar (27.5 KB)

User Avatar
Member
7734 posts
Joined: July 2005
Online
oat
Hi, It seems the foreach node “moved” one of the input polygons and put in on top of the adjacent polygon after the node finishes the calculations embedded inside (see images below).

I think this might be a bug you should submit. If I load your .hip file, turn off “Merge Results” and then back on again, then it seems to cook fine.
User Avatar
Member
479 posts
Joined: Dec. 2009
Offline
thanks, edward!

According to the Houdini team it is not a bug:



Side Effects Support Ticket: #7464

Hello,

This is not a bug. When you nest foreach sops, you have to rename the stamp name variables in the nested foreach, or they might evaluate erroneously.

So, in your hip file, in the calc_contribution_from_each_source_pts node, please rename the Stamp Name MYVALUE (or something else of your choice) and the Index Stamp Name MYIDXVALUE.

Cheers,

Support

Thanks, Houdini team!

J
  • Quick Links