RobProductions / OpenGraphGUI

An open-source Editor GUI for use with Unity's URP ShaderGraphs. This project aims to clean up the look of Material Properties while providing ease-of-use to developers via tagging.
MIT License
28 stars 1 forks source link

Add support for HDRP surface options & advanced options #9

Open SmallSix666 opened 8 months ago

SmallSix666 commented 8 months ago

An HDRP version would be perfect

RobProductions commented 8 months ago

Hi @SmallSix666 , OpenGraphGUI should work with HDRP out of the box in theory, I just haven't tested it yet. If you'd like to try it out and let me know how it goes I can look into any issues that you encounter. Otherwise I'll see if I can test it myself some point soon. Thanks for your interest!

SmallSix666 commented 8 months ago

Basically can achieve, but HDRP comes with the Options property can not be called out, or URP 111

RobProductions commented 8 months ago

Basically can achieve, but HDRP comes with the Options property can not be called out, or URP

Ah gotcha, it seems like those extra fields might come from the HDShaderGUI class as described here but can't say for sure yet.

This might be a little tricky as it would mean extracting some of the functionality into components and working them into 2 separate classes to input into Shader Graph based on if you use URP or HDRP. Will take a look at this over the next few weeks when I have some time, and thanks for reporting it!

SmallSix666 commented 8 months ago

Ok, looking forward to your update

RobProductions commented 7 months ago

I did a preliminary look into this and although I was able to get the Rendering.HighDefinition namespace imported into the assembly definition, it seems the necessary HDShaderGUI class is inaccessible due to its protection level:

image

This confused me because the link I shared above pointed to that as the recommendation solution to custom material inspectors, but that's when I realized it was part of the HDRP version 11.0 docs. If you take a look at the 10.0 docs you won't find any pages about customizing the inspector for ShaderGraphs that use HDRP. This is just a guess, but I believe this means support for that was added in version 11.0 when they must have made HDShaderGUI non-protected.

Unfortunately, to depend on version 11 would mean raising the minimum Unity version to 2021 LTS as opposed to 2020, and I would really like to keep 2020 support. Additionally I'm not sure what consequences there will be for adding the HDRP ASMDEFs to the OpenGraphGUI ASMDEF if the end user does not have those definitions present in their project. I found a way to add a compile time constant if HDRP version 10 or 11 is detected so that will be great for the code, but I don't know if Unity will complain about missing references in the .asmdef file.

Here's what could happen: a separate branch specifically for HDRP support could be made which both raises Unity minimum and requires HDRP 11.0, which would also allow us to make hardcoded references to the HDRP namespaces without worrying about compatibility issues. Sadly it would mean maintaining 2 separate code bases and as one person I'm not sure if I have the time to really deal with that as I'd really like to make sure Built-in and URP are supported as best possible. I'm sorry for the inconvenience :(

Still, there is a path for this to happen and I would like to see it, so for now I'll leave the issue open and think on it some more. If someone was able to test all of this properly and contribute the necessary HDRP code I could definitely get that branch set up. For now though I'll put it on the backburner and wait until I have more time. Thanks again for reporting your findings!

SmallSix666 commented 7 months ago

Ok, thank you very much