-
-
Notifications
You must be signed in to change notification settings - Fork 35.3k
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
[Feature request] Normal map in object space #14139
Comments
Can you please explain your use case -- and need for this feature -- in more detail? |
Yes, Object-space normal map is especially helpful in resolving normal map's seams problems on mesh with non-tilling normal map like game character or 3D scan model. Beside seams, Object-space normal map handle culvatures better, avoid smoothing problems from the low-poly vertex normals. Please take a look at this post where the use case and pros/cons is explained very details: KhronosGroup/glTF#1284 Cryengine doc also have section called Quoted from a comment in BlenderArtists Tangent vs Object Space vs World Space
|
Thanks for your answer, I will illustrate my need by an example. |
Object space normal maps are moderately common in 3D. It would be a useful feature for sure. |
I thInk those are compelling arguments. I have this working on my fork. I'll file a PR soon. |
Proposed API for object-space normal map support: material.normalMap = myNormalMap;
material.objectSpaceNormalMap = true; // default false, implies a tangent-space normal map Or material.normalMap = myNormalMap;
material.normalMapType = THREE.ObjectSpaceNormalMapType; // default THREE.TangentSpaceNormalMapType I prefer the second one, even though there are only two options in this case. Other options, material.normalMapType = THREE.ObjectSpaceType; // default THREE.TangentSpaceType material.normalMapType = THREE.ObjectSpaceNormalMap; // default THREE.TangentSpaceNormalMap /ping @mrdoob |
Thanks for your propose. |
@WestLangley I think the names should be:
The reason is that there are other spaces that could be useful for specification elsewhere and then we do not have to have duplicate constants. Other spaces I can think of are:
Most of these spaces are basically just matrix selection, except for screen space which includes a perspective transform. I do not think these should be implemented now, but if we follow this naming convention, we could. I think that having space specifiers is sort of cool. I am sure there are at least a couple more than I am missing. |
To clarify, I assume you are suggesting a different property name, too: material.normalMap = myNormalMap;
material.normalMapSpace = THREE.ObjectSpace; // default THREE.TangentSpace
I am not sure I see a use case for the others space types... |
@Ben-Mack Is there an public-domain model we can use in an example? |
@WestLangley I haven't found one, but you can generate it easily in xNormal by uncheck |
Often you want to apply a offset to an object and you want to specify in which space that offset is done: ViewSpace, ObjectSpace (local space) or WorldSpace. Or if you want to rotate an object, you may want to specify the coordinate system. Basically these spaces can be used to show a transform widget in a specific coordinate system on an object and then you move it there. There is already some of this in the ThreeJS editor as well as the Clara.io editor. (In the ThreeJS editor remember there is a [ ] local check box that is switching between THREE.WorldSpace and THREE.ObjectSpace for the manipulators.) Also I like being able to ask a node in the scene graph to give its its matrix in any of these spaces. If you have this type of accessor on the scene graph, implementing manipulators that are flexible in which coordiante system they use becomes easy.
This is a very useful generalization that other engines do. |
@Ben-Mack can you create a simple example for @WestLangley ? It would be helpful as you know how to use xNormal. |
@WestLangley I've attached zip file with object space normal map, diffuse map and OBJ file based on Ten24 Sample Scan |
Thanks for the model. |
@mlimper Is your glTF Nefertiti model with the two normal maps available in the public domain for use as a three.js example? It is reasonably-sized, which is a plus. |
I'll figure this out with the respective people who scanned the asset, will come back shortly Happy to see object-space normals in Three.JS! :-) |
You can use the model under creative commons for non-commercial purposes (CC BY-NC), please acknowledge the lab that digitized it like this:
Would be cool to see this as a three.js example! |
@mlimper Thank you! @mrdoob We can create a separate object-space normal example using the Nefertiti model, or alternatively, we can use the model and its OS-normal map as part of the glTF example. Which would you prefer? |
OS normal maps are technically not "valid" glTF yet, even though it's certainly possible to make examples like this. So ideally this should be separate from the glTF examples for now. ^I'd also be OK with a note:
|
Description of the feature
Object space is the local 3D space of the object. Up is always up and left is always left. It is a uniform space that you understand really well because that is what the world is really like. Tangent space, on the other hand, is best thought of as surface space. In tangent space, up is always away from the surface (in other words, along the normal).
Apparently, Three.js only supports tangent space for normal space textures, so it will be very fun to supports object space too.
The text was updated successfully, but these errors were encountered: