Any Python/Blender coders out there?
3 years ago
This is a freakin' hail mary of a long shot, but if anyone seeing this is familiar with Python and has some time to kill...
You may have seen I've been fiddling around with a new fur shader in Blender lately as it solves a lot of the issues that more realistic fur shading otherwise has in Eevee, and in general has a kinda nice look I think. However it does have a lot of drawbacks. The style is achieved by manipulating the normals of both the model and the fur in such a way that they end up identical, which really helps the fur blend in with the surface, but this manipulation also causes light to behave extremely strangely on the characters. For example, some lights can't cast light on any part of a model that's higher up than that light is. Even if the light is pointing right at it, they typically have to be above whatever they're casting light on because of these altered normals.
If I could somehow get fur to take the normals of the surface they're emitted from, or perhaps the nearest surface point instead of their inbuilt fake-roundness normals I might be able to replicate all the advantages of this new style without having to make all the sacrifices to the lighting. It'd be the best of both worlds, super smooth looking fur without losing shadow or lighting detail!
...or it might look awful. I have no idea, because I can't test it myself, because there's no inbuilt way to achieve this at the moment. But it might look -great-.
If you happen to be familiar with Python and somehow have nothing better to do with your skills, some kind of addon, or perhaps a shader node that allows me to access the normals of the mesh from the fur material, something along those lines that allows this transfer of normals from surface to fur -might- result in some fantastic looking fluff.
I have no idea what amount of work goes into something like this. If it's a tremendous amount, don't even worry about it. But if it's something that can be knocked out fairly quickly....
I can't offer much in return aside from the promise that if you can figure it out, and if it looks as good as I think it might, I'm gonna make a lotta sweet looking porn thanks to your efforts. x3 I'm not super hopeful on this one, but I just had to toss it out there anyway. Thanks for your time!
You may have seen I've been fiddling around with a new fur shader in Blender lately as it solves a lot of the issues that more realistic fur shading otherwise has in Eevee, and in general has a kinda nice look I think. However it does have a lot of drawbacks. The style is achieved by manipulating the normals of both the model and the fur in such a way that they end up identical, which really helps the fur blend in with the surface, but this manipulation also causes light to behave extremely strangely on the characters. For example, some lights can't cast light on any part of a model that's higher up than that light is. Even if the light is pointing right at it, they typically have to be above whatever they're casting light on because of these altered normals.
If I could somehow get fur to take the normals of the surface they're emitted from, or perhaps the nearest surface point instead of their inbuilt fake-roundness normals I might be able to replicate all the advantages of this new style without having to make all the sacrifices to the lighting. It'd be the best of both worlds, super smooth looking fur without losing shadow or lighting detail!
...or it might look awful. I have no idea, because I can't test it myself, because there's no inbuilt way to achieve this at the moment. But it might look -great-.
If you happen to be familiar with Python and somehow have nothing better to do with your skills, some kind of addon, or perhaps a shader node that allows me to access the normals of the mesh from the fur material, something along those lines that allows this transfer of normals from surface to fur -might- result in some fantastic looking fluff.
I have no idea what amount of work goes into something like this. If it's a tremendous amount, don't even worry about it. But if it's something that can be knocked out fairly quickly....
I can't offer much in return aside from the promise that if you can figure it out, and if it looks as good as I think it might, I'm gonna make a lotta sweet looking porn thanks to your efforts. x3 I'm not super hopeful on this one, but I just had to toss it out there anyway. Thanks for your time!
Blender knowledge or in general computer graphics knowledge is going to be just as required as the python knowledge.
I'm not sure I really understand what it is you're trying to achieve. What do you mean by helping the fur blend in with the surface? Do you have a comparison image?
Think like throwing a ball straight at wall and expecting it to bounce straight back. But the wall thinks it's tilted, so it bounces off randomly to the side even though it looks flat.
I'm sure something is possible using shader magic, but sadly I have not looked into custom Blender stuff at all and dont have the time to learn it, so the most I can do is bump the idea.
So you want to have the base of the single hair match normals with the surface? Would this transition in normal be visible considering how thin hairs are?
If you want to avoid a sharp transition between hair and surface, would a hack like opacity gradient on the hair close to the surface be enough?
Being able to change the normals of the hairs so that, instead of using their own fake 3D normals they just match the normals of the surface they were emitted from seems to fix basically every single issue I have with hair. The problem is that the only method I have to do that right now also kinda fucks up the normals of both the model and the hair. It's 75% of the way to working so it's usable, but it has problems.
Being able to simply tell the hairs to use the normals of their emission point instead of their own inbuilt fake 3D normals seems like it would give the exact same effect my current method does, but without all the problems. I just need someone with more knowledge to find a way to do that for me. :P
To be honest, I'm not entirely sure if this can be done with Python alone. I'm sure you could automate the step that sets up the normals the way you're doing manually now, but adding a new feature to the fur system is likely outside the scope of what Python has access to. If it requires changes in C++, it may be a hassle, as it would mean you'd have to recompile a version of Blender just for yourself, and either be stuck with that version forever, or have to keep it up to date with new changes that Blender developers would be releasing.
> The problem is that the only method I have to do that right now also kinda fucks up the normals of both the model and the hair.
Ok, obvious question here... Can you copy the mesh, contract the fake-normals one (very small negative displace), and leave the original with proper normals on top? The one "under the skin" would be spawning hair, but would not be visible itself.
I really should start studying how Blender uses shaders before I offer my help, but I will ask - how are you editing the normals of the surface and the fur? Are you averaging them in some fashion? How are the hair-shaders storing the normals, compared to the surfaces they stem from?
I have no way to help. Sadly.
Or maybe instead of fur made of single hair strands, make fur made of a lot of planes with hair patches on them?
Edit: I read some of the other comments, and I might have enough to start thinking about.
For fur I'd use PrincipledHairBSDF. That is if you can use Cycles, which for animations isn't much of an option still: I'm also annoyed they aren't getting it to work with Eevee, I don't know when support will finally come after all those years. I tried creating my own shader setup to make fur in Eevee look like in Cycles with a supported setup and it still won't work right.
If you achieved better fur in Eevee using nodes, could you share the node setup please? I could definitely use that too if you're willing.
If we come up with something that works I'm absolutely down to share it, it would be a pretty dick move of me to ask the community for help with a technique and then refuse to share it with that same community when they solve it for me. x3
https://i.imgur.com/Q4Sn3LP.png
https://i.imgur.com/ElFgaAh.png
however it should work, you can capture Vector data from points (sadly not faces).
There is currently a branch with new curves in dev tools active, you could try it out and see whenever or not You could do transfer Vector attribute to the normals of Your curves, if that doesn't solve it, acustom script seems to be the more achievable atm.
The issue you are trying to fix is that when the geometry collides, their different normals give different lighting, creating visible seams.
So Im guessing to solve this you made all the normals face the same direction, no difference, no seams. But in eevee this means your ambient lights (area, point, etc) are less good looking since they base their calculations off those normals (hence the light is only visible from above).
What you can do instead of making all the normals the same, is to instead make the normals of the character all face the same direction (usually up), and the fur to start facing up, then to transition to their regular normal direction. You can use the UVs to control that transition along the UV y axis (or whatever direction you have you fur texture mask going)
https://i.imgur.com/ZHoDSQv.png
I wasnt sure how to link the surface and fur the same color though. I use the same technique for ghibli like grass
Theres a few ways to make fur, using particles to get hundreds of hair, or you can make cards with hair cutouts. I use the latter (mainly for grass, same thing).
I dont have much experience with the hair/ grooming editor, but if you are able to get the length of the hair (how far it is from the stem) you can do this method. But it wont have the same chunky/ fluffy hair look. It only helps with the blending between character surface and hair.
Admittedly I haven't used Blender, I've just coded some OpenGL.
The only thing I can think of is using the script node which allows you to use OSL shaders but that's only available for Cycles CPU rendering.
That said, you might be right about there being no easy way to do it, because it sounds like it was hard and a decent amount of work to make, haha.
It actually has been resolved;