Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A material with textures in HDRP #43

Open
ashkan-saeedi-mazdeh opened this issue Sep 17, 2024 · 4 comments
Open

A material with textures in HDRP #43

ashkan-saeedi-mazdeh opened this issue Sep 17, 2024 · 4 comments

Comments

@ashkan-saeedi-mazdeh
Copy link

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

@happy-turtle
Copy link
Owner

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
Copy link
Author

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

Thanks

@happy-turtle
Copy link
Owner

happy-turtle commented Sep 22, 2024

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
Copy link
Author

ashkan-saeedi-mazdeh commented Sep 22, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants