yorke

Members
  • Content count

    24
  • Joined

  • Last visited

About yorke

  • Rank
    Member

Profile Information

  • Gender
  • Location
    Italy
  1. Woah tnx Luaacro, awesome! I like BJS's community reactivity I'm experiencing the same error posted by dad72 on the PG, will this feature be avalaible in BJS v3 stable release?
  2. Up. I tried to mix cel shader from the link posted by adam with raggar's code but meshes are now rendered totally black, here is what I did: <script type="application/vertexShader" id="vertexShaderCode"> [...] <script type="application/fragmentShader" id="fragmentShaderCode"> [...] mesh.material.subMaterials[0]=createCellShader(mesh.material.subMaterials[0].clone("CLONEMAT"),scene); [...] function createCellShader (material,scene) { var cMaterial = new BABYLON.ShaderMaterial ( "amiga", scene, { vertexElement: "vertexShaderCode", fragmentElement: "fragmentShaderCode", }, { attributes: ["position", "normal", "uv"], uniforms: ["world", "worldView", "worldViewProjection", "view", "projection"] } ); if(material) { if(material.diffuseColor) cMaterial.diffuseColor = material.diffuseColor; if(material.diffuseTexture) cMaterial.diffuseTexture = material.diffuseTexture; } return cMaterial; } Any ideas? I also tried to change light position in shaders but nothing changed. I don't know how to investigate this
  3. Thank you raggar. That could be a nice solution, i'll give a try
  4. Many tnx for your link adam. Shader's code is clear, but it's not clear to me how to apply the shader on materials exported form blender. If I apply this code: var amigaMaterial = new BABYLON.ShaderMaterial(...custom vertex and pixel shader ) scene.materials[n] = amigaMaterial; every material in the scene would be overwitten (I think), so it would loose what i've defined in blender for that material (texture, diffuseColor etc). On the opposite, I'd like every material to preserve its original properties and change only the shader. Is it possible to achieve this in some way or I have to create every time a new ShaderMaterial and "manually" append the properties from the original material to it? Tnx in advance
  5. Hi all. I'd like to know if BJS supports cel (toon) shading? Didn't find anything about that. My scene is exported from Blender, the goal would be to apply cel shading on all meshes. Lurking the code i saw that there's a mesh.convertToFlatShadedMesh() function, but nothing similar about cel shading. Any ideas? Tnx, cheers
  6. Hi, I never used STL format but three.js has an ASCII .stl importer, you can try reverse engineering that: https://threejs.org/examples/js/loaders/STLLoader.js There are also converters for binary <--> ascii STL formats, you can search on the internet. By example I found this: https://github.com/cmpolis/convertSTL/blob/master/convertSTL.rb
  7. Really strange, I can't see the old dropdown to select BJS version nor in firefox 48 nor in chrome 56
  8. Thanks raggar, I saw your PG and I'm investigating what's wrong in my scene or models, that's really strange. At least you confirmed me that both functions use the same conventions for eulers, that's a good starting point. In previous PGs there was the option to run the PG on an older version of BJS, was this feature removed on PGs from BJS3? I can't see that option. For what concerns upgrading to v3, you're right but I saw that v3 is not marked as stable yet. I'm surely planning to upgrade and wasting some time to let my code compatible with it, but I'll first wait for the stable version
  9. Sorry I've still another question on this topic, I couldn't find an answer to this on the forum and official docs on rotations didn't help me. The question is: is there a way to get yaw, roll and pitch of a bone? Let me explain: I can rotate a bone using eulers: mesh.skeleton.bone.setYawPitchRoll(y,x,z) But how do I read those Eulers from the bone? if I try to read them using mesh.skeleton.bones.getRotation() I would have expected to obtain exactly x,y and z passed to setYawPitchRoll() function, but results are quite different. Lurking BJ'S code, I saw that getRotation() gets bone's RotQuaternion and calculates toEulers() on it, so I can't understand why results are different. By example: getRotation() output (x,y,z) coincide with values passed to setYawPitchRoll(y,x,z) only if x=z=0 and y in [0 , 3.14]. I tried both in local and world spaces but with no result, also tryed with quaternions but didn't arrive to anything... Am I missing something or babylon uses different euler conventions in those two functions?
  10. Thanks raggar and adam for your kind replys That seems to have done the trick, awesome as usual adam! Passed Space.WORLD with no mesh and everything seems working fine now, doing more tests however. On the opposite Space.LOCAL continues to give me strange results also with no mesh passed, althought if I saw it's working fine in the PG posted by raggar... But I'm working on models created and imported from blender, don't know if the problem can depend on that. I'm still on v2.5: I'm planning to move to BJS3 but i'm afraid with compatibility issues - and long, long debug sessions -, I had bad experiences with three.js (although that's a great framework, don't misunderstand me... maybe only a little bit "dynamic")
  11. Up. I'm achieving nice results using bone quaternions, but now i've the problem to let bone rotation not be affected by mesh rotation (or translation) Thus I can successfully work on bone rotations retrieving bone quaternion, interpolating it with the quaternion of the final pose and reapplying il to the bone: var quat = mesh.skeleton.bones[i].getRotationQuaternion(BABYLON.Space.WORLD, mesh); [...] modify quaternion mesh.skeleton.bones[i].setRotationQuaternion(quat,BABYLON.Space.WORLD,mesh); but if I rotate the mesh, the poses become wrong because I use world coordinates (e.g. mesh rotates but bone stays in the same place and does not rotate with the mesh). I tried to substitute Space.WORLD with Space.LOCAL but it gives odd results, e.g if I simply get the bone quaternion in local space and reapply it to the bone without changing it: var quat = mesh.skeleton.bones[i].getRotationQuaternion(BABYLON.Space.LOCAL, mesh); mesh.skeleton.bones[i].setRotationQuaternion(quat, BABYLON.Space.LOCAL,mesh); bone rotation changes, while I'd expect it to stay the same not having changed its local quaternion... How to let bone quaternion independent from mesh position/rotation?
  12. Tnx for your answer deltakosh (and great work, keep on ). Have to try to let this work on rotation matrices and not single variables in the mesh, but seems the right way
  13. Hi all, is there a way to interpolate actual bone rotation to have a "smooth" transition until it returns to rest pose? Explaining better: I can set rest pose on a bone by doing: mesh.skeleton.bones[19].setRotationMatrix(mesh.skeleton.bones[19].getRestPose().getRotationMatrix()) but obviously there's no transition between two poses by this way. How to interpolate along N steps between the two rotation matrices? Tnx
  14. Wow tnx adam, I see your PG working, but I've always the same problem using a very similar code: first click works, then terrain becomes unselectable (and I noticed that also boundingBox disappears). Quite strange, i can't explain myself. I try to upload here an example, if someone wants to give a check and report me what's wrong... http://yorke.altervista.org/webgl/Provaanim2.htm Many thanks Cheers
  15. Many tnx for your reply adam, you've always a solution for everything Following your suggestions solves the terrain creation problem, but now i've problems "interacting" with the terrain by the mouse. Let me explain: with a terrain created with CreateGroundFromHeightMap() I could by example raise terrain faces at mouseclicks using VertexBuffer: var pickInfo=window.engine.scenes[0].pick(offsetX, offsetY); var mesh = pickInfo.pickedMesh; var faceID = pickInfo.faceId; var indices = mesh.getIndices(); var vertices = mesh.getVerticesData(BABYLON.VertexBuffer.PositionKind); //Raise the height of vertices in this face id vertices [indices[faceID*3]*3+1]+=1; vertices [indices[faceID*3+1]*3+1]+=1; vertices [indices[faceID*3+2]*3+1]+=1; mesh.updateVerticesData(BABYLON.VertexBuffer.PositionKind, vertices,true,true); Now i've problems doing this: this code runs well only for the first time I click the terrain, from the second time the mesh seems to become "invisible" to mouse clicks (but it's still visible on screen). It seems that mesh.updateVerticesData() breaks something in the mesh structure... Any ideas?