I’m not sure what the deal is, but I cannot get this node to work at all.
Unless there’s something obvious that I’m missing. I used Allegorithmic’s Substance package (Bitmap2Material) to generate Ambient Occlusion, BaseColor, Roughness, Metallic, Normal, and Height maps from a seamless brick texture. The following image shows all of the above maps plugged in with the POM material node. Yet I don’t get any parallax effects on the texture itself as shown in the 2nd image. The result is just a regular output as if I’m just using a standard normal map. If I unplug the POM node entirely from the texture maps, there is no change.
I’m not sure what I’m doing wrong but it doesn’t make sense. It should be working properly considering this is how a POM output would be plugged into the texture maps if it was done the long “old-fashioned” way.
Also, changing the HeightRatio or Min and Max Step values have absolutely no effect on anything.
Definitely a good thought and one worth mentioning. I suppose I should have mentioned that I tried to do that and tried to isolate every single channel, RGB and A, and still no parallax results. The height map that is plugged into the Heightmap Texture input is just a standard grayscale texture. The same texture information is on every channel R, G, and B so it shouldn’t matter which channel I have set in the heightmap channel v4 param. But just for the sake of trying it again, here’s the updated screenshots:
What video card are you running? Is there any chance it is not DX11? Inside the function there are a bunch of quality switches that auto-disable the feature if the quality mode is not high or the video card is no SM5. If you simply bypass those nodes, does that fix it?
like this:
Also, are you positive there are no material instances applied that may accidentally have overrides set to bad values?
I’m running UE4 on a Mac, which does not have DX support unfortunately as I’m sure you know. The graphics card is a Nvidia GeForce GT 750M. I am using a material instance so I could modify the values without having to keep compiling/applying the shader but I never changed any of the default values that I set on the scalar param nodes yet. I’ll try to bypass the quality switch nodes and see if that makes a difference and get back to you.
If it is indeed because I’m on a Mac and not on PC, then that would be annoying considering I already can’t use because of that. Speaking of which, is there any word when Mac users will get support? Or will that always be a DX only feature?
Ok I will dig around to see if there is any obvious reason why it would not work on a mac. It is possible the material is failing to compile fully, but due to the way the offset is returned, it may just be returning a 0 and showing the original UVs.
Thanks, I greatly appreciate it! I’ve been waiting for this feature for a long time and to not be able to use it (like I can’t use tessellation) would be disappointing.
It’s not obvious if the material is failing to compile fully. It’s not giving me any errors or telling me that there are any issues like it normally would if I had something hooked up improperly or for example if I was trying to multiple a vector2 by a vector3, how it would return an error and not let me compile.
That seems like what is happening though, it’s just returning a zero and the original UVs. Nothing that I do with any of the scalar values, heightmap channel, or anything has any effect on the material results displayed. As I mentioned in my OP, if I completely unhook the POM node from all of my texture maps, it’s the same result. Almost like the POM node is doing absolutely nothing in the first place.
I even tried to use an alternate heightmap with stronger values to make sure that it wasn’t the heightmap itself causing the issues and still get the same thing.
I am not sure specifically what is causing it, but I suspect the samplegrad function may be involved. If you replace the code inside of the custom function (the top one without shadows), does it help?
Well this is an interesting development. I went in and tried to do what you suggested and it appears that the entire editor freezes and I can’t do anything besides Force Quit it. It only happens when I open the Parallax Occlusion Mapping function and try to move around in it or do anything. Like literally the entire engine freezes. I can move the windows around but I can’t click on anything in the editor. Sigh. lol. I’ll keep trying but it’s been happening over and over for the past 10 minutes. I force quit the editor and reopen it and try it again and it just keeps happening.
Here’s the log file that was generated during the most recent run of the editor:
Not sure what is causing it to freeze but I can move around and navigate any other materials except the Parallax Occlusion Mapping function. When I open it to edit and try to do anything in the function itself, it just freezes. As long as I don’t right click and move around in the function, it’s fine.
It doesn’t fully crash, so I don’t have a crash log, it just freezes but not to the point where I get the “Application is not responding” notice.
EDIT: I just sat there for like 10minutes with it frozen to see if it would unfreeze and it didn’t. I’m not sure how I can edit that custom node like was suggested since I can’t even get to it.
EDIT: Yeah, I’ve literally been trying for like an hour now. I can’t get anywhere in the POM function. I can move it around a little bit, but if I go too far to the left or zoom out too far, it freezes up. It’s hard to explain but the log that is generated is above and it seems to be pretty much the same log every time. I really don’t know what do now besides do a screen record to show the freeze, though I’m not sure what that will be able to tell anyone.
EDIT: Okay, after very careful navigation (something within the function causes the freeze when visible to the user, don’t ask me why) but as long as I don’t navigate too far toward the center of the function, I’m okay. I was able to finally get to the Parallax Only Mapping node and click on it. I replaced the code, applied, saved, and went back to my material, applied, and saved. No noticeable changes yet. What do you mean “try debugging the ‘offset only’ output in emissive”? If you mean, plug the offset only output from the POM node into the Emissive Color of the material, I did that with the new code changes that you provided and still nothing.
Ok, seems like it could be related to opengl compiling. I will test out the function with -opengl and see if I can reproduce any of this. Thanks for reporting it.
I can verify that POM is broken in -opengl. I was unable to reproduce the hang freeze you saw when editing the function so I will poke around and see if I can figure out what it doesn’t like. Sorry about that.
Out of coincidence, this weekend I made a debug version of POM that works as a side-profile trace, showing how many steps were taken to hit the bottom.
This shader works fine in opengl and it is really just a few lines different than the default POM. So if I can figure out why this works and POM doesn’t, I should be able to fix it. Might take some noodling though!
Ok I figured it out. It was the quality switches doing it, I simply told you the wrong thing to change in the image. That multiply(1,x) node is actually the disabled chain. instead plug the “Default” input of the quality switch to the output. I am not sure why open gl is saying not SM5.
I did notice that if you go over ~32 steps in opengl it can cause some strange flickering bug that actually makes the materials have holes. Strange.
I am still not sure about the compiler issue. It could be simply taking forever to compile the material on your machine.
Awesome! I’m glad you figured out the issue that was causing this. Though, when I take the output of the Quality Switch to the Parallax Output, I get the same freeze hang issue immediately when it connects to the Output. D:
Ok, the freeze hang issue has something to do with “Previewing” the Output node. I turned previewing off (It’s on by default it seems) and it let me connect the wires without doing the freeze hang thing.
I was able to get this connected as you said, from the Quality Switch, bypassing the “Feature Level Switch” and going directly to the output but back in my material I get a shader error saying: Error [SM4] Function ParallaxOcclusionMapping: Cannot cast from float3 to float4.
the problem now is that your channel mask is input as a V3. when you connect a vector param like that, it only connects RGB. You need to append the Alpha channel using an Append node.
So I asked around and it is expected that mac is not shader model 5 since the drivers do not yet support it. But there should be nothing explicitly making POM unsupportable, I mostly disabled it for non-SM5 as a performance precaution. It does seem like a bug though that on a PC, opengl still does not work with SM5 feature level switch nodes.
Well that’s interesting. That error didn’t show up until I bypassed the feature level switch like you suggested. In any case, I did append the alpha channel and connect that but guess what happened? Freeze hang as soon as I connected the append to the Heightmap channel V4 input of the POM node
So it may be that my original instincts, were correct - that this should only be a true SM5.0 feature. It may be that something about the mac hardware drivers does not like compiling out a for-loop the way this function works. I know that mac does not support SM5 yet. I will have to do some research on what exactly might be going wrong.
It is expected that you wouldn’t get any errors about that connection when the feature level switch is disabling it. When a switch disables something, to the compiler those nodes don’t even exist.
One thing you could try to see if its really just a compiler issue (ie, number of temp registers not enough in old shading model), is put a low CONSTANT for both min/max steps, such as 2.0. The compiler may have better luck unrolling a shorter loop with a known end like that. I may have to ask for a mac for testing.
When you open the editor, can you view the log and see what shader model it is using? You can go window->developer tools->output log and copy it all to wordpad.
For me it said this (so search for some part of this line):