three.js: Meshes created with ShaderMaterial do not play skeletal animation?

Hello i cant create SSAO, Depth of field(Bokeh), NormalMaps etc, shaders with skinned skeletal meshes loaded with JSON loader? I cant create normalmap shader with SkinnedMesh, and there is no effect in post proccesing with SSAO. The skinned mesh stuks in 1 frame of animation.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 1
  • Comments: 16 (8 by maintainers)

Most upvoted comments

Found a solution by re-inserting the shaderchunks in ShaderSkin.js:

    vertexShader: [

        "uniform vec4 offsetRepeat;",

        "varying vec3 vNormal;",
        "varying vec2 vUv;",

        "varying vec3 vViewPosition;",

        THREE.ShaderChunk[ "common" ],
        THREE.ShaderChunk[ "lights_pars" ],
        THREE.ShaderChunk[ "shadowmap_pars_vertex" ],
        THREE.ShaderChunk[ "morphtarget_pars_vertex" ],
        THREE.ShaderChunk[ "skinning_pars_vertex" ],

        "void main() {",
            "vec4 worldPosition = modelMatrix * vec4( position, 1.0 );",

            THREE.ShaderChunk[ "skinbase_vertex" ],
            THREE.ShaderChunk[ "begin_vertex" ],
            THREE.ShaderChunk[ "morphtarget_vertex" ],
            THREE.ShaderChunk[ "skinning_vertex" ],
            THREE.ShaderChunk[ "project_vertex" ],

            "vViewPosition = -mvPosition.xyz;",

            "vNormal = normalize( normalMatrix * normal );",

            "vUv = uv * offsetRepeat.zw + offsetRepeat.xy;",

            "gl_Position = projectionMatrix * mvPosition;",

            THREE.ShaderChunk[ "shadowmap_vertex" ],

        "}"

    ].join( "\n" )

Can you give an advise how to implement skinning into shader skin.

http://necromanthus.com/Test/html5/Lara_shader.html

vertexShader updated to work with r71. cheers

Can you give an advise how to implement skinning into shader skin. http://necromanthus.com/Test/html5/Lara_shader.html

vertexShader updated to work with r71. cheers

After looking through hundreds of pages this is the first real example of how to do skinning with custom shaders in the material I’ve found. This example should be added to three.js examples and given the recognition it deserves. We newbies have a tough time getting these simple things to work and I really appreciate the effort. As a note, this needs the minified library (v77) to work: http://threejs.org/build/three.min.js

THREE.ShaderMaterial essentially means “I’ll write my own shaders”. If you’ve not included any code for skinned meshes, it won’t do anything with them.

Ben, Please take a look of the source of this sample: http://necromanthus.com/Test/html5/Lara_shader.html It worked with r66. It doesn’t work with r71 anymore. With “mvPosition = modelViewMatrix * skinned;” you’ll get some trash on the screen.