#what's the best way to go about render sorting per prefab?
1 messages · Page 1 of 1 (latest)
Render the face on top of the hair and head? Don't you usually want the opposite
I'm going for a stylized look lol, kinda like windwaker, faces are 2d, while the hair and the head are modelled, just lookin to render the planes on top of the respective head/hair per character
ig in general what's the method I should use for this, not super familiar with this sort of thing in unity, or what I'd even really search to find what I'm after
How do Link's eyes and eyebrows render on top of his face in The Wind Waker? Here's a quick answer, the first video in a series on quick techniques too simple for a longer video.
Don't worry, longer videos are still coming.
🐦 https://twitter.com/JasperRLZ
💰 https://patreon.com/JasperRLZ
🤼 https://discord.gg/bkJmKKv
🌎 https://noclip...
this kind of thing
If the parts are transparent there's a bunch of stuff you can do to manipulate render order
https://www.cyanilux.com/faq/#transparent-sorting
Most relevantly "pre-sorting mesh triangle order" if they're one mesh, as transparent meshes are sorted internally by that order
Or if they're separate objects they would be sorted by object distance to camera, so you can have a script offset them a tiny bit relative to camera to ensure a specific order with a tiny change in their real depth (which could be fixed if needed)
But if you don't have a reason to set a material transparent, it's usually better not to and stick to opaque but that means you can't use those two methods
You probably could create a feature just like the one described by the video with URP's renderer features, but no idea if there's many instructions for it
yeah they'd be transparent textures on the planes, and they'd be separate objects, and hmmm
The video's method could be simpler than I assume
Games like Antichamber feature impossible geometry where multiple objects seemingly inhabit the same physical space, but only appear when viewed from certain angles. We can recreate the effect in Unity using stencil shaders and Universal Render Pipeline's special Renderer Features functionality!
👇 Download the project on GitHub: ...
Maybe could be done using this method
The eye mask would be the "window" with the stencil shader
And the eye that overlaps with the eye mask would be rendered through everything if the eye mask is drawn on screen at that pixel
oh interesting, that sounds like it'd work well, thank you
why dont you just offset the face mesh viewspace z toward the camera?
wasn't really sure if there was a better method than just moving it, also honestly wasn't sure if that was the method I wanted to use tbh
how would I go about that in a script btw? I don't really want to move the bones for the different parts, since I have a target translation setup, but I'm not opposed to just visually offsetting the meshes
I also didn't want the mesh to clip through objects you get close to, when it's supposed to be on the head of the character
actually a hard issue because what you're really looking for is internal sorting between opaques while still respecting depth of everything else in the scene
You can try messing around with render objects, but I think even if you try to force opaques to render at a specific part of the pipeline you still end up with the same outcome
stencil idea can work, but if you have multiple characters with similar setups then it'll conflict between everyone
I think the most optimal and correct way to go about this is pipeline script a custom sorting rule for these objects
oh, that video actually gives you the answer by just have some clipping mask
yeah the clipping mask idea seems like a solid solution, just not sure how to translate that to unity, still pretty new to all the rendering features URP has
Oh I forgot, you dont do that via script. you do that via shader, vertex shader to be exact.
Im not sure about shadergraph but in shader code it could be as simple as
o.vertex.z -= _CameraOffset;
it need to be inside vertex function ofc, and after the object to clip pos transformation
Moving in clip space z / scaling relative to camera can be very useful but in this case it doesn't guarantee the geometry showing through as intended, and makes it possible to clip through something that's would occlude the eyes
Worst case scenario it doesn't fully show trough the head or hair, but also clipping through something in front of the eyes
Depends on how much you can control those situations
pretty good idea and probably the easiest to get working, but yeah you'll have to eye it a bit to get the values you want, and wouldn't be consistent between characters with similar requirements.
still, not hard to modify it for each character. It may be a bit more difficult to prevent it from clipping through geometry if say the character does have quite a head of hair... but I guess at that point the hair would be clipping through the geometry too ;p
Well luckily it’s for characters you can make with the character creator, so they’ll all be relatively the same, though I am thinking it’d be better to have more of a single solution that covers every issue