Hi, this is my first real Panda3D project aside from the tutorials. Here is what I want to do:
I have a number of textures (50+) that should be played as a slow animation or slideshow on an object.
According to the texture-swapping tutorial (which I modified to load the textures when they are needed, not all at start) I can load the textures and show them on the object, but this way there is no blending or fading, just hard swapping.
So next I tried the texture blend mode (node.setCombineRgb(TextureStage.CMInterpolate, …) which allowed to blend between two texture stages forth and back. I then exchenge the texture which is currently not shown. But first there is a weird error, that although the texture in both stages are reloaded and set, only the even numbers of images are changed, so say there are images from 1 to 10, alternately set in the two texture stages, the shown images are like 1, 2, 1, 4, 1, 6, 1, 8, 1, 10…
Second issue is the max number of texture stages (4), when using 2 stages for one kind of textures, i run out of texture stages for bump and glow map (which also should be animated).
Now nearing the real question… I looked into shaders.
I wrote a simple shader that takes two textures and a float as input and outputs a blend between those textures using a lerp with the float. this works quite nice.
//Cg
void vshader(
uniform float4x4 mat_modelproj,
in float4 vtx_position : POSITION,
in float2 vtx_texcoord0 : TEXCOORD0,
out float2 l_texcoord : TEXCOORD0,
out float4 l_position : POSITION)
{
l_position = mul(mat_modelproj, vtx_position);
l_texcoord = vtx_texcoord0;
}
void fshader(
uniform sampler2D k_tex_0,
uniform sampler2D k_tex_1,
uniform float4 k_blendfactor,
in float2 l_texcoord : TEXCOORD0,
out float4 o_color : COLOR)
{
o_color = lerp(tex2D(k_tex_0, l_texcoord), tex2D(k_tex_1, l_texcoord), k_blendfactor);
}
But this shader doesn’t have any lightnig or shadowing, just coloring.
Now I thought, I could combine it with the auto-shader generated using “dump-generated-shaders” in the config.
(at least I hope that way I retain all the fancy lightning and shadowing and just add my blending)
My problem now is, that this generated shader uses a lot of inputs that I don’t know how to provide:
(To clarify, I know setShaderInput(), but not where to fetch e. g. plight_plight0_rel_view, which is not even noted in the documentation list of shader inputs…)
void vshader(
in float4 vtx_texcoord0 : TEXCOORD0,
out float4 l_texcoord0 : TEXCOORD0,
in float4 vtx_texcoord1 : TEXCOORD1,
out float4 l_texcoord1 : TEXCOORD1,
in float4 vtx_texcoord2 : TEXCOORD2,
out float4 l_texcoord2 : TEXCOORD2,
uniform float4x4 trans_model_to_view,
out float4 l_eye_position : TEXCOORD3,
uniform float4x4 tpose_view_to_model,
out float4 l_eye_normal : TEXCOORD4,
in float4 vtx_normal : TEXCOORD3,
in float4 vtx_tangent1 : TEXCOORD4,
in float4 vtx_binormal1 : TEXCOORD5,
out float4 l_tangent : TEXCOORD5,
out float4 l_binormal : TEXCOORD6,
uniform float4x4 trans_model_to_clip_of_slight0,
out float4 l_slightcoord0,
float4 vtx_position : POSITION,
out float4 l_position : POSITION,
uniform float4x4 mat_modelproj
) {...}
void fshader(
in float4 l_eye_position : TEXCOORD3,
in float4 l_eye_normal : TEXCOORD4,
uniform sampler2D tex_0,
in float4 l_texcoord0 : TEXCOORD0,
uniform sampler2D tex_1,
in float4 l_texcoord1 : TEXCOORD1,
uniform sampler2D tex_2,
in float4 l_texcoord2 : TEXCOORD2,
in float3 l_tangent : TEXCOORD5,
in float3 l_binormal : TEXCOORD6,
uniform float4 alight_alight0,
uniform float4x4 plight_plight0_rel_view,
uniform float4x4 slight_slight0_rel_view,
uniform float4 satten_slight0,
uniform sampler2DShadow k_slighttex0,
float4 l_slightcoord0,
uniform float4 row1_view_to_model,
out float4 o_color : COLOR0,
uniform float4 attr_color,
uniform float4 attr_colorscale
) {...}
Is there a way I can also generate/dump the used shader inputs?
Or can someone enlighten me, what exactly to provide as input?
Thanks in advance