Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 19/02/2012 at 16:50, xxxxxxxx wrote:
Hi, I'm tryng to use CustomDataType Gradient and I'm tryng to retrieve the CalcGradientPixel. Now R13 Gradient.CalcGradientPixel needs InitRender(), but I don't understand what this means. How can I get the value of the gradient (color vector in some position X)?
Best regards,
Luther
On 20/02/2012 at 02:10, xxxxxxxx wrote:
That means you have to wrap CalcGradientPixel around the calls InitRender() and FreeRender. In which context do you call CalcGradientPixel? In a Shader, in a tag?
Cheers, Sebastian
On 20/02/2012 at 03:42, xxxxxxxx wrote:
Hi Sebastian, I made a UserData ColorGradient, but when I try to receive the value in an X position, I get always same value: Vector(0,0,0). In the Python (C4DSDK) documentation I have read that I need to call InitRender(), and I think that is the problem.
Any suggestions?
Best regard.
On 20/02/2012 at 04:07, xxxxxxxx wrote:
Hi Sebastian, Here's my code:
def main() : ColorOverLife = op[c4d.ID_USERDATA,2] # my userdata color gradient ColorOverLife.InitRender(irs) #I don't know what irs means ColorOverLife.FreeRender() print ColorOverLife.CalcGradientPixel(0.1) # I tryed many value but I receive always the same vector
On 20/02/2012 at 05:39, xxxxxxxx wrote:
Hi Sebastian, I found a post (https://plugincafe.maxon.net/topic/6053/6209_grabbing-bitmap-data-off-a-shader-solved) where I saw how InitRenderStructur() works.
Here's the correct code:
import c4d from c4d import utils import c4d.modules.mograph as mograph from c4d.modules import render
def main() : ColorOverLife = op[c4d.ID_USERDATA,2] irs=render.InitRenderStruct() ColorOverLife.InitRender(irs)
print ColorOverLife.CalcGradientPixel(0)
ColorOverLife.FreeRender()
thank you anyway, I hope this code is useful for someone.
On 20/02/2012 at 06:22, xxxxxxxx wrote:
Here's the final result of my script:
http://vimeo.com/37110053
On 20/02/2012 at 09:03, xxxxxxxx wrote:
In reference to the video of the last post, I'd like to make another user data gradient (black and white) connected to the trasparancy over life of the particles. How can I do this if I have the color of the particle connected with the other gradient. Is there another channel or trick to do this?
I hope that someone can help me.
Cheers
On 20/02/2012 at 09:34, xxxxxxxx wrote:
That looks great Luther, thanks for posting your gradient read findings. I can't be of much help yet but love to know how you connected the color to particle life if possible. Then I might understand the next issue (opacity etc).
Cheers Lennart
On 21/02/2012 at 09:56, xxxxxxxx wrote:
Hi Lennart, here's the code:
def main() : ColorOverLife = op[c4d.ID_USERDATA,2] # gradient user data irs=render.InitRenderStruct() ColorOverLife.InitRender(irs) tp = doc.GetParticleSystem() md = mograph.GeGetMoData(op) if not md: return False
Color=md.GetArray(c4d.MODATA_COLOR) cnt=md.GetCount()
for i in range (0, cnt) : life = tp.Life(i) lifeTime = life.Get() age = tp.Age(i) ageTime = age.Get()
Color _= c4d.Vector(ColorOverLife.CalcGradientPixel(ageTime/lifeTime)) ColorOverLife.FreeRender() md.SetArray(c4d.MODATA_COLOR, Color, True)
I hope you can help me with the trasparency over life... Make good use of it.
On 21/02/2012 at 17:24, xxxxxxxx wrote:
Thanks for the added lines, yeah I run into the same issue how to run several channels in my short test. Hopefully Sebastian can add some info if possible. I'd love to get this working but are tied 24/7 till the beginning of March.
On 23/02/2012 at 15:27, xxxxxxxx wrote:
I fail to see how to do this by code only (different gradients for different channels, like Color, luminance and alpha i.e). It would be absolutely fantastic to get a StormTracer behavior for geometric clones. It is still a huge step forward to have your gradient for lets say Luminance and then do the standard workaround of using two copies of the material one with opaque alpha and the other with full alpha and animate the texture tag between them and still get a different color gradient independent of alpha.
Any input from anyone that might shed some light on this would be fantastic.
On 25/02/2012 at 09:47, xxxxxxxx wrote:
Hi Lennart, I think I have the solution: just create a Black/White ColorOverLife Gradient and than apply a Colorizer channel (luminance Imput) to modify the gradient. It was so simple :nerd: Let me know if that works for you.
Cheers Luther
On 25/02/2012 at 17:04, xxxxxxxx wrote:
Yup, seems to work pretty well.
On 26/02/2012 at 09:29, xxxxxxxx wrote:
Would it be possible for one of you guys to post a file of this?
md.SetArray(c4d.MODATA_COLOR, Color, True) is producing this error: "InvalidObject Length". And I can't figure out what I'm doing wrong.
Thanks, -ScottA
On 26/02/2012 at 10:16, xxxxxxxx wrote:
I was wondering about this, too. The code Luther posted can't be correct. I guess it should be something like Color _= ColorOverLife.CalcGradientPixel(ageTime/lifeTime).
Cheers, Niklas
On 26/02/2012 at 12:03, xxxxxxxx wrote:
Just add the index in the for loop result (I think its just a typo by Luther) and it's all dandy.
Color[i] = c4d.Vector(ColorOverLife.CalcGradientPixel(ageTime/lifeTime))
On 26/02/2012 at 13:01, xxxxxxxx wrote:
My guess was right then, ha. Btw, enclosing the call to c4d.Gradient.CalcGradientPixel with c4d.Vector() is not necessary. Cheers, Niklas
On 26/02/2012 at 13:05, xxxxxxxx wrote:
Thanks. Got it working now. But having trouble with the luminance part.
I assume what you're doing is adding a material to the cloner. Then adding a colorizer to the luminance channel in that material. Then changing the colors for the knots in the colorizer to Black & white to gradually make the particle objects invisible?
If that's what you're doing. I'm having a very tough time with that. Because the luminance seems to not fall off from the first knot's color. No matter how I set up the colorizer's knots.
-ScottA
On 26/02/2012 at 15:31, xxxxxxxx wrote:
You make a userdata color gradient, black to white. Thats the base for the code. Then adding a material with Mograph Color shader for alpha and luminance channel on the cloner. In the luminance channel you add the colorizer on the mo color shader.
On 26/02/2012 at 16:23, xxxxxxxx wrote:
Oh. You're using a Mograph color shader. Now I've got it all working
Thanks for the explanation.