three.js

Three.js -> FileLoader(scope.manager) not constructor

ε祈祈猫儿з 提交于 2020-01-02 07:19:11
问题 This might seems as a duplicated question, since it is very similar to this one or many others, but none of the posts I have seen really helped me to figure out where the problem is ( sure, it's me ;) ...), hence I dare to post it here, since it makes me going really crazy. Well, I am working on a project in Angular2 generated with Angular CLI (no backend task or any trafficking, just HTML + CSS + JS files at the moment ... all up to date and latest). I have imported Three.js and three-obj

Combining three.js and KineticJS - 3D cube

亡梦爱人 提交于 2020-01-02 07:15:09
问题 I am trying to add a 3D cube to Kinetic JS canvas to show the x,y,z rotation. I found this article http://www.tonicodes.net/blog/combining-three-js-and-kineticjs. I worked with version 3.8, When I tried to follow the example using the version 4 of Kinetic JS I got this error, Unable to get property 'appendChild' Any suggestions, to solve it or a better method to include 3D cube in the canvas. complete project http://jsfiddle.net/user373721/hXw6D/1/ I found this perfect example http:/

Adding a different colour to each side of this obj

让人想犯罪 __ 提交于 2020-01-02 06:46:14
问题 I've recreated a bag model for my application and exported it into ThreeJs as an .obj: I've assigned a different colour to every face found in the models geometry like this: var geometry = new THREE.Geometry().fromBufferGeometry( bagMesh.children[0].geometry ); for (var i = 0; i < geometry.faces.length; i ++ ) { var face = geometry.faces[i]; // 7 & 8 = front side // can we flip its normal? if(i === 7 || i === 8) { face.color.setHex( 0xff0000 ); } else { face.color.setHex( Math.random() *

outline a 3d object in three.js

99封情书 提交于 2020-01-02 05:41:30
问题 In many video games, I see a pattern where, when you mouse over an object, it will show a nice gradient highlight around the 2D form of the object. I set up a fairly basic Three.js scene with a sphere in it To begin, I set up my raycaster variables: var projector = new THREE.Projector(); var mouse2D = new THREE.Vector2(0, 0); var mouse3D = new THREE.Vector3(0, 0, 0); Then I make a raycaster function document.body.onmousemove = function highlightObject(event) { mouse3D.x = mouse2D.x = mouse2D

Manual selection lod of mipmaps in a fragment shader using three.js

岁酱吖の 提交于 2020-01-02 05:12:42
问题 I'm writing a physically based shader using glsl es in three.js. For the addition of specular global illumination I use a cubemap dds texture with mipmap chain inside (precalculate with CubeMapGen as it's explained here). I need to access this texture in fragment shader and I would like to select manually the index of mipmap. The correct function for doing this is vec4 textureCubeLod(samplerCube sampler, vec3 coord, float lod) but it's available only in vertex shader. In my fragment shader I

How to rotate a THREE.PerspectiveCamera around on object

牧云@^-^@ 提交于 2020-01-02 04:33:10
问题 I am making this program where you can click on an object, zoom to it, then look at it from all angles by holding the right mouse button and dragging. I need the camera to be going around the object, not rotate the object with the camera looking at it. I honestly just have no idea how to math it out! For testing there is already a game object with an xyz we have selected and are looking at var g = new GameObject(500, 0, 0);//The game object with xyz this.selected = g;//set selected to g /

Uniform vertex displacement for skinned mesh shader (Animated outline, Three.js)

孤街浪徒 提交于 2020-01-02 04:07:28
问题 I think I've solved implementation of rendering borders/outlines over meshes in Three.js, a technique many games use for highlighting objects/characters. Diablo 1 and 3 for example Here are details and demo of my solution. Now what remains to be done are animated meshes (for characters etc). The problem is, skinned mesh is animated with a vertex shader and I also used a shader to scale (displace) the mesh out along the normals. It might be pretty straight-forward but unfortunately my math

Scale part of an OBJ in ThreeJS

我怕爱的太早我们不能终老 提交于 2020-01-02 02:19:12
问题 I have an .obj file that looks like this: What I need to be-able to do is scale only a certain part of the handles - in this case the point at which the handles actual bend down from the top. So I'd want to be-able to make them longer in this case. Does anyone have any direction or an example of how this can be accomplished? All of the examples I have seen are just on scaling the whole model and not just part of it. I was thinking that I'd need to create a Spline based off of the vertices in

Scale part of an OBJ in ThreeJS

旧巷老猫 提交于 2020-01-02 02:19:09
问题 I have an .obj file that looks like this: What I need to be-able to do is scale only a certain part of the handles - in this case the point at which the handles actual bend down from the top. So I'd want to be-able to make them longer in this case. Does anyone have any direction or an example of how this can be accomplished? All of the examples I have seen are just on scaling the whole model and not just part of it. I was thinking that I'd need to create a Spline based off of the vertices in

Hide faces with GLSL shader

五迷三道 提交于 2020-01-01 22:29:12
问题 I'm trying to wright a shader to work with three.js. Which is a javascript library for WebGL. I just started reading up on GLSL so there are some thing i'm having trouble with. Basically I want reveal and hide faces of a geometry. I have cloned my geometry's face array and reordered it. The reordered array has the faces in the order I would like to reveal/hide them. I have read that Uniforms can be access from anywhere within the pipeline. Can I just declare the array as a Uniform and access