Gradient - InitRenderStruct
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 20/02/2012 at 05:39, xxxxxxxx wrote:
Hi Sebastian,
I found a post (https://developers.maxon.net/forum/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 renderdef 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.
Luther
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 20/02/2012 at 06:22, xxxxxxxx wrote:
Here's the final result of my script:
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
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
Luther
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
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 -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 21/02/2012 at 09:56, xxxxxxxx wrote:
Hi Lennart,
here's the code:import c4d
from c4d import utils
import c4d.modules.mograph as mograph
from c4d.modules import renderdef 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 FalseColor=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.Cheers
Luther
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
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.Cheers
Lennart -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
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.
Cheers
Lennart -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
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 -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 25/02/2012 at 17:04, xxxxxxxx wrote:
Yup, seems to work pretty well.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
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 -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
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 -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
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))
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
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
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
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
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
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. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/02/2012 at 16:23, xxxxxxxx wrote:
Oh. You're using a Mograph color shader.
Now I've got it all workingThanks for the explanation.
-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 27/02/2012 at 01:21, xxxxxxxx wrote:
Hi Guys,
heres my sample project:
ColorOverLife001-1.c4dI hope it's useful to someone.
Cheers
Luther