BabylonJS / Babylon.js

Babylon.js is a powerful, beautiful, simple, and open game and rendering engine packed into a friendly JavaScript framework.
http://www.babylonjs.com
Apache License 2.0
23.33k stars 3.44k forks source link

Add support for Secondary Normal Map / Detail Normal Map #5967

Closed GreyWorks closed 4 years ago

GreyWorks commented 5 years ago

Feature request as requested in the forum discussion.

Quote from the Unity documentation

Secondary Maps (or Detail maps) allow you to overlay a second set of textures on top of the main textures listed above. You can apply a second Albedo colour map, and a second Normal map. Typically, these would be mapped on a much smaller scale repeated many times across the object’s surface, compared with the main Albedo and Detail maps.

The reason for this is to allow the material to have sharp detail when viewed up close, while also having a normal level of detail when viewed from further away, without having to use a single extremely high texture map to achieve both goals.

Typical uses for detail textures would be: - Adding skin detail, such as pores and hairs, to a character’s skin - Adding tiny cracks and lichen growth to a brick wall - adding small scratches and scuffs to a large metal container

As mentioned by PatrickRyan in the forum discussion this might be a feature for 4.1. Thank you for looking into it.

GreyWorks commented 5 years ago

I finally came up with a method to do it! https://github.com/GreyWorks/Babylonjs-tests/tree/custom-pbr-material

I also made a post in the original thread about it https://forum.babylonjs.com/t/secondary-maps-detail-maps-detail-normal-possible/1449/9

Sadly I don't have the time to fully flesh it out and make a pull request out of it.

deltakosh commented 5 years ago

Well we should be able to do it for 4.2 :) (or 4.1 if we have time cc @sebavan)

Pryme8 commented 4 years ago

This sounds interesting, is anyone on it from @GreyWorks example?

GreyWorks commented 4 years ago

I still work with the code mentioned above. We use it for a project at work with other extensions but basically it is still the same thing. But we know the constraints of the project so the lack of completeness is not that problematic. Sadly I don't have the time to dig deep enough to make the rest reasonably consistent.

Pryme8 commented 4 years ago

but it's "working" right? I am about to do a deployment of this one and start rooting around if you don't feel like I am stepping on your toes.

I have a client who needs this kind of behavior and even if I do a custom deploy with it, Ill be happy to of saved the time.

GreyWorks commented 4 years ago

Sure thing! Feel free to do so. It works fine within the constraints mentioned on the forum post. It would be really great if more people could use it 😃