Efficient Grill using Procedural Parallax Occlusion Mapping in Blender

Progress report, new features and functionality!

Now with support for individual surface and grill-hole textures and edge bevels!!

More coming soon…

Remember, there is no grill…

Building a grill using meshes can result in possibly hundreds of thousands of vertices and faces. Tiling traditional image textures with alpha can save on memory, however they don’t reproduce the depth a mesh can convey.

Parallax Occlusion Mapping is a technique that distorts an image texture using normal maps to achieve an illusion of depth, however the result is sub-par compared to a mesh, and is even complicated further when transparency is involved.

Procedural Parallax Occlusion Mapping however can reproduce a high quality illusion of depth for regular textures such as grills with depth and are very cheap to compute in real time while also using very little memory.

This is my first version worth showing but it still needs some work before I release something usable by everybody.

Check out the Youtube video and let me know what you think!

EDIT: Forgot to mention that it works in Cycles and Eevee with no problems.

EDIT #2: New version 0.1.1 with one bug fix and a cleaner interface.

procedural-POM-0.1.1.blend (1.1 MB)

15 Likes

Vow man. That is amazing. How you did it?

Thanks!

How you did it?

Essentially some rather complicated algebra using cycles/eevee nodes. I’m thinking of making a tutorial if enough people are interested.

8 Likes

In the meantime, here’s something of the geometry and algebra involved in creating the shader.

If people are truly interested I can create a tutorial explaining how I worked the math using online tools and then built the nodes to make it do what it does.

8 Likes

Thank you for the quick reply. I think a lot of people will be interested in a tutorial. But if you can share the shader blend file people who don’t have algebra background will be more happy. For example me😁

Alright, it’s far from a finished product, but here you go. I’d love it if people show me what they do with it.

Enjoy!

EDIT: Remember it’s a blender 2.8 file!!

2 Likes

@Saabi Nice work!! FYI, I recently added a patch to add multiply to the vector math node. Hopefully this will make node groups like yours a little bit more manageable. See: https://developer.blender.org/D3786

Also, you can get vector length from the vector math node Value socket when it is set to Normalise.

2 Likes

can we use alpha maps instead of circle

@Charlie Thanks!

I just looked at the code adding scalar/vector product. That’s great news and thanks for adding it!

I have to ask however and perhaps you know why:

How come there are so few math functions built into the nodes?

It could really use matrix opeartions and even access to binormals besides tangents. I believe OSL does provide access to binormals, but if I were to use it in this shader it woudln’t be portable to the GPU.

@swathi Nope, sorry…

Well, you can, but it won’t work! :upside_down_face:

The reason being that the rest of the shader is specifically tailored towards building the illusion of light reflecting inside a cylinder.

I plan to build more procedural POMs later on including rectangular and hexagonal grills, and perhaps even an image texture based POM, but it’s not there yet.

It might be useful if you post the question in https://devtalk.blender.org/ with some suggestions about which OSL functions you’d like to see added as nodes. I’m willing to make a patch adding them if they’re not too difficult!!

I think in the past, adding nodes to Cycles was not encouraged due to technical limitations. I think this is no longer the case so the core developers maybe more willing to add additional nodes. I think if there is also a push to a more intuitive UX then adding more nodes would make node trees much simpler.

1 Like

Yes . Still there is hope. thank you

Well, in the meantime you can check out the small update I just uploaded. :slight_smile:

Thanks for sharing this. This is cool!

Just added a new video showing my progress to the top post.

What do you think?

While the grill hole is parallax-occlusion mapped, the beveled edge is only parallax mapped. That is, if you look at it from a very steep angle you still get to see the parts that should be occluded. But it´s parallax mapped anyway so it deforms in a way akin to what the real shape should.

In the image above you can compare a real mesh to the procedural texture and see, that up to that angle at least, it is still very similar.

But as the angle gets steeper, although the illusion is still convincing, specially from far away (you don’t want to be looking at grills from this close anyway, right?), you start to see some discrepancies with the way I chose to map the distortions.

Real%20Mesh%20vs%20Parallax%20Mapped%20Hole-steep%20angle

This is why I think algebra people are aliens. Their brain is much more complicated than the normal people.
Really fantastic. Details without geometry. Hope my old laptop can handle it
Thank you.

Thanks for the compliment, but while I do enjoy figuring things out, I consider myself mostly a visual thinker that’s forced into the algebra in order to achieve what I’m imagining.

I actually solved this last year in GLSL and then forgot completely about how to solve it and had to work all the math again this time, like if I had never done it before. ¯_(ツ)_/¯

I think doing a tutorial would demystify a lot of what’s involved in doing so and show how intuition plays more of a role than actual knowledge of math.

2 Likes

Hey @Charlie, where in devtalk should I post these suggestions? In the main page I’m reading the following:

For feature requests, please use rightclickselect.com.

Still, perhaps I should still go for devtalk. but in that case, should it be in https://devtalk.blender.org/c/cycles ?

Wow. Blown away, amazing stuff.