Hey Guys,
I’ve tried to get this working and I thought the instructions provided would be enough to figure out this task. Unfortunately I’ve had some trouble after several attempts. So I’m going to detail what changes I made to the standard Tron Example and hopefully someone can point out my error(s):
So First I Changed that last line in glowShader.sha
//Cg
//
//Cg profile arbvp1 arbfp1
void vshader(float4 vtx_position : POSITION,
float2 vtx_texcoord0 : TEXCOORD0,
uniform float4x4 mat_modelproj,
out float4 l_position : POSITION,
out float2 l_texcoord0 : TEXCOORD0)
{
l_position=mul(mat_modelproj, vtx_position);
l_texcoord0=vtx_texcoord0;
}
void fshader(float2 l_texcoord0 : TEXCOORD0,
uniform sampler2D tex_0 : TEXUNIT0,
out float4 o_color : COLOR)
{
float4 texColor=tex2D(tex_0, l_texcoord0);
o_color=texColor*texColor.w*k_glow.x;
}
Then in Tut-Flow-Filter.py I did the following including adding another tron guy and setting the shader inputs:
# set the shader input for the render
render.setShaderInput('glow',Vec4(0,0,0,0))
# load our model
self.tron=Actor()
self.tron.loadModel("models/tron")
self.tron.loadAnims({"running":"models/tron_anim"})
self.tron.reparentTo(render)
self.interval = self.tron.hprInterval(60,Point3(360,0,0))
self.interval.loop()
self.isRunning=False
self.tron.setShaderInput('glow',Vec4(1,0,0,0),1)
# load another model
self.tron2=Actor()
self.tron2.loadModel("models/tron")
self.tron2.reparentTo(render)
self.tron2.setPos(Point3(self.tron.getX()+10, self.tron.getZ(), self.tron.getY()))
self.tron2.setShaderInput('glow',Vec4(1,0,0,0),0)
The program runs, but both models are using the glow effect, as a side effect both models seem to glow all textures on the model now instead of just the blue glow texture. Any ideas?
Thanks,
C