Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

three.js development! #4320

Closed
nidiy opened this issue Sep 21, 2017 · 10 comments
Closed

three.js development! #4320

nidiy opened this issue Sep 21, 2017 · 10 comments

Comments

@nidiy
Copy link

nidiy commented Sep 21, 2017

Hello, how can i combine with three.js development?

@ivanpopelyshev
Copy link
Collaborator

ivanpopelyshev commented Sep 21, 2017

@GoodBoyDigital had a plugin for it. There were also two or three different experiments independent from @GoodBoyDigital 's

@simplygreatwork
Copy link

Some tools and libraries are often used because they're popular. I use Pixi.js because it's the best 2D engine in town. So I feel compelled to add that XeoGL exists as a 3D environment for JavaScript and WebGL - as an alternative to ThreeJS. It all depends on what you need to do. But I consider XeoGL to be a "gem" as I do Pixi.

@nidiy
Copy link
Author

nidiy commented Sep 24, 2017

I will pixi.js share a canvas and context with three.js but only three.js will show that the code is shown below.
I would like to use pixi.js to achieve 3D games ui, I do not know what a good way?

` var app = new PIXI.Application(800, 600, {backgroundColor : 0x1099bb});
document.body.appendChild(app.view);
// create a new Sprite from an image path
var bunny = PIXI.Sprite.fromImage('asset/textures/colors.png')
// center the sprite's anchor point
bunny.anchor.set(0.5);

// move the sprite to the center of the screen
bunny.x = app.renderer.width / 2;
bunny.y = app.renderer.height / 2;

app.stage.addChild(bunny);

// Listen for animate update
// some 3js shit
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera(75, 800 / 600, 1, 10000);
camera.position.z = 1000;
var mesh = new THREE.Mesh(new THREE.BoxGeometry(200, 200, 200), new THREE.MeshBasicMaterial({ color: 0xff0000, wireframe: true }));
scene.add(mesh);

var renderer3d = new THREE.WebGLRenderer({ canvas: app.view, context: app.renderer.gl,premultipliedAlpha:true });
renderer3d.autoClear = true;
// start animating
animate();
function animate() {
    requestAnimationFrame(animate);
    // just for fun, let's rotate mr rabbit a little
    bunny.rotation += 0.1;
    app.renderer.currentRenderer.start();
    app.render(app.stage);
    app.renderer.currentRenderer.stop();
    // ...
    mesh.rotation.y += 0.01;
    renderer3d.render(scene, camera);
}`

image

@ivanpopelyshev
Copy link
Collaborator

It doesn't work like that. please search for special pixi webgl code that works, it was on forums, and here, and even in gitter. @GoodBoyDigital certainly had it somewhere.

@ivanpopelyshev
Copy link
Collaborator

Found it: #3230

@nidiy
Copy link
Author

nidiy commented Sep 25, 2017

Thank you for your suggestion, but I downloaded the Pixi_three.zip instance of GoodBoyDigital and could not. Run pixi_three.html without any show?

@ivanpopelyshev
Copy link
Collaborator

ivanpopelyshev commented Oct 3, 2017

#4344 We actually have a bug with reset :) That PR has working pixi+three demo https://jsfiddle.net/xyL1sv02/2/

@ivanpopelyshev
Copy link
Collaborator

ivanpopelyshev commented Oct 5, 2017

One more thing. This one helps to render threejs into texture:

https://jsfiddle.net/c34p532r/24/

renderer3D.state.reset();
renderer3D.setRenderTarget(null); //<--framebuffer reset!
renderer3D.render(scene, camera, renderTarget);

@nidiy
Copy link
Author

nidiy commented Oct 9, 2017

@ivanpopelyshev thank you very much for your help!

@nidiy nidiy closed this as completed Oct 10, 2017
@lock
Copy link

lock bot commented Feb 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Feb 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants