ObjLoader | An obj file loader for WebGL , including .mtl loder | Graphics library
kandi X-RAY | ObjLoader Summary
kandi X-RAY | ObjLoader Summary
An obj file loader for WebGL, including .mtl loder
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ObjLoader
ObjLoader Key Features
ObjLoader Examples and Code Snippets
Community Discussions
Trending Discussions on ObjLoader
QUESTION
I'm using OBJLoader to load an OBJ file into my scene.
For whatever reason the vertex ordering seems to be out of whack.
Here is a pic of my model in blender:
And here is a pic of my model in three:
I've seen similar effects before with models and it's always been due to vertex ordering so I make the assumption something is going wrong there.
EDIT By the way, notice the triangles crossing over the letters where in Blender there are none. I believe there may be an offset in the vertex count introduced somewhere.. maybe.
The code:
...ANSWER
Answered 2021-Jun-09 at 02:25By default, Three.js only renders the front face of triangles. It looks like some of your faces are inverted. Make sure you calculate normals in your 3D editor so they're pointing "outwards". That way, when you export them the engine will know which way the triangles should be facing.
Also, Three.js doesn't render n-gons, and it looks like your letters have lots of them. Look at the 'U', it's one flat plane. Make sure you convert to triangles before exporting. Or at least convert to quads, so the exporter can easily subdivide them into tris.
QUESTION
So this problem might sound a little odd, let me explain. I am using the Roblox API to get the OBJ file, the MTL file and the Texture file. So the base api with the info is this https://t2.rbxcdn.com/ef63c826300347dde39b499e56bc874b
and from that you get two important urls the obj file https://t4.rbxcdn.com/4844b24bb4b6696ccbafda0c79d2c406
and the mtl file https://t1.rbxcdn.com/58f8c8dfcad7ad36d17e1773a698223e
, the problem is the MTL file is loaded from the subdomain t1
, whereas the texture is loaded from https://t0.rbxcdn.com/21e00b04dc20ddc07659af859d4c1eaa
with the subdomain t0
. Now here is where it gets tricky:
Here is the ThreeJs obj loader:
...ANSWER
Answered 2021-Jun-05 at 17:04Hi so I solved this and I am going to leave this here for anyone else who needs it. THIS IS A REALLY HACKY ANSWER. So I went into the MTL loader and found,
QUESTION
I just removed the CDN link to threejs in my html and instead imported threejs using npm. I'm using webpack to compile everything. However, although there are no error messages when compiling, my webapp breaks and returns an error that THREE is not defined. Here are the import statements I'm using:
...ANSWER
Answered 2021-May-20 at 19:38Try it with these imports:
QUESTION
On loading the MTL file, the entire model is turning black. I have referred to this link and set the rbg parameters to 1 but that hasnt solved my issue.
three.js mtl loader renders black
Here is the code associated with it:
...ANSWER
Answered 2021-May-17 at 13:12The MTL loads the texture as a TIFF image which can't be used as an image data source. Use JPG or PNG instead.
Sidenote: You will notice that the object's material has a texture assigned to the map
property but with an undefined
image
value. In such a case, the texture appears black.
QUESTION
smile on shirt has black background
GOAL: I would like users to be able to add images/colors with buttons
PROBLEM: but the png image texture(smiley face) loaded with textureLoader() has black background and lines crossing the image. :frowning:
MINOR PROBLEM:
(1) Are there any ways to match the background color of the image and the obj/gltf(shirt) that I load?
Here are my codes.
...ANSWER
Answered 2021-May-11 at 01:27You need the transparent: true
setting when creating your material, like so:
QUESTION
I'm really confused about the way vue and THREE.js work together. I am using the exact same obj, once in a plain js environment - where it works perfectly fine - and once in vue.js, where the canvas stays empty and the dev console shows several warnings.
The code I used in js is the exact same as in vue (see below). I also attached a screenshot of the warnings I get in the developer tool from chrome.
I assume the problem is related to the path to the OBJ since some unexpected lines are clearly out of a HTML file. I also tried various alternatives like "./assets/threeD/harrie.obj"
or using let ha = require("../assets/threeD/harrie.obj");
, however the latter causes a compilation error as below:
ANSWER
Answered 2021-Mar-18 at 08:00in vue apps, your code will be compiled by webpack before running. the root of your app will usually be /dist/index.html
, so the url you provided will not be a valid one, which cause the server return a html page, hence the error message in your screenshot.
to properly point to the model, you should first import the model:
QUESTION
my problem is that i have buttons : "view" button that enable OrbitControls , "move" button that disable OrbitControls so i can use DragControls, "cube" button that add a cube (or many cubes) to the scene and everything works fine, but when i added a "remove" button so i can remove the cube, it didnt work it says that the cube is not defined. So what should i do ? `
...ANSWER
Answered 2021-Mar-06 at 16:44You have to declare your cube
variable outside of createCube()
. It's then in a scope that can be accessed by removeCube()
.
QUESTION
I have a problem that when I use DragControls on an object like cubes or cylinders or spheres it works: I can drag these objects but when I use it on loaded objects with OBJLoader it doesn't work I cant drag them PS : I’m using OrbitContols also and it works fine with Geometry objects but not with loaded objects.
...ANSWER
Answered 2021-Mar-03 at 15:44objects.push( object );
The problem is that the OBJ loader does not return an instance of THREE.Mesh
but THREE.Group
. You have to traverse through the group and add all meshes individually to the objects
array. So
QUESTION
I am creating a 3D game using LWJGL3
, and I want the window loaded in the background and hidden, wait for my game setup and only than showing up.
My problem is even if I call GLFW.glfwHideWindow(window)
immidetly after GLFW.glfwCreateWindow(width, height, title, isFullscreen ? GLFW.glfwGetPrimaryMonitor() : 0, 0);
the window flickering, than load the game and than showing up (when I want).
How to prevent the window from flickering? Maybe I just change one of the arguments in GLFW.glfwCreateWindow
?
My code: Window class:
...ANSWER
Answered 2021-Feb-21 at 08:11Create a hidden window. See GLFW - Window visibility. Set the GLFW_VISIBLE
property before creating the window
QUESTION
I'm trying to load and color a sample file from the THREE.js GIT called "WaltHead.obj" located here:
https://github.com/mrdoob/three.js/blob/dev/examples/models/obj/walt/WaltHead.obj
I'm able to load it into my project, but when I try to paint it with gradient colors using code that has already worked 100% for me with GLTF/GLB models - it doesn't work with this ".obj" file.
I made a fiddle to make life easier - but for some reason the model isn't loading into the fiddle file:
https://jsfiddle.net/gilomer88/tp2hkxne/27/
Hopefully someone can fix it so it loads?
Either way, like I said, I'm trying to color it with gradients - but it's showing up totally black. The code is in the fiddle, and also here:
...ANSWER
Answered 2021-Feb-13 at 05:11Your c.lerpColors()
implementation is wrong. You're trying to pass a string into that method ("orange", "white")
, which it won't recognize and return NaN
.
That method is expecting two THREE.Color
objects, so you should initialize those first:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ObjLoader
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page