three.js

Three.js - Can't Load A Texture

僤鯓⒐⒋嵵緔 提交于 2021-01-29 18:10:21
问题 So all I want to do is grab a texture that I have saved in a folder. The error I'm getting is: "GET file:///E:/Html/Expo%20Sites/Good%20Site/tex/dirt.jpg net::ERR_FILE_NOT_FOUND" I'm getting the texture, putting it in a variable, creating the geometry, creating the material, then creating the object and assigning the material to it. I'm new to the Three.js library so I might be missing something really obvious. Here's the code if you wanna have a look. var mousePos = {x: 0.0, y: 0.0}; var

Three JS - why is line length equal to zero?

守給你的承諾、 提交于 2021-01-29 16:16:09
问题 New to three js. Exploring working with line segments. I'm trying to determine the length of a line. I'm using the computeLineDistances(); method to get the line length. The line is drawn along the x-axis ending at x=10. For some reason the log console returns a zero value. Does anyone have an explanation why the length returned in the console = 0; var myLength =0 ; //a line start point (0,0,0), end point (10,0,0) var points = []; // x, y, z points.push( new THREE.Vector3( 0, 0, 0 ) ); //

Tilt three.js background or tilt HDRI image?

依然范特西╮ 提交于 2021-01-29 14:53:12
问题 I'm doing a space sim with three.js, and I need to tilt the star map by ~23.44 degrees (earth's axial tilt) to orient it to the ecliptic. The source files are HDRI oriented to the celestial equator. Do I need Blender, and would that work? Or is there a procedural way in three.js to tilt the background? I have tried using a sphere geometry in three.js, and I have seen the other SO answer "solved" using a box geometry, but neither of these are suitable because I'm already working with

Three.js scene not reacting while program is running

大城市里の小女人 提交于 2021-01-29 14:50:36
问题 three.js r114 What happens is that I want to create a playfield field for field. When a button is pressed, a new playfield shall be created. That works. Before the new playfield is created, the old one has to be deleted. Then the new playfield shall be created with a little delay after every single part of the field. I tried a lot to make every change directly visible but there are no changes visible while the program is running. First I try to make the playfield- object3d invisible so I call

Webpack in React can't load the 3D model with a GLTF extension, shows 404 not found

六月ゝ 毕业季﹏ 提交于 2021-01-29 12:52:26
问题 I'm trying to load the 3D model with the .gltf extension in React with Typescript. The files in folder with 3D model are .gltf, .png and .bin files. The tools used for this task are webpack and useGLTFLoader from drei library. I've tried different tools. Mainly from three.js library with no effect. Error is showing that the 3D model is not found 404 (shown below) and nothing appears in place where 3D model should be placed. GET http://localhost:3000/assets/models/Duck/glTF/Duck.gltf 404 (Not

Three.js mousewheel to move camera up/down instead of zoom-in/out

∥☆過路亽.° 提交于 2021-01-29 09:51:24
问题 How do you do this? I created a scene using the Three.js Editor and downloaded the project using the "Publish" option. I edited the app.js file to import OrbitControls, so now I can use the mouse wheel (or in my case the Apple Magic Mouse 2 trackpad surface) to zoom in/out of the scene. However, I don't want the mouse wheel to zoom, I want it to "scroll" (move the camera up/down along the Y-axis as opposed the Z-axis). Is there a way to do that? Is OrbitControls the way to get there or does

How to use video element or html content as a face texture in three.js?

拈花ヽ惹草 提交于 2021-01-29 09:24:08
问题 I am looking to use a video texture for a face in three.js. I know this is fairly easy to do if you have the video data. But what would I do if I only have the element it is playing from? For example: How would I play a youtube video and copy the video or player onto a face in three.js? 回答1: There is an example of integrating Three.js and YouTube videos at http://threejs.org/examples/css3d_youtube.html#cats and examples of including general HTML elements (using CSS3D) at http:/

display three.js scene across multiple screens

北城以北 提交于 2021-01-29 07:51:05
问题 is it possible to use threejs to display the same scene in different browser windows? or even in Fullscreen across multiple displays? i know it is possible to render the same scene from multiple views into one window, so the breaking point is if it is possible to pass the render context to another browser window. i have not found any examples for this use case and a rough first try fails: https://codepen.io/tp_up/pen/vYBqLEq?page=1 secondWindow = window.open(); secondWindow.document.body

THREE.CanvasTexture needsUpdate no helps

可紊 提交于 2021-01-29 07:17:04
问题 I have video tag and he plays simple video. [works] I have canvas2d with playing same video [works] opencvjs video processing (canvas is output , video is input)- also works I have three.js with plane mesh texture = new THREE.CanvasTexture(this.$refs.testcanvas) texture.needsUpdate = true; materialLocal = new THREE.MeshBasicMaterial({ map: texture }) materialLocal.needsUpdate = true; materialLocal.map.needsUpdate = true; this.mainVideoMesh.material = materialLocal this.mainVideoMesh.material

Subtracting Geometry in Three.js (or really, 3D programming in general)

吃可爱长大的小学妹 提交于 2021-01-29 06:50:22
问题 I'm currently working on a small project with which I need to subtract a rectangular area of a cube on mousemove (think, an indented area for placing a door on a house). The 'door' would be 'placed' on click, but would need to be 'visualized' while the user is deciding its location; in reality, nothing changes except the fact that the user is no longer moving it around. The issue here is finding an efficient way of allowing a user to move the door around, while it interacts and modifies the