umasteeringgroup / UMA

Unity Multipurpose Avatar
MIT License
743 stars 169 forks source link

Use Graphics.DrawTexture instead of rendering with camera #212

Closed mic-code closed 5 years ago

mic-code commented 5 years ago

Hi, I have got UMA working in HDRP, which require changing the way UMA overlay texture This pull request only contain the core changes. Check https://github.com/mic-code/UMA/tree/hdrp for working HDRP version The normal map doesn't got applied to the Lit material until manual refresh (setting the shader to lit again)

uma

kenamis commented 5 years ago

didn't you have to write new shaders? the ones on the material for texture merging.

mic-code commented 5 years ago

That's what I thought in the beginning, I saw that all the atlas shader showing purple, but turns out it doesn't matter for Graphics.DrawTexture, only when rendering the material in the scene will it give purple error color.

kenamis commented 5 years ago

So, what we were afraid of with the approach you took is layered overlays. For example, the underwear over the skin. I downloaded your repo and that does not work. Are you able to get that to work in your version? If you update the underwear slot and overlay to the new uma material and add the new race to the recipe, then add the underwear recipe to the UMA, you'll see black on the legs and in the atlas you'll see the underwear isn't "overlayed" over the body texture.

mic-code commented 5 years ago

Graphics.DrawTexture works correctly with overlay for non HDRP version This PR is just a basic step toward HDRP because rendering with camera couldn't transfer anything to the rendertexture at all

uma2

Quick try with a ImageEffect shader, need to mask it out with the alpha mask, and it should work, but probably another PR for that

kenamis commented 5 years ago

LOL, duh, I made a stupid mistake. I forgot to switch to your male legs HDRP for the underwear slot, that's why the overlay wasn't layering over the body correctly.
This is great. I fixed the normal issue by the way. That's an old one, even with current UMA. You need to populate the unity material that is used by the uma material with a texture input. It can be anything. It's just to tell unity's material inspector which shader to use, because there's actually many of them hidden behind the scenes.

kenamis commented 5 years ago

You're not swizzling back the normal channels? that doesn't need to happen in HDRP?

mic-code commented 5 years ago

The normal probably need to be swizzle back, but I am not very familiar with how it work, my attempt wasn't giving out expected result, so I guess the ball is back to you, haha

kenamis commented 5 years ago

I took your method and implemented it in a new branch called "feature-HDRP". I also fixed the normal swizzle and the post process system to be compatible with SRP. I'm going to close this PR, okay?

mic-code commented 5 years ago

Cool, hope this goes into release soon