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

White background? #8

Open
ahmedghazi opened this issue Apr 18, 2019 · 8 comments
Open

White background? #8

ahmedghazi opened this issue Apr 18, 2019 · 8 comments

Comments

@ahmedghazi
Copy link

There is white background on your example. Why?

@frontendjorge
Copy link

how to change the background?

@spider58
Copy link

how to change the background?

yes how to ?

@c-plus-plus-equals-c-plus-one

You can pass a property "background" to model. For example <OBJModel {...props} background="rgba(0,0,0)" />

@ahmedghazi
Copy link
Author

rgba doesn't work cause three needs another param to set alpha: true

@dannicsitnikov
Copy link

dannicsitnikov commented Sep 12, 2022

Add support pls for transparent background

@ahmedghazi
Copy link
Author

Gotta bundle the scripts outside of node modules and into my project in order to pass a param to set alpha true.
Would love to have these props:
background="rgba(0,0,0,0)" alpha={true}
And
In model.js Line 242 : this.renderer.setClearColor(new THREE.Color(background, alpha));

@ahmedghazi
Copy link
Author

the alpha must be set en the WebGLRenderer instance in conjunction with the setClearColor() function:

So it should look like this
const { width, height, antialias, background, alpha } = this.props; this.renderer = new THREE.WebGLRenderer({ antialias, alpha: alpha }); this.renderer.setClearColor(background, 0);

@AHTARazzak
Copy link

AHTARazzak commented Aug 22, 2023

the alpha must be set en the WebGLRenderer instance in conjunction with the setClearColor() function:

So it should look like this const { width, height, antialias, background, alpha } = this.props; this.renderer = new THREE.WebGLRenderer({ antialias, alpha: alpha }); this.renderer.setClearColor(background, 0);

Hey, I'm racking my brains trying to get this to work
I'm bundling the code outside of the node modules, looks like:

var { width, height, antialias, background, alpha } = this.props;
this.scene = new THREE.Scene();
    this.camera = new THREE.PerspectiveCamera(45,width/height,.1,8888);
    this.renderer = new THREE.WebGLRenderer({antialias, alpha: alpha});

	  this.renderer.setClearColor(background, 0);
    this.renderer.setSize(width,height);

I haven't added any new code, just modified the existing- any advice would be rad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants