threejs | Threejs basic example Demo | Animation library

 by   huanzi-qch TypeScript Version: Current License: MIT

kandi X-RAY | threejs Summary

kandi X-RAY | threejs Summary

threejs is a TypeScript library typically used in User Interface, Animation applications. threejs has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

Threejs basic example Demo has basically encapsulated and realized the loading of OBJ, FBX, native objects, 2D, 3Dlabel, etc., the monitoring of the mouse event of the encapsulated object, and the encapsulation of lens animation, which basically meets the business development.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              threejs has a low active ecosystem.
              It has 19 star(s) with 10 fork(s). There are 1 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              threejs has no issues reported. There are 13 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of threejs is current.

            kandi-Quality Quality

              threejs has 0 bugs and 0 code smells.

            kandi-Security Security

              threejs has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              threejs code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              threejs is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              threejs releases are not available. You will need to build from source code and install.
              It has 153 lines of code, 3 functions and 14 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of threejs
            Get all kandi verified functions for this library.

            threejs Key Features

            No Key Features are available at this moment for threejs.

            threejs Examples and Code Snippets

            No Code Snippets are available at this moment for threejs.

            Community Discussions

            QUESTION

            fontloader and textgeometry not working in threejs
            Asked 2022-Mar-21 at 22:46

            I need to render some text in my threejs project, but every time I add the module

            ...

            ANSWER

            Answered 2022-Mar-21 at 12:37

            You have to use an import map with latest three.js releases. Besides, never import modules directly from https://threejs.org. Always use a CDN like below:

            Source https://stackoverflow.com/questions/71557495

            QUESTION

            Three.js ply loader - object not rendered properly
            Asked 2022-Mar-14 at 12:12

            I'm a beginner to three.js and I'm using Angular 13 with three.js v0.137.0. I'm trying to load and preview a ply file from a data URL. When the object is rendered, it is only showing like lines as in the screenshot. screenshot - how the ply file renders.

            I imported the .ply file that I'm trying to preview from the editor at https://threejs.org/editor and it loads the same .ply file perfectly. how the file renders in three.js editor

            What am I doing wrong here?

            ...

            ANSWER

            Answered 2022-Mar-14 at 12:10
            this.mesh = new THREE.Mesh(geometry, new THREE.PointsMaterial( { size: 0.01, vertexColors: true } ));
            

            Source https://stackoverflow.com/questions/71467209

            QUESTION

            ThreeJs Badly sees the coordination of the mouse through the canvas
            Asked 2022-Feb-22 at 09:34

            Structure of my project 66% threejs model, 44% html (side control) using Bootstrap. I’m trying to make mouse picker, when pointing at an object so that it is shown on which object it is pointed. As I understand it, he sees the coordination of the mouse badly. Please help me figure out and set up the correct coordination mouse with Canvas.

            Project Structure Screenshot:

            Code:

            ...

            ANSWER

            Answered 2022-Feb-22 at 09:34

            I suggest you use pointermove instead of mousemove and also use getBoundingClientRect() in your event listener:

            Source https://stackoverflow.com/questions/71218383

            QUESTION

            Why does placing more than 1 place marker on an planet object3D not work anymore?
            Asked 2022-Feb-17 at 11:25

            I have a piece of code from 3 years ago that appears to not be working anymore from Three.js.

            I have updated all of the other issues of the migration to ES6 for Three.js, but when I try to add as I did in the past more than 1 place marker on the planet surface, only 1 place marker is displayed, with only the last added place marker being successfully displayed in the desired position... with all other place markers being erased.

            Problem example -> https://jsfiddle.net/jhL6s579/6/

            Complete code:

            HTML

            ...

            ANSWER

            Answered 2022-Feb-17 at 11:25

            You have to derive your custom classes Marker and Earth in ES6 now. Meaning you have to use the class syntax like below since Object3D is now a class, too.

            Source https://stackoverflow.com/questions/71148754

            QUESTION

            Failed to resolve module specifier "three" - Working Three/Wordpress Integration Suddenly Failed
            Asked 2022-Feb-09 at 19:48

            I manage a WordPress website which uses a Three.js animation on the homepage. I built this site months ago and everything had been working perfectly fine - I even showed it to someone a week ago and nothing was amiss. Yesterday, I check the site and find that Three is not loading, and that I have this in the console:

            Uncaught TypeError: Failed to resolve module specifier "three". Relative references must start with either "/", "./", or "../".

            I don't have a line or even file to reference, the error is logged coming from the first line of the root domain. I want to emphasize that I had changed absolutely nothing about the set-up. I hadn't even updated to WP 5.9 yet. This is how I had originally set things up. Sorry if it's not best practices, but I want to emphasize that it did in fact work fine. Enqueuing animation javascript file and defining its type as "module":

            ...

            ANSWER

            Answered 2022-Feb-09 at 19:48

            I had exact same problem. I uploaded my project on Github a month ago (https://kramzin.github.io/threejs-task/) and since then didn't change a one symbol, but about a week ago it started showing same strange error in console. I found following: "Since r137 using ES6 modules like GLTFLoader in the browser requires an import map. Add the following section right below you canvas."

            Source https://stackoverflow.com/questions/70977276

            QUESTION

            Get 3D Position of shadow pixels in ThreeJS
            Asked 2022-Feb-01 at 02:31

            I have the following project below created using ThreeJS. You will notice the gold object creates a shadow behind it on a sphere where I'm only rendering the backside so we can see the objects inside. I'm using a point light in the very center of the eye model to create the shadow evenly in all directions. This is the reason the shadow is curved.

            I need to know how to get the 3D coordinates (x,y,z) of each pixel of this shadow that was created. For reference here is the code that creates the shadow with a lot removed for simplicity.

            ...

            ANSWER

            Answered 2022-Feb-01 at 02:31

            You can't extract the shadow into a new geometry because this is all calculated in the GPU shaders upon rendertime, so JavaScript doesn't really have access to the shadowMap positions. However, there is a solution.

            Assuming your point light is at (0, 0, 0), and it's at the center of the sphere, you could iterate through the vertices of the gold object and project these positions onto the sphere:

            Source https://stackoverflow.com/questions/70919871

            QUESTION

            BufferGeometryUtils.mergeVertices - seems not to merge all identical vertices in three.js
            Asked 2022-Jan-21 at 22:22

            I have a weird issues with BufferGeometryUtils.mergeVertices method

            I took a simple cube from a jsfiddle and performed the mergeVertices and it seems mergeVertices does not merge all identical vertices as it should. See https://jsfiddle.net/tomfree/vpdwmycn/

            E.g. the vertices given in the indexGeometry returned by mergeVertices are

            ...

            ANSWER

            Answered 2022-Jan-21 at 22:22

            The merge process is functioning as expected. If you look at the count of each attribute of the original geometry you'll get 36, but if you look at the count of each attribute of the merged indexedGeo, you'll get 24:

            Source https://stackoverflow.com/questions/70798874

            QUESTION

            How to blend text onto a texture in three.js?
            Asked 2022-Jan-19 at 13:00

            I want to add text to a can of beans. The example code uses render.copyTextureToTexture to blend textures together.

            However, when I try to use it doesn't do anything.

            When I tried to display textTexture on the cylinder it was fully transparent. Is the texture made before text is rendered in the first canvas?

            Or do I need to somehow wait until the image is loaded and only then use copyTextureToTexture to add the text?

            ...

            ANSWER

            Answered 2022-Jan-19 at 06:50

            You can modify a material to make it able to blend material's color with the text texture:

            Source https://stackoverflow.com/questions/70759788

            QUESTION

            THREE.JS & Reality Capture - Rotation issue photogrammetry reference camera's in a 3D space
            Asked 2022-Jan-03 at 14:57

            Thanks for taking the time to review my post. I hope that this post will not only yield results for myself but perhaps helps others too!

            Introduction

            Currently I am working on a project involving pointclouds generated with photogrammetry. It consists of photos combined with laser scans. The software used in making the pointcloud is Reality Capture. Besides the pointcloud export one can export "Internal/External camera parameters" providing the ability of retrieving photos that are used to make up a certain 3D point in the pointcloud. Reality Capture isn't that well documented online and I have also posted in their forum regarding camera variables, perhaps it can be of use in solving the issue at hand?

            Only a few variables listed in the camera parameters file are relevant (for now) in referencing camera positioning such as filename, x,y,alt for location, heading, pitch and roll as its rotation.

            Currently the generated pointcloud is loaded into the browser compatible THREE.JS viewer after which the camera parameters .csv file is loaded and for each known photo a 'PerspectiveCamera' is spawned with a green cube. An example is shown below:

            The challenge

            As a matter of fact you might already know what the issue might be based on the previous image (or the title of this post of course ;P) Just in case you might not have spotted it, the direction of the cameras is all wrong. Let me visualize it for you with shabby self-drawn vectors that rudimentary show in what direction it should be facing (Marked in red) and how it is currently vectored (green).

            Row 37, DJI_0176.jpg is the most right camera with a red reference line row 38 is 177 etc. The last picture (Row 48 is DJI_189.jpg) and corresponds with the most left image of the clustured images (as I didn't draw the other two camera references within the image above I did not include the others).

            When you copy the data below into an Excel sheet it should display correctly ^^

            ...

            ANSWER

            Answered 2022-Jan-02 at 22:26

            At first glance, I see three possibilities:

            • It's hard to see where the issue is without showing how you're using the createCamera() method. You could be swapping pitch with heading or something like that. In Three.js, heading is rotation around the Y-axis, pitch around X-axis, and roll around Z-axis.

            • Secondly, do you know in what order the heading, pitch, roll measurements were taken by your sensor? That will affect the way in which you initiate your THREE.Euler(xRad, yRad, zRad, 'XYZ'), since the order in which to apply rotations could also be 'YZX', 'ZXY', 'XZY', 'YXZ' or 'ZYX'.

            • Finally, you have to think "What does heading: 0 mean to the sensor?" It could mean different things between real-world and Three.js coordinate system. A camera with no rotation in Three.js is looking straight down towards -Z axis, but your sensor might have it pointing towards +Z, or +X, etc.

            Edit:

            I added a demo below, I think this is what you needed from the screenshots. Notice I multiplied pitch * -1 so the cameras "Look down", and added +180 to the heading so they're pointing in the right... heading.

            Source https://stackoverflow.com/questions/70380886

            QUESTION

            How to apply multiple shaders to one 3D object, using Three.js and WebGL
            Asked 2021-Dec-17 at 23:47

            I'm playing around with WebGL. The following is a working example with a 3D object using Three.js. Is it possible to add multiple shaders to one 3D object, like this one? It would be highly appreciated if you can share some knowledge.

            I just learned from one pro that helped with solutions to applying one shader material to 3D object. However, I'm curious about whether to add multiple shaders to give more effects to the 3D object.

            ...

            ANSWER

            Answered 2021-Dec-17 at 15:33

            In general, rendering a mesh with multiple materials is possible in three.js if the geometry defines proper groups data. However you normally render different parts of the mesh with distinct materials. E.g. when having a character model, you would render the skin with one material and the cloths with a different one.

            You don't want to use this approach to combine or stack effects. Instead, you have to implement a single custom shader that includes all effects that you want to apply on the surface.

            Source https://stackoverflow.com/questions/70394322

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install threejs

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/huanzi-qch/threejs.git

          • CLI

            gh repo clone huanzi-qch/threejs

          • sshUrl

            git@github.com:huanzi-qch/threejs.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link