Need to make a custom shader with python in eddy

is it possible to make a shader with temperature ramp shader in Eddy?

I have tried eddy expression shader.and find some error, can’t continute.

Here is the code:

@eddyscript.shader(fields=[‘density:Float’, ‘velocity:Float3’, ‘holdout:Float3’, ‘temperature:Float’],
settings=[‘absorption_colour:Float3:[1.0, 1.0, 1.0]’,
‘scattering_colour:Float3:[1.0, 1.0, 1.0]’,
‘emission_coefficient:Float:1.0’,
‘temperature_coefficient:Float:1.0’,
‘black_body_ramp:Float4Ramp’]
)

I find when using Float4Ramp, can’t compile shader. and use float3 can.
So I find the doc.
seems Float4Ramp is some kind of a list of params.
eddy. create_black_body_ramp ( min_temperature: float , max_temperature: float , white_balance_temperature: float , num_samples: int , color_space: unicode ) → eddy.Float4Ramp

so how can this “Float4Ramp” add to Eddy expression shader?

The expression nodes don’t currently have support for Float4Ramps, which unfortunately makes this a little messy. If what you want is a color ramp that you can edit in Nuke, then take a look at the example in the following post. This uses the Eddy compositing system to create emission from a temperature channel, using three separate Nuke ramps for the red, green, and blue channels.

Thanks, Niall.
I have already make a ramp expression shader.
But I found 2 bugs:
1,
While re-open the nuke project, Shader can’t store compile result,
All params are gone. Need re-compile. and re-fill the params.
So can’t use this shader in batch render.

2,
" settings=[‘absorption_color:Float3:[1.0, 1.0, 1.0]’, "
in code default values seems can’t be the default values to the params.

Find 1 more bug.
when I use 2 custom shader, only the first one will works. the other shader seems can’t works.

I have used my shader to tweak some explosions.
Seems can use for some kind of strange color explosions, also can use for normal explosions

Thanks for the bug reports, I will look into them. The saving/loading problem appears to be with the parameters that are declared in the script itself, so as a workaround you can use the “Edit Parameters” button to create these instead. Just remove the whole “@eddyscript.parameters” section from your script and instead add your parameters to the dialog:

The script should then load correctly so will be usable in batch mode. The downside of course is if you have multiple E_ExpressionShader nodes you will have to add the parameters to each one separately.

ok, now works, thanks.

Is there any other reference/doc for the expression shader?

I want to know about more
like
sample = MediumSample
MediumSample can’t be found in current docs.
or velocity field can be used for some good result sample codes?

MediumSample is just an object for returning the absorption/scattering/emission values from the shader, it just has those three values and nothing else. The velocity field is usually only used by the “shader_velocity” function, when rendering with motion blur the velocity it returns is used by the renderer to blur along the fluid velocity direction. The velocity field can of course be used in the other shader functions if you have something special in mind, e.g. changing colors based on velocity perhaps.

There’s not a lot of documentation for the expression shaders, just the doc for the E_ExpressionShader node which you’ve probably already seen, and there’s some general EddyScript documentation for the available built-in functions too.