Is there the way to use Parallax Mapping for node material?

Hello everyone!
Few days ago i thinking that it was so cool if i have opportunity to use parallax mapping in NME. And i try to create a parallax mapping in NME but i don`t achieve success. It is that what i got: Babylon.js Node Material Editor
But you can see that it is not work correctly. I think it is because i use not right vector transform here:


In blender we use vector transform that i can’t reproduce in NME:

How i understand it is converting Camera view vector to object normal Vector and i don’t know how i can do this on NME. If somebody knows way to create parallax on NME please tell how to do that.

To transform a direction instead of a point you should select “Transform as direction” in the Transform block:

image

However, parallax mapping is supported in the standard/PBR materials, I guess it’s something we could support in the NME too…

Will let @Deltakosh answer about this one but be patient, he is currently in vacation.

2 Likes

Thanks for reply!)

@Deltakosh Hello! What are you think about support parallax mapping via height map or normal map in NME? This capability would allow the creation of very detailed and large ground places and other surfaces such as diffrent crystals, ice and much more other incridible things! I try to create parallax mapping in NME by myself but i was failed with that(

I see no problem to update the bump node to also support parallax for sure
It should be about adding the option to generate the additional info

You mean perturb-normal input node (for PBR)? Maybe i don`t understand currently? Anyway It will be really cool if you add this capability)

Yes this is what I meant ;D

Ok! Thanks for reply! :slightly_smiling_face:

Do you want to take a stab at it?

I’m sorry but I don’t know English very well. So I not sure that I understand you right. Can you reformulate reply?

Sure: Do you want to try to do a Pull request to provide the fix?

1 Like

I will try to do that but I not sure that I get a success because by the true I’m not good programmist-i’m 3D designer and start to write code 1.5 years ago and learned a lot but I’m not sure that my knowledges enough to solve this problem

No worries, we can tackle it later on then

1 Like

Ok, thanks) :smile:

(sorry for resurrecting an old thread, but since this matter is yet unsolved, I thought I’d take a stab at it)

@Deltakosh I’ve tried to find out what needs to be done. Are we really talking about a couple of switches in an existing node block which would basically defines.setValue("PARALLAX", true); and defines.setValue("PARALLAXOCCLUSION", true);? This looks way too easy, is there something I’m missing?

HI! Look here: Fake interior in Babylon.js - #12 by Evgeni_Popov

I actually checked. It is not possible to support it with a simple fix:
Add Parallax occlusion to the PerturbNormal node · Issue #10258 · BabylonJS/Babylon.js (github.com)

I feel like I’m still not understanding the issue preventing this. What I know is

a) required functionality is in the standard shader and works with StandardMaterial and PBRMaterial
b) NodeMaterial builds upon existing shaders, e.g. PerturbNormal block activates BUMP define to do its work

I hope this is a correct assumption. In StandardMaterial and PBRMaterial parallax occlusion is activated by two defines: PARALLAX and PARALLAXOCCLUSION. There is a lot of uniform preparation and other stuff, but at its core, the functionality is in the shader, right? Why can’t it be re-used in NodeMaterial? You mention reading multiple times from the normal map, isn’t this part implemented in the shader? If not, why can’t it be replicated in NodeMaterial? And last but not least, why would implementing a PerturbNormalWithParallax node as a stop-gap solution be overkill if it would provide a hacky but working solution to an otherwise unsolvable problem?

I’m sorry for all the questions, but I’m trying to understand the problem while lacking much of the ground-work, which I’m picking up not nearly fast enough.

PS. We need this functionality and we are intending to provide a PR, but need to understand both the problem and reservations about implementation possibilities fully, to make it easier. Not looking for free lunches, Babylon.js is a huge free lunch already :slight_smile:

Here’s a PR that should do what you want if it’s merged:

This material will work after the PR is merged:
https://nme.babylonjs.com/#KIUSWC

4 Likes

That…that just…just…WONDERFUL!!!))) Waiting for merge! :metal: :metal: :metal:

1 Like