Closed aznur closed 11 years ago
@aznur Unfortunately, the shader you're talking about is not implemented to work with skinning (as I can see from the source code). However, you can always look at some examples - I think that ShaderNormal
may be a good one - and try to edit the code of your vertex shader to get the desired effect.
is not my fault XD great
Shader normal is ? the normal in Shader Utils ?
@aznur Nope, not that one ;) I think there used to be sth like THREE.ShaderNormal['normal']
somewhere but I may be wrong. Nevermind, the standard shaders like basic
, phong
and lamberd
are also good examples.
What @apendua said: only standard materials support skinning / morphing.
A simplest solution for other custom materials is probably to recreate a specific effect shader from scratch using snippets from the standard materials.
using that ?@alteredq :
THREE.ShaderChunk[ "skinbase_vertex" ],
THREE.ShaderChunk[ "skinnormal_vertex" ],
THREE.ShaderChunk[ "skinning_vertex" ], ?
I think there should be more, every shader chunk from WebGLShaders.js
that references #ifdef USE_SKINNING
(don't forget chunks for parameter declarations).
Also looking at toon1
, you'll need to plug in properly skinned normal, both for normal itself and for refraction vector. Look for how objectNormal
is used in shader chunks (environment mapping also uses refraction).
this is what I did but the first results are not very conclusive
ok this is good thank you I love you (fraternal) you want me to post the code? or not because it is a bit of a mess at the moment you do not know how little I make an outline? be directly with the shader'm using a 2nd cut mesh?
hum i have a litlle problem
http://imageshack.us/photo/my-images/62/pobleme.jpg/
That seems like some problem with normals.
Here is a quick and dirty test, just reusing vertex shader from Phong material (also I had to hack toon shader to use vReflection
instead of vRefraction
to be compatible with naming convention):
https://dl.dropbox.com/u/26786471/tmp/tests/toon-skinning/webgl_animation_skinning_morph_toon.html
For the outline, I think @mrdoob had tested some solutions - if I remember well it was something like rendering slightly bigger black mesh first with faces turned inside out.
There are also some quite nice toon shadings here:
Not sure how they do it, may be worth checking (it's using three.js).
ok thx for help @alteredq
remains for me to put an outline and texture
the outline using since I must follow the mesh uses the same principle as described with phong but I is not as outline i use the vertex phong so I can not use a vertex shader with displacement as
"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
"vec4 displacement = vec4( normalize( normalMatrix * normal ) * 0.03, 0.0 ) + mvPosition;",
"gl_Position = projectionMatrix * displacement;",
how?
If it should not move again it works
material2.side = THREE.BackSide;
but with movement
I created a mesharticulated which works very well and import and in three js no problem I accede to the bones of the skeleton to modify as I want (in the webgl render) also it works or is the problem is that if I use the material as Shadertoon
it does not work with the originalMaterial -> work with a new lambert material Skinning : true ->works with a shader toon Skinning : true ->no works infact I can not change the rotation of the bones
var shader=THREE.ShaderToon["toon1"]; var uniforms = THREE.UniformsUtils.clone(shader.uniforms); uniforms.uDirLightPos.value=light.position; var parameters = { fragmentShader: shader.fragmentShader, vertexShader: shader.vertexShader, uniforms: uniforms, skinning: true};
thx for help