-
-
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
displacementMap ignoring offset #7826
Comments
Displacement maps are normally closely-coupled to the geometry, so The problem with supporting When
#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )
vUv = uv * offsetRepeat.zw + offsetRepeat.xy;
#endif
#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
vUv2 = uv2;
#endif /ping @bhouston |
It's issues like this that shows the benefits of |
I think the next issue is getting NodeMaterial into the core of ThreeJS as well as adding the ability to load and save it. But generally I think NodeMaterial addresses nearly every flexibility issue people have with materials -- with the exception of multi-layered materails (that still needs to be added.) |
@mrdoob @bhouston Apart from waiting for One thing that this post makes clear is we have 3 uv sets:
Thinking outside the box... One thing we could do is remove uv2, and replace it with uv. That would make things simpler, and would still allow for the original uvs and the offset-repeat-modified uvs. We would then require only one set of uvs, and simply say that |
I believe NodeMaterial is now merged :) Clara.io supports any number of UV sets and it supports offset/repeat per texture as well - and this is how I feel it should be in Three.JS as well, and with NodeMaterial it can be. DisplacementMap can be tied to the diffuse texture at least in high end cases, both ray tracing rendering and game engines. It is only on the low end with WebGL 1.0 that it seems to be tied completely to the geometry. Normally one can shift it around easily and get good results because one has render-time adaptive tessellation. |
I think that uv and uv2 are both required for things like floors and other types of repeating texture objects that require light maps. This allows for the light maps to be low resolution which the texture itself is high detail -- this is usually the case that baked global illumination representing light maps contain low frequency details. |
@bhouston OK. I am trying to understand which you prefer; for
|
I'd go with #2 as OP suggests. Essentially #2 is a super set of #1 with just more flexibility. Often displacement maps follow the diffuse texture, so this makes sense. In Clara.io's custom branch of Three.JS I read a unique offset/repeat for nearly every single map, rather than having a global shared one -- this is a future direction I would suggest but can be easily handled by NodeMaterial. I do suggest that NodeMaterial be the primary focus going forward -- it probably needs more tooling though to be easier to use. |
@bhouston OK, we can do (2). Just remember that it is limiting in that if you don't want to repeat the displacement map, you are forced to repeat it if you repeat the map.
Do you envision BTW, keeping |
I think it is possible to have at least MeshBasicMaterial, MeshPhongMaterial and MeshStandardMaterial be build upon NodeMaterial -- they would just setup preset graphs or something like that. I think that NodeMaterial may need more flexibility to replace all the other materials, but I think that is a worthy goal. :) |
I am not sure that is very common. But all these tradeoffs we have to consider carefully these days just do not apply as we move towards NodeMaterial... :) |
@bhouston OK, now I understand what your vision is. That sounds good. : - ) Well, in trying to implement this, I see that since displacement mapping occurs in the vertex shader, it is a special case which needs to be handled differently from the other maps -- it will have to wait. |
👍 |
great to see, how this sparked such a lively discussion. @WestLangley apologies if at any point you were under the impression that I was demanding things, it was a mere suggestion. your guess of usecase was spot on though, it is indeed a map/terrain I'm moving around. :) meanwhile I simply rolled my own shaders that do use vUv for displacement, |
Solved via #17487 |
the phong (and most likely others) vertex shader uses uv instead of vUv
resulting in texture.offset having no effect.
suggestion to use vUv here.
The text was updated successfully, but these errors were encountered: