Wireframe color with flatShading on?

materials

#1

new THREE.MeshPhongMaterial( { side: 2 flatShading: 1, wireframe: !1 } );

The result is always black. Any solution besides turning off flat shading?


#2

Don’t you need to set the color property?


#3

It’s white by default.

The most confusing part in that broadwide piece of code is this:
{ side: 2 flatShading: 1, wireframe: !1 },
shouldn’t there be a comma between 2 and flatShading?

It would be better to provide a live code example, but who cares about it, when users of the forum have telepathic abilities and can re-create a scene just provided with one line of code!


#5

@ prisoner849, Yes there should be a comma. ( bad eyes )

You don’t need to use your super-human abilities to see the problem. So far, MeshBasicMaterial is the only shader that behaves as expected.

Set Material to:
new THREE.MeshPhongMaterial( { side: 2, flatShading: 1} );
Dynamically toggle wireframe.
Look at the color of wireframe.

v.99


#6

Is it a problem to provide a working example with jsfiddle, codepen etc.? :slight_smile:
I can wait for one, as the question seems not so urgent.


#7

@ prisoner849, Never used them. But can provide attachment with working codes.
Don’t worry about it. Seems to be a minor case of hiccup.
Any luck with vertex color interpolation ?


#8

Just for clarification: I’m asking for a working example not because I want to have it for an unknown reason :slight_smile:
Providing such an example, you give people as much information as possible thus there will be no such minor quesions like if you have a light source in yoru scene, its position and so on, and you can get help quicker :beers:

This is off of this thread, but for now I’m out of ideas about interpolation, though I’m still thinking on it :slight_smile:


#9

Live demo: https://jsfiddle.net/pe3owrvx/

I’m unable to reproduce the issue.


#10

@Mugen87, Buttons work like on/off switch. Click on the same button again to toggle flatshading effect.

**Source Code: ** WF_.html (118.4 KB)


#12

Now I see what you mean. It’s just necessary to increase the complexity of the geometry a bit:

https://jsfiddle.net/oskmgdca/

After debugging it seems that the combination of both parameters is not supported. In general, it makes no sense to turn on flat shading when rendering a mesh as a wireframe. So I don’t think it’s worth the effort to prevent this in some way within the library.