Help needed about rendering a 3D model?

Anything libgdx related goes here!

Help needed about rendering a 3D model?

Postby deeplien » Sat Jan 11, 2020 8:38 pm

Hi guys, noob that needs some help here. I'm building an android application that renders a brain 3D model. What I intend to do is give different colors to different regions of the 3D model. Could anyone help me about how I could achieve this?
deeplien
 
Posts: 5
Joined: Sat Jan 11, 2020 8:29 pm

Re: Help needed about rendering a 3D model?

Postby shatterblast » Sat Jan 11, 2020 9:29 pm

I think the following code will work.
Code: Select all
ModelBatch modelBatch = new ModelBatch();
ObjLoader loader = new ObjLoader();
Model model = loader.loadModel( Gdx.files.internal( "3d_model.obj") );
model.getMaterial(0).set( ColorAttribute.createDiffuse( Color.RED ) );
ModelInstance = new ModelInstance( model );


Link 1) has the reference answer. Link 4) has a guide that may help.

1) https://stackoverflow.com/questions/192 ... oesnt-work
2) https://libgdx.badlogicgames.com/ci/nig ... tance.html
3) https://libgdx.badlogicgames.com/ci/nig ... ibute.html
4) https://xoppa.github.io/blog/basic-3d-using-libgdx/
shatterblast
 
Posts: 653
Joined: Sun Jul 06, 2014 1:14 pm

Re: Help needed about rendering a 3D model?

Postby deeplien » Sun Jan 12, 2020 12:03 pm

shatterblast wrote:I think the following code will work.
Code: Select all
ModelBatch modelBatch = new ModelBatch();
ObjLoader loader = new ObjLoader();
Model model = loader.loadModel( Gdx.files.internal( "3d_model.obj") );
model.getMaterial(0).set( ColorAttribute.createDiffuse( Color.RED ) );
ModelInstance = new ModelInstance( model );


Link 1) has the reference answer. Link 4) has a guide that may help.

1) https://stackoverflow.com/questions/192 ... oesnt-work
2) https://libgdx.badlogicgames.com/ci/nig ... tance.html
3) https://libgdx.badlogicgames.com/ci/nig ... ibute.html
4) https://xoppa.github.io/blog/basic-3d-using-libgdx/


Thanks man. But do you have any idea how can I separate the 3D model into different regions with different colors?
deeplien
 
Posts: 5
Joined: Sat Jan 11, 2020 8:29 pm

Re: Help needed about rendering a 3D model?

Postby shatterblast » Mon Jan 13, 2020 5:45 am

You will need to break up the model yourself in your 3D editing software of choice.
shatterblast
 
Posts: 653
Joined: Sun Jul 06, 2014 1:14 pm

Re: Help needed about rendering a 3D model?

Postby deeplien » Mon Jan 13, 2020 10:40 pm

shatterblast wrote:You will need to break up the model yourself in your 3D editing software of choice.

Thank you for your help
deeplien
 
Posts: 5
Joined: Sat Jan 11, 2020 8:29 pm

Re: Help needed about rendering a 3D model?

Postby shatterblast » Mon Jan 13, 2020 11:43 pm

You are welcome.
shatterblast
 
Posts: 653
Joined: Sun Jul 06, 2014 1:14 pm


Return to Libgdx

Who is online

Users browsing this forum: No registered users and 1 guest