Coder Social home page Coder Social logo

color from .obj file about jsc3d HOT 3 OPEN

humu2009 avatar humu2009 commented on May 27, 2024
color from .obj file

from jsc3d.

Comments (3)

GoogleCodeExporter avatar GoogleCodeExporter commented on May 27, 2024
Per-vertex color is not a standard part of obj's vertex definition. 

To apply a uniform color to a whole model can be done by 3 means:

1. Attach an mtl file to the obj file which defines the material of the model.

2. Construct an instance of JSC3D.Material and set it to the model mesh 
manually.

3. The most convenient way is to specify a default color using JSC3D.Viewer's 
setParameter() method in initialization. Then this color will be applied to all 
meshes inside a scene which do not have a material:

  // in initialization part
  ...
  // specify the default color
  viewer.setParameter('ModelColor', '#CAA618');
  // set other parameters
  ...
  viewer.init();
  viewer.update();

That's it.

Original comment by [email protected] on 7 Dec 2012 at 3:47

from jsc3d.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 27, 2024
I've anderstood, thanks.
On the contrary if i want different colors for different Vertex shall i  only 
use texture or may i do it by a .mtl file or any other technique?

Original comment by [email protected] on 7 Dec 2012 at 7:55

from jsc3d.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 27, 2024
It is recommended to use a texture when available.  For an obj model file, 
textures are defined in one or several attaching mtl files. 

Original comment by [email protected] on 7 Dec 2012 at 3:28

from jsc3d.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.