three.js

EffectComposer second pass “overwrites” first pass

拜拜、爱过 提交于 2020-01-05 03:08:11
问题 i want to render a texture on the background and the 3dscene in the foreground. i used the effectcomposer to do this. how ever my first pass (the background) seems to be "overwritten" with the 2nd pass (the scene) the result only the scene gets drawn with a black background. it looks like the background of the second pass isnt drawn transparent or the transparancy is lost. http://jsfiddle.net/mdwzx1f8/8/ var renderTex = new THREE.TexturePass(myTex); var renderScene = new THREE.RenderPass

ThreeJS: How can I use a shader to filter vertices by property?

南笙酒味 提交于 2020-01-04 17:31:28
问题 I'm using custom shaders to allow for slider filters on X, Y, and Z co-ordinates on a particle system by following this github issue. I'd like to expand this to allow filtering on non-positional properties such as a cost associated with each vertex. shader is a modified version of ThreeJS's particle_basic shader. Shader // snip // filter by co-ordinate "if(myWorldPosition.x < xMin) discard;", "if(myWorldPosition.x > xMax) discard;", "if(myWorldPosition.y < yMin) discard;", "if(myWorldPosition

How could i convert a maya file into a json file and use it with three.js

喜欢而已 提交于 2020-01-04 08:17:29
问题 I want to use some maya files in my three.js project,but it seems like only the json files can be used in three.js So how can i convert those files? thank you! 回答1: Please have a look at the three.js Maya exporter. The scripts should be in your three.js folder/ utils / exporters / maya 来源: https://stackoverflow.com/questions/14919219/how-could-i-convert-a-maya-file-into-a-json-file-and-use-it-with-three-js

how to get the absolute position of loaded .obj in three.js?

天大地大妈咪最大 提交于 2020-01-04 06:26:06
问题 loading the .obj: loader.load( 'test.obj', function ( objMesh ) { objMesh.traverse( function ( child ) { if ( child instanceof THREE.Mesh ) { child.material = mat2; } } ); I tried to find the position with mrdoobs code: objMesh.geometry.computeBoundingBox(); var boundingBox = objMesh.geometry.boundingBox; var position = new THREE.Vector3(); position.subVectors( boundingBox.max, boundingBox.min ); position.multiplyScalar( 0.5 ); position.add( boundingBox.min ); position.applyMatrix4( objMesh

Using Three.js obj-loader in React

瘦欲@ 提交于 2020-01-04 05:41:11
问题 In the first try, I used the normal import from node_modules and after that even minifided lib without success. In the next step I used an older version of Three. js library without any changes. I found out example whit imported three-obj-loader module and tried it and still don`t know why in the output I get OBJLoader is not constructed, but function. Many thanks for help. I`m importing loaders like this import OB from './ObjLoader'; import * as THREE from './three'; // var THREE = require(

WebGL on Cordova with Three.js

隐身守侯 提交于 2020-01-04 04:11:05
问题 I'm attempting to build a mobile app with Three.js on Cordova, This runs fine on the PC in the browser, but on the device it doesn't seem to be able to create the WebGL context on a Samsung Note 3 This is the error: THREE.WebGLRenderer 77 THREE.WebGLRenderer: Error creating WebGL context. three.min.js:633 THREE.WebGLRenderer three.min.js:633 Uncaught TypeError: Cannot call method 'getExtension' of null I'm using CrossWalk but it doesn't seem to make any difference 回答1: Yes I'm running 4.4.2

Tween JS basics on three JS cube

泪湿孤枕 提交于 2020-01-04 02:56:26
问题 I am new to Tween JS, and trying to make a simple animation of moving to the right using Tween. Below is my code in the init function ( I am using Three JS): var geometry = new THREE.CylinderGeometry( 200,200, 200, 4, 0 ); var material = new THREE.MeshPhongMaterial( { ambient: 0xf0f0f0, color: 0x006699, specular: 0x006699, shininess: 60, shading: THREE.FlatShading } ); var mesh = new THREE.Mesh( geometry, material ); mesh.position.x = 0; mesh.position.y = 0; mesh.position.z = 0; mesh

Three.js : Creating a right triangular prism

我与影子孤独终老i 提交于 2020-01-04 02:45:05
问题 I'm trying to create a right triangular prism. Here is my code so far : var triangleGeometry = new THREE.Geometry(); triangleGeometry.vertices.push(new THREE.Vector3(-1.0, 1.5, 0.95)); triangleGeometry.vertices.push(new THREE.Vector3(-1.0, -1.5, 0.95)); triangleGeometry.vertices.push(new THREE.Vector3( 1.0, -1.5, 0.95)); triangleGeometry.vertices.push(new THREE.Vector3(-1.0, 1.5, 1.2)); triangleGeometry.vertices.push(new THREE.Vector3(-1.0, -1.5, 1.2)); triangleGeometry.vertices.push(new

Using multiple Textures with geometry.faceVertexUvs

拟墨画扇 提交于 2020-01-03 21:07:13
问题 I want to use multiple materials and multiple textures on meshes. I use 3 materials and a geometry.faceVertexUvs with two arrays of Uvs. One arrayof UVs for the first texture and one array of UVs for the second texture. However that doesn't quite work. Three.js always uses the uvs of the first array and geometry.faceVertexUvs[1] is never used. Do I have to put all the uvs in geometry.faceVertexUvs[0] for both textures or does it work differently? And if I have to put all uvs in geometry

Load textures from Base64 in Three.js

北城以北 提交于 2020-01-03 16:53:44
问题 I am currently loading textures from URLs but since my back-end code is generating planets I need them to be displayed using Base64. (I'm playing around with procedural generation so I'd prefer not to save the image and then load it via URL) Here's the code; <!DOCTYPE html><html class=''> <head> <style>body { background: black; text-align: center; } </style></head><body> <script id="vertexShader" type="x-shader/x-vertex"> uniform vec3 viewVector; uniform float c; uniform float p; varying