Help needed - crowd and storing agent specific data

   1260   3   2
User Avatar
Member
141 posts
Joined: Dec. 2015
Offline
Hi folks

Thank you in advance reading, and trying to help me.

I have a crowd (any crowd would do). The crowd is built using Mixamo and Adobe Fuse characters. I have to color each agent's top and bottom (jacket and pants) differently. To achieve this, I generate random colors, and store them in two attributes. The idea is to acces those attribute using stylesheet.


1. My problem is (and it's my fault) that I was testing the scene on one frame, and when I ran the animation, I realized that the random number generation happened every frame…How can I generate color randomly and store them in attribute without changing frame by frame?


2. I tried to use the Stylesheet, I understand now how it works, yet it seems it doesn't really do what I expect. Apparently the data read has nothing to do with the data on the given agent. If anyone could take a look, I'd appreciate it.

Lawyer.zip must be extracted to the agents folder of the project

Thanks girls and guys!

Attachments:
crowdtest.hiplc (747.7 KB)
lawyer.zip (1.8 MB)

User Avatar
Staff
727 posts
Joined: Oct. 2012
Offline
szmatefy
1. My problem is (and it's my fault) that I was testing the scene on one frame, and when I ran the animation, I realized that the random number generation happened every frame…How can I generate color randomly and store them in attribute without changing frame by frame?

You should call random.seed() - otherwise you'll get different results whenever the SOP is recooked (which happens every frame because its input is time-dependent), or when you reload the file, etc.
The better approach, though, is to re-use some of the existing nodes that can do this for you - e.g. the Color SOP's Random option or the Attribute Randomize SOP.
The stylesheet renders fine for me, though
User Avatar
Member
141 posts
Joined: Dec. 2015
Offline
Thanks cwhite!

I'll check it! For me the color in the spreadsheet was different than the rendered color. I'll check it too.

Thanks again!


Szabolcs
User Avatar
Member
141 posts
Joined: Dec. 2015
Offline
I tried, checked, and it works! Thank you cwhite, you saved my as…neck… )))))
  • Quick Links