I just beat you to the reply button, @sebavan!
Hello! I actually wanted to go to sleep, since it’s 4am in the morning in Germany, but those amazing answers got me excited!
PatricRyan: I thank you for your detailed answer an info on creation! That would have been a much easier way to actually create the textures. I think this example should be shown in the PBR Master sections for Anisotropic.
Sebavan: I thank you a lot for this link. Since I already have an appropiate texture including UV coordinates, I was able to just put it in the right place on a texture of the same (as you saw in your testing it already fit almost).
I came to this point: https://playground.babylonjs.com/#QRFGGJ#2
I think this is really amazing for a real time rendering.
One last question: If you look closely, you can see “edges” from the actual triangles of the geometry. Is this something that has to be changed in mesh? I got similar things on the bottom of the stand comming from the bump map.
You can see some of these “lines” in the lighting:
Any hints on this?
I get some things like these quite a free times - don’t know exactly why.
Might be a thing from the mesh. I get those provided and as far as I know they are exported from some CAD application.
Thank you very much!
I ll leave this one to @PatrickRyan as I am super bad with modeling tools
A better place to see these is here:
Wireframe:
The artifacts disapear when deactivating the anisotropic texture.
I don’t think it should mess up with vertices/edges/normals?
Not sure though. If there is a tweak in Blender I will do so of course!
But so far I am really happy with the result!
I think we can consider this as solved!
Thanks everyone
@Kevin, @sebavan and I had a conversation about this today and I realized something that I hadn’t taken into account earlier which may also be something to check on your model.
Basically, ignore everything I said in my earlier post. I wasn’t thinking about the tangent space in the model. I had said that the texture R and G were overriding the direction factor but that is incorrect. We are multiplying the tangent from the model with the vector2 we derive from R and G of the anisotropy texture and multiplying that product by the direction factor. So all three values need to be aligned. I made changes to the playground and assets above which you can see here.
This was the problem. I orignally was trying to keep the textures simple because I don’t expect our community to have access to tools other than open source or free tools. Keeping the textures simple and square meant I didn’t have to rely on a polar coordinates conversion in the texture path which would put a restriction on any tool that is used to be able to handle this. So I opted to use a UV trick for warping a straight texture into a circle with geometry but this was the wrong path. The reason can be seen in this screen shot:
This is a wireframe view of the pipe I made with the vertices of the inner radius all sharing the same position to enable the bending of UV space into a circle. The red and lighter blue lines are the mesh tangents. Notice that there are a bunch of tangents clustered in the center representing edges with a length of 0. The outer radius tangents are also aligned as they would be with a quad, so they mirror the outer edges of the mesh. These tangents are multiplied into the anisotropy calculations and were causing all of the “seams” in my render above. The only true fix for this is to collapse the center vertices into one vertex which results in the correct tangent space for the mesh:
This means the whole mesh has the same tangent space so multiplying that one tangent with the anisotropy direction factor so the whole mesh would render similarly with no anisotropy texture. Since I changed the triangle list on the mesh, I needed to reproject the UV space, which now looks like this:
This means that the anisotropy texture needs to change as well and so I added a polar coordinates node into the graph as well as adding two gradients into R and G to give the change to the product of the tangent * factor * textureRG that we are looking for to stretch the reflections like we wanted:
Note I used a gradient texture that ramped from 0 to 1 to 0 so that we don’t have any obvious seams like we would if I just used a 0 to 1 gradient as the wrap in the polar coordinates would place 0 right next to 1 and cause a seam in the reflections. The other thing to note is that I shifted the gradient by 0.5 before running polar coordinate to be placed in the G channel. If you place the same gradient in both R and G, you won’t get the stretching of the reflections like you need, so the gradients need to be rotated 180 degrees from one another. This results in a much better render:
In looking at your mesh, and where you are seeing the seams in the reflections, I am led to believe you are experiencing the same thing as I was. You will want to make sure you collapse your mesh so you don’t have vertices sharing the same coordinates (or very close to the same coordinates). You should also see if you can run some sort of cleanup process on the mesh to recalculate the tangents on your mesh. In Maya there is a cleanup mesh operation, but I am not sure what it is called in Blender.
And when you export your mesh, you will want to make sure you are including your mesh tangents in the export so that we are calculating anisptropy from the right data.
I hope this helps narrow it down for you, but let me know if you have other questions. Sorry to lead you down the wrong path before.
Hey there!
I thank you and all others so much for your help!
I completely came to the solution I wanted! That’s so amazing.
I would definetely like to see this description somewhere here: Master Physically Based Rendering (PBR) - Babylon.js Documentation
I think it would also be a more appropriate Demo for this section
@Kevin, wanted to point you to the updated demo and video for Anisotropy. The docs have been updated as well: