Autodesk / sitoa

Arnold plugin for Softimage
Apache License 2.0
33 stars 16 forks source link

Varying StrandAttributes with less samples than StrandPosition is flickering #70

Closed JenusL closed 5 years ago

JenusL commented 5 years ago

While working on #63 I found a bug in how we export varying data from ICE. I think that type of data is only exported on Strands that have varying data across it's length. The problem is if we, for example, have a StrandColor array of 4 values per strand, but the StrandPosition has more values. This often happens in scenes where you want to copy the PointPosition to be the first StrandPosition so that the strand start from the EmitSurface. That is a very common workaround that needs to be done on most scenes using strands with SItoA. Right now that missing StrandColor value is just skipped and left uninitialized in the Array in Arnold. This causes that value to be different on each render. In the case of StrandColor, the tips of the strands would flicker in all sorts of colors, different on each render and also full of NaNs. The reason why this has gone unnoticed for long is that most often that uninitialized value will be 0. The tips of the strand would in that case just fade to black and that is just something that has gone unnoticed. Somehow now with Arnold 5.3 and maybe a Windows / compiler / physical hardware combination the bug started to show more clearly.

I tried Mental Ray, and there the behavior is a little different depending of what value it is. StrandSize is falling back to ParticleSize, so the strand isn't varying in size. StrandColor (or ColorAlongStrand as it's called in MR), is using the last value of the strand color on the missing sample. A "Hold Last Value" if you will. No warning messages.

As I see it we have two choices.

Either way I'm gonna add a warning message that the attribute doesn't have the same amount of values that the strand has. I'm also going to fix the test scenes that's affected by this.

JenusL commented 5 years ago

Just tried with StrandColor having more samples than StrandPosition. No crash but Arnold say this: // ERROR : [arnold] AiArraySetRGBAFunc: out-of-range error (11 out of 11) in plugins\sitoa\loader\ICEHelpers.cpp at line 2400 My fix will take care of this as well.