Jump to content

Three.js Depth problem


Recommended Posts

Has anybody any idea about what I'm doing wrong?


I'm using Cannon.js and the positions of the elements seem correctly placed, but the rendering order is false.


In the attached Image, the number 4 should be rendered before than 2 and 3.




//Creates the renderer            this.renderer = new THREE.WebGLRenderer();            this.renderer.setClearColor(0xff00ff);            if (window.devicePixelRatio) {                this.renderer.setPixelRatio(window.devicePixelRatio);            }            this.renderer.setSize(this.width, this.height);                        this.$wrapper.append(this.renderer.domElement);

Textures (I also tried with another kind of materials and the result was the same):




this.ballTexture = THREE.ImageUtils.loadTexture(this.path + "ball.jpg");            this.ballGeometry = new THREE.SphereGeometry(0.11, 32, 32);            this.ballMaterial = new THREE.MeshPhongMaterial({                map: this.ballTexture,                bumpMap: this.ballTexture,                bumpScale: 0.01            });            var ball = new THREE.Mesh(this.ballGeometry, this.ballMaterial);            this.scene.add(ball);


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...