encima / jsc3d

Automatically exported from code.google.com/p/jsc3d
0 stars 0 forks source link

color from .obj file #13

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
I  try to load a simple .obj file with simple color information
2.
3.

What is the expected output? What do you see instead?

i'd like to see a objetc with color. Instead i see no color in object

What version of the product are you using? On what operating system?
i use latest version with windows 7 in chrome o IE9

Please provide any additional information below.

I'd like to Know if there's the possibility to read color information by .obj 
file ( not Texture) or if is there a possibility to color an object with a 
uniform color in someway by a command.

Original issue reported on code.google.com by mariopon...@yahoo.it on 6 Dec 2012 at 9:09

Attachments:

GoogleCodeExporter commented 9 years ago
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 Humu2...@gmail.com on 7 Dec 2012 at 3:47

GoogleCodeExporter commented 9 years ago
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 mariopon...@yahoo.it on 7 Dec 2012 at 7:55

GoogleCodeExporter commented 9 years ago
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 Humu2...@gmail.com on 7 Dec 2012 at 3:28