Author Topic: setVertexOptimization  (Read 2564 times)

Offline msp-1

  • byte
  • *
  • Posts: 7
    • View Profile
setVertexOptimization
« on: June 27, 2011, 05:27:24 pm »
Hello,
I have a question about setVertexOptimization.


This cube is separated into 6 faces in blender.
I tried to load this cube without vertexoptimization. (setVertexOptimization(false))

In my expectation, it become like a FLAT SHADING.
Which has sharp edges.
But shading result is not.
(Maybe shading result is not change by using vertexoptimization.)

How should I use setVertexOptimization?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: setVertexOptimization
« Reply #1 on: June 27, 2011, 09:01:42 pm »
This setting has no influence on normal generation, because that's solely based on vertex positions in object space, not if they are shared or not. However, if you need different normals and vertices are not shared, you can tweak them afterwards by using the PolygonManager. If all you need is flat shading, you can try to call Object3D.setShadingMode(...).

Offline msp-1

  • byte
  • *
  • Posts: 7
    • View Profile
Re: setVertexOptimization
« Reply #2 on: June 28, 2011, 04:56:12 pm »
Thank you for your quick response!

I tried to use setShadingMode();
It's also very useful function.
But I want to make a object which has flat and smooth both type faces.
Then, next I want to try PolygonManager.

Should I use getTransformedNormal() function?
Could you tell me a example of using PolygonManager?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: setVertexOptimization
« Reply #3 on: June 28, 2011, 09:48:20 pm »
My bad...i didn't mean the PolygonManager but an implementation of the IVertexController to tweak the normals. You can simply extend the GenericVertexController and set new normals with that.