Hello to all.
sorry for my english. i dont speak well.(write)
My question is…
I can do intancing of one model in about 40 intances. But every of them have the same animation.
self.aux = Actor(MyWorld.mydir+"/../modelInprogress/DummyBox.egg",
{"izq":MyWorld.mydir+"/../modelInprogress/DummyBox-izquierda.egg",
"der":MyWorld.mydir+"/../modelInprogress/DummyBox-derecha.egg"})
self.aux.loop("der")
...
...
...
self.chorus = NodePath('chorus')
self.chorus.reparentTo(render)
self.demasActI = []
for demas in range(MAX_ACT):
sitio = self.chorus.attachNewNode('posiciones')
sitio.setPos(0-(random.uniform(-10, 10)),-(random.uniform(2, 45)),7)
sitio.setTwoSided(True)
sitio.setHpr( 0.0+random.uniform(0,180),0.0,0.0 )
self.demasActI.append(self.aux.instanceTo(sitio))
self.demasAct.append(sitio)
well. If i do a shader, i can do some of the instances have different scales, color or something. But ¿ I can do bone animation with shader, how ?
I think is posible but i dont kwon how.
Actually i have one shader
//Cg
void vshader(
float4 vtx_position : POSITION,
float4 vtx_color: COLOR,
in uniform float4 k_time,
in float3 vtx_normal: NORMAL,
out float4 l_position : POSITION,
out float4 l_color0 : COLOR0,
uniform float4x4 mat_modelproj,
in float2 vtx_texcoord0 : TEXCOORD0,
out float2 l_my : TEXCOORD0){
float4 position = vtx_position;
if (position.x > 0)
position.x += 1 * (cos(k_time.x)+0.8);
//if (position.x < 0.3)
//position.x -= 1 * cos(k_time.x);
l_position = mul(mat_modelproj, position);
l_color0=vtx_color;
l_my = vtx_texcoord0;
}
void fshader(
uniform sampler2D tex_0 : TEXUNIT0,
float4 l_color0 : COLOR0,
in uniform float4 k_time,
in float2 l_my : TEXCOORD0,
out float4 o_color : COLOR){
//o_color=float4(l_color0[1],l_color0[0], l_color0[2],l_color0[3]);
//o_color = tex2D(tex_0, float2(1-l_my[0],1-l_my[1]));
o_color = tex2D(tex_0, float2(l_my[0],l_my[1]));
}
in this code
self.demasActI = []
for demas in range(MAX_ACT):
sitio = self.chorus.attachNewNode('posiciones')
sitio.setPos(0-(random.uniform(-10, 10)),-(random.uniform(2, 45)),7)
sitio.setTwoSided(True)
sitio.setHpr( 0.0+random.uniform(0,180),0.0,0.0 )
if ( (demas % 2)==0):
sitio.setShader(self.shader)
pass
self.demasActI.append(self.aux.instanceTo(sitio))
self.demasAct.append(sitio)
The shader in ACT_MAX=4 do the 2 and 4 object expand in x an contract in x an 1 and 3 not expand, ( its different animation in each intance). If i would send the position of the ¿bones? to the shader (maybe reading the .egg animation file) i can do different animations in each instance. This will be very great. But i dont kwon
¿ some one can help my ?
thanks.