shaders and animations

Started by elhoce, March 06, 2012, 07:58:19 PM

Previous topic - Next topic

elhoce

Hi,

I have a problem with shaders,  my model don't move (bones animation) when I activate a shader

my code

GLSLShader shader = new GLSLShader(Loader.loadTextFile("./vertexshader_body.glsl"),Loader.loadTextFile("./fragmentshader_body.glsl"));
        for (Animated3D o : animatedGroup) {
            o.getName();
            o.setTexture("corps");
            o.setRenderHook(shader);
            o.compile();
            o.build();
            o.discardMeshData();
        }

if I comment o.compile() my model moves but without shader  :-[

Can you please tell me why ?

Thanks

EgonOlsen

Replace o.compile() vy o.compile(true); and add a call to Object3D.touch() right after calling the animation method.

elhoce

Thanks now it works fine !

I have another question, I have a model composed of several parts,  How can I disable the normal auto computing during the loading model ?
I have already comment the Object.build() call.

Thanks

EgonOlsen

Why do you want to do this? Without normals, no lighting will work properly.

elhoce

because my file already contains precalculated normal data, and because my model looks bad between the parts in jpct

EgonOlsen

jPCT doesn't load normal data from the file. It fully relies on its own calculations. What's the problem "between the parts" (screen shot)?

elhoce

#6


the problem is I see the edge of each part, so I think the normals must be calculated on the whole model not in each part (part == one object3D)

EgonOlsen

And it's not an option to merge these parts into one Object3D?

elhoce

Yes I can, How can I merge them in jpct ?

EgonOlsen

#9