ShaderBuilder, How to get Time or FrameNumber
cschnei
Posts: 0
Hello everyone,
i'm searching for a way to use the time or the FrameNumber inside my own ShaderBuilder shader.
"Block" -> variable -> time seem to be 0.
A value that can be "animated" over the timeline would work as well.
Thanks for helping.
Comments
As I recall from the early days of the Shader Mixer, this topic came up, and the challenge is that the information passed to the rendering threads doesn't include frame or timeline information. But I'll fire up my Shader Mixer and see if I can verify.
FYI, the "time" and "dtime" variables aren't going to help.
time is when the shutter of the camera was opened. Which (I believe) will always be zero for the DAZ Studio engine.
dtime is how long the shutter was open. Really only useful for applying motion blur.
I have found where the frame number should be available. According to 3Delight Documentation, the function call...
should return the frame number into the variable FrameNumber. I've tried creating a custom function in ShaderBuilder to get this information, but it's returning zero. Could be a problem with my code, though.I'm going to cross-post in the developer's forum to see if the bit heads down there have any ideas.
Thread in Developer forum
Thank you for telling me, what time and dtime really does (very irritating names).
I tried your code myself.
Strings with a wrong name return zero. Ri:FrameBegin returns 1,0, so it must exist.
But its not returning the current framenumber.
I can't believe, that we are the only one trying to animate a shader over time.
This is an essential feature for a render program!!!
Or is there some other "hack" to get something similar like a frame number?
I hope you get an answere to your developer post.
May have found more info. Check the developer thread for what I found when I rendered to a RIB file from DS.
Has some other person an answere, how to get the FrameNumber inside the ShaderBuilder?
@JonnyRay: I tried setting the FrameNumber using RenderTime Script, but no luck.
Here is my code:
var nFrame = 0.8; //constant for testing
Shader.setFloatToken( "__fff_ef", nFrame ); //3delight specific version, i think
Shader.setFloatAttrib( "fff", "float ef", nFrame ); //other renderers
Then i added the float value __fff_ef to the parameter list.
But i had no luck. __fff_ef is still zero.
Does someone know, how to set a rendertime variable and use it inside a shaderbuider macro.