https://gum.co/AXfVz 2 months after posting the preview of the shader in the tech forums, it is finally available for everyone to use! (and laugh at the code)
This shader is designed to allow meshes inside Marmoset Toolbag 3 to use
Triplanar Projection mapping so that you can map textures to objects
that do not have or have incorrect UV mappings.
It is free of charge but if you would like to tip me it would be greatly appreciated!
I would definitely recommend people to read the README if you are confused with what each parameter does for the shader.
The biggest issue that I have yet to solve for the shader at the moment is that the shader does not really work with the use of screen-space effects like SSAO, SSR, and GI (there are weird ghosting artifacts but the mesh could "sort of" work with them depending on the material type / angle, but it won't be 100% accurate).
Leave any feedback / bug reports / comments here!
PS: sorry for the late release of the shader. I have been busy in the last few months and was moving to a different country and only recently got *cough* amazing internet *cough*.
Replies
I've got some notes:
- It would be cool if you supported specular as well as metalness, There is a compile error when I try to use that model and the material goes invisible. Looks like this is on your todo.
- Looks like there is a bug with the IBL, as I rotate the sky (shift+drag) the projection shifts.
- If I rotate the mesh the projection shifts too. While sort of neat to see, I would say the tri-planar mapping should take the initial transforms and ignore any additional transforms the user adds in Toolbag. This would mean you could do triplanar materials but still be able to do things like animation the mesh. This might be what you're talking about on your todo list?
- The scale doesn't seem to make much sense, with an object scaled to real world units I have to enter a UV-tile value of about 5000. The scale settings in the scene object properties change the relative nature of texture scale quite a bit, so that might be something you need to account for. I was using Scene: Meters and Imported: CM when I needed to use 5000. If I set both to CM I can use 50, which is outside the shader max of 10.
- It seems to work with SSR, GI, and SSAO here, but I'm not sure what exactly is wrong with it on your end.
Here's a render I made with the shader, Highpoly Model, no uvs!I look forward to seeing this progress. If you want more feedback, post in the Toolbag Usergroup: https://www.facebook.com/groups/ToolbagUserGroup/
@EarthQuake Thanks for pointing out those bugs/issues! I forgot to write them on my first post.
I definitely plan to add specular maps to be working soon as I know many people use that, I only added metalness because it worked first for me.
In regards to the skybox rotating with the textures, my theory was that when you rotate the skybox inside marmoset, what is defined as the XYZ axis gets rotated with it so the world space coordinates get rotated in the matrix? (a very basic guessing at whats going on).
I definitely would like to have the textures be "baked" into the local bounds of the meshes which could ALSO potentially fix the issue of the skybox rotating the textures when you rotate it around as well (2 bird 1 stone). I just need to study up more on how it would work as the tutorial I followed to implement TPP was done inside UE4 but I have to see how this would work in shader code. Having local bound TPP textures is what I am truly aiming for as right now its definitely usable as you said but its not really that great if the textures keep moving when you move the mesh around.
I also do plan to redo the scaling parameter as I realized it does not make any sense to users. I initially added it just for convenience because my textures were offsetting too slowly for some test meshes I was using.
Also here is a pic of the "ghosting" caused by SS effects inside Marmoset. Notice the weird "occlusion" on the leaves and how they don't match with the normals coming from the leaves. If you use the toolbag3 leaf/coal material preset, you will see the ghosting move as you move the camera as well (bound to camera screen space).
It really is a weird issue because SS effects STILL properly render out onto the mesh but there is this appended render that is causing all this gunk. I have some basic idea of where the problem is originating from but as of now I do not have a solution to it due to my lack of my tech artist experience (disabling normals fixes this weird ghosting).
from state.frag:
I'm pretty sure these are the only vertex shader components you have access to. You're unlikely to be able to access the object transform directly within the shader.
A more robust solution would be to transform the vectors to a local coordinates which might be my current solution milestone but I have no idea on how to properly execute the math for it.
I was hoping it would ALSO work with actual animations coming from the vertex but that one is an entirely different beast of its own that would be nice to have working but not right now.
I also got a specular implementation working by making a triplanar shader that accepts specular maps. So now you just have to switch between specular and metalness TPP shader based on your material setup.
Hopefully will get a release soon, I just have a couple of bugs to iron out. After this next release, the older version will be depreciated as 3.03 will be missing key functions to allow the new system to work so only 3.04 will be running the new TPP shader.
(pseudo code)
T = cross(vertexNormal, vec3(0.0,sign(vertexNormal),0.0)) * (angle direction blend)
B = cross(N,T)
Any help would be greatly appreciated if it allows me to get this thing published for a proper update to the shader at this point.
This new update makes it work properly in 3.04 (it broke in the newest version) and also makes ALL OLDER VERSIONS OF MARMOSET depreciated as I am utilizing new functions that were added in this new version (BIG SHOUTOUT TO Jeff Russel and all involved in the Toolbag Team!!!).
I also gave a hopefully better texture unit scaling system to how scaling works but I might redo it again if it's not user friendly to others. For now, the 0-1 UV space will occupy 1cm which is my baseline unit (based on how marmoset generates their primitives and sets their UV scale). The offset world scale is now changed to "CM Unit Divisor", where increasing it will make a 0-1 Texture space space take up a larger amount of unit space. (IE: increasing the divisor to 2 will make a single wrap of a texture need a 1x1m to represent the entire single texture in 0-1 space)
Big features added in this update: specular support (in seperate shader), local transform (now the standard - move,rotate,scale works) (unfortunately vertex animations do not), and fixes to old SS effects.
You can now also choose to have 3-sided or 6-sided projection based on your needs (3 sided if you want near seamless textures even when rotating the mesh around with the skybox) - (6 sided if you want to have unmirrored UVs to be able to read text from the back face)
Once again, I updated the read-me so hopefully any necessary information can be found there.
https://gumroad.com/products/AXfVz
Thank you for reading the wall of text and happy custom shader usage! :
I'm having a problem here though, when I adjust the UV-Tile setting, it only adjust for certain areas of the material, it looks like it's only adjusting it for the front facing plane projection but not for the other planes, so the texture no longer lines up/there is a vast discrepancy in tiling/resolution.
https://gumroad.com/products/AXfVz
@EarthQuake I apologize for not responding to your post until over half a year later as for some reason Polycount decided to eat your response and not give me any notification that this thread has a new post EVEN though I have the thread in my favorites. It might be a little late but that bug has been fixed (tiling the UV's per axis was causing this issue for some reason, had to tile the UV's in the world coordinate level to resolve this issue)
Thank you this brilliant shader.
Marmoset + this = another choice for ZBrush external renderer.
I think why marmoset does not include this diamond in built-in feature.