Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specular color map? #7290

Open
Ben-Mack opened this issue Oct 4, 2015 · 24 comments
Open

Specular color map? #7290

Ben-Mack opened this issue Oct 4, 2015 · 24 comments

Comments

@Ben-Mack
Copy link

Ben-Mack commented Oct 4, 2015

Hi everyone.

Now the Specular map only controls the intensity of the specular highlights, it's will be great if we have Specular color map (http://wiki.polycount.com/wiki/Specular_color_map), one more step toward to the realistic material.

Specular Color Map

A texture that controls the intensity/color of the specular highlights from real-time lights.

Usually a specular map simply controls the brightness of the highlights, at a per-pixel level. If the shader supports RGB the specular map can be used to colorize specular highlights, useful for surfaces that have more complex reflective properties like metals, beetle shells, etc.

@WestLangley
Copy link
Collaborator

We can add this to MeshPhongMaterial -- if there is interest. There hasn't been demand for it so far.

For the upcoming MeshPhysicalMaterial, I prefer to go with a metal-ness model, which is simpler for the average user, and does not require a specular map.

@simonihmig
Copy link

👍

@WestLangley
Copy link
Collaborator

@simonihmig What are you up-voting? What is your use case?

@simonihmig
Copy link

If I got it right, I can only influence the specular color via the specular property, but that affects the whole object. I have a single object (a person coming from a 3D scanner, not constructed by a human) with quite different "materials" (skin, clothes, shiny shoes, watch etc.), implemented as a single phong material with large texture maps. I would like to specify parts of that single material object as having a shiny surface (possible now with a specularMap) but also with different specular colors.

@WestLangley
Copy link
Collaborator

You got it right.

What is called specularMap in MeshPhongMaterial should have been named reflectivityMap. It is a grayscale map.

@Mugen87
Copy link
Collaborator

Mugen87 commented Nov 7, 2019

I'd like to revive this feature request since we have with 3MF a practical use case where a specular color map would be useful. I suggest the following:

  • Rename specularMap to reflectivityMap for MeshBasicMaterial, MeshLambertMaterial and MeshPhongMaterial and use it to modulate reflectivity.
  • Introduce specularMap (with new semantics) for MeshPhongMaterial only and (if set) use it instead of MeshPhongMaterial.specular.
  • Besides, one would assume a specularMap is defined in sRGB color space whereas reflectivityMap is defined in linear color space.

@donmccurdy
Copy link
Collaborator

This is also one of the proposals of #16977. For that purpose, I think we'd want it on MeshPhysicalMaterial.

@mrdoob
Copy link
Owner

mrdoob commented Nov 20, 2019

@Mugen87 that sounds good, but I think I would wait to see what GLTF decide first.

@Mugen87
Copy link
Collaborator

Mugen87 commented Nov 20, 2019

Oh, I was not aware that this topic is also discussed in the glTF space. But yeah, keep specularMap align with glTF sounds good 👍

@donmccurdy
Copy link
Collaborator

donmccurdy commented May 18, 2020

The glTF working group is nearly decided on KHR_materials_specular now, which would involve...

  • specularColorTexture (RGB)
  • specularTexture (A)

... along with scalar factors for each. Feedback (or PRs! 😇) would be welcome.

@donmccurdy
Copy link
Collaborator

Implemented in #22156.

@Mugen87
Copy link
Collaborator

Mugen87 commented Mar 1, 2022

AFAICS, This issue was also about refactoring specular map in other materials like MeshPhongMaterial (see #7290 (comment)). I would keep this issue open if there is still the intention to fix this.

@WestLangley
Copy link
Collaborator

Rather than enhancing MeshPhongMaterial, I would suggest we consider removing it -- unless there is evidence MeshStandardMaterial is measurably less performant for similar argument settings.

In any event, I would keep this post open in the mean time.

@Mugen87
Copy link
Collaborator

Mugen87 commented Mar 1, 2022

I would prefer not to discuss the removal of materials in this issue. Open issues are:

  • Rename specularMap to reflectivityMap for MeshBasicMaterial, MeshLambertMaterial and MeshPhongMaterial and use it to modulate reflectivity.
  • Introduce specularMap (with new semantics) for MeshPhongMaterial only and (if set) use it instead of MeshPhongMaterial.specular.

@Mugen87 Mugen87 reopened this Mar 1, 2022
@WestLangley
Copy link
Collaborator

@WestLangley said:

From #9339 (comment)

Regarding an RGB.specularMap, I now see little benefit to adding this. Such a feature may be useful in modeling metals, but MeshPhongMaterial does not do a good job of representing metals, anyway. MeshStandardMaterial, on the other hand, does. Consequently, I have abandoned adding an RGB .specularMap to MeshPhongMaterial.

My recommendation at this point is to leave MeshPhongMaterial as-is. Sophisticated users can use MeshStandardMaterial.

From #9339 (comment)

Note, we use the property .specularMap elsewhere. An RGB .specularMap is used in the glTF Specular-Glossiness extension, where it modulates .specular, the specular reflectance of the material.

From #9339 (comment)

I still would be in favor of renaming the current grayscale .specularMap to .reflectivityMap, as it modulates the .reflectivity property in the MeshBasic/Lambert/Phong materials.

//

But I would not waste time on any of this without discussing the removal of MeshPhongMaterial first. MeshStandardMaterial is far superior -- except maybe in performance.

@donmccurdy
Copy link
Collaborator

donmccurdy commented Mar 1, 2022

I think it's true that when users choose MeshPhongMaterial or MeshLambertMaterial, it's often for the improved performance — not because they prefer these older shading models. If we could offer a shading model that approximates Standard (and has a similar parameterization) with cost similar to Phong or Lambert, that would be valuable, and would make it much easier to adapt content to different devices.

Related:

Whether the parameterization of MeshPhongMaterial should be changed if it is kept, I don't know. I am wondering why MeshBasicMaterial has a specular property at all. 🤔

@WestLangley
Copy link
Collaborator

@donmccurdy Are you aware of any studies quantifying the performance of Phong vs. Standard?

@donmccurdy
Copy link
Collaborator

Lots of anecdotes but no studies, sorry! 😐

@WestLangley
Copy link
Collaborator

Hmm... We don't want to begin with a false premise. Note that the shaders share significant code.

@donmccurdy
Copy link
Collaborator

Another related issue:

@NoriyukiIchijo
Copy link

Regarding this, the condition in writeMaterial of GLTFMaterialsSpecularExtension may be wrong.
if (!material.isMeshPhysicalMaterial || (material.specularIntensity === 1.0 && material.specularColor.equals(DEFAULT_SPECULAR_COLOR) && !material.specularIntensityMap && !material.specularColorTexture)) return;
Does the last one mean !material.specularColorMap since I couldn't find such property in MeshPhysicalMaterial?
And I'll be glad if we have more uvs in nameConversion like
uv2: 'TEXCOORD_2', uv3: 'TEXCOORD_3', ...

@WestLangley
Copy link
Collaborator

Does the last one mean ! material.specularColorMap

/ping @elalish

@elalish
Copy link
Contributor

elalish commented Nov 6, 2023

Probably? Did I write that?

@WestLangley
Copy link
Collaborator

@elalish It appears you did. #25335

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants