happy-turtle / oit-unity

Order-independent Transparency Implementation in Unity with Per-Pixel Linked Lists
Apache License 2.0
193 stars 28 forks source link

A material with textures in HDRP #43

Open ashkan-saeedi-mazdeh opened 2 months ago

ashkan-saeedi-mazdeh commented 2 months ago

Hi How can I make the HDRP Lit material to get at least albedo/difuse texture instead of/in addition to color?

happy-turtle commented 2 months ago

Hello, unfortunately not without writing your own shader. The way I created the HDRP shader was, I created a super basic shader with a color in Shader Graph and then copied the generated code and modified the code to add the missing OIT shader code. Unity does not provide a good way to modularize shader code, which makes all of this quite hard. I mentioned this here, basically a feature like block shaders would be needed to make the whole process of writing these shaders easier. They released an experimental version, but I don't think it found its way into the actual Unity engine yet.

ashkan-saeedi-mazdeh commented 2 months ago

Thanks It would be great if you tell me what modifications I should apply to the generated shader graph.

Thanks

happy-turtle commented 1 month ago

You need to use the createFragmentEntry() method of the package and pass in the fragment's final color value. This is done in a copy of the Forward pass include file. Because this is not directly in the main shader file, but in a separate file, you need to swap the import in the main shader file. Just going through the file reminds me again, what a terrible experience writing these is. 😅 For a better understandable and minimal example on how to implement an OIT shader, have a look at the Unlit shader example.

ashkan-saeedi-mazdeh commented 1 month ago

Thanks for the reply. Let me know if you can do paid work on this.

Could not find your email. If you can please email me at @.***

On Mon, Sep 23, 2024, 00:30 Till Davin @.***> wrote:

You need to use the createFragmentEntry() method of the package and pass in the fragment's final color value. This is done in a copy of the Forward pass include file https://github.com/happy-turtle/oit-unity/blob/main/HDRP%2FShaders%2FOitShaderPassForwardHDRP.hlsl#L266. Because this is not directly in the main shader file, but in a separate file, you need to swap the import in the main shader file https://github.com/happy-turtle/oit-unity/blob/main/HDRP%2FShaders%2FOitLitHDRP.shader#L8110. Just going through this remonds me again, what a terrible experience writing these is. 😅 For a better understandable and minimal example on how to implement an OIT shader, have a look at the Unlit shader example.

— Reply to this email directly, view it on GitHub https://github.com/happy-turtle/oit-unity/issues/43#issuecomment-2366962819, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLLKG5PRSKBMX4W4SV5NU3ZX4VVNAVCNFSM6AAAAABOLWT6TOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRWHE3DEOBRHE . You are receiving this because you authored the thread.Message ID: @.***>