-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Split apply_pbr_lighting into many many small functions #17541
Comments
I agree with this generally. I would go so far as to say that it should be possible for a machine to autogenerate |
Okay i have an even better idea. Check this out. Make a function 'calculate_pbr_lighting' that has ALL of the code of apply_pbr_lighting except it returns
And then make apply_pbr_lighting just call that and do this
That way, we are hardly changing the code at all but also making it WAY more extensible |
please reopen - i didnt mean to close ! |
|
See? now it is split into a read-only computation fn and a mutation function. This is way better for extension shader. Only have the mutation function was not. |
What problem does this solve or what need does it fill?
Please split apply_pbr_lighting into many many small functions. You can keep the function name the same and what it does the same. But please make it perform a bunch of small functions which can be called individually for when we are making Extension Material Shaders.
This is because I want to change the way shadows work (cel shading) but it seems VERY VERY horribly hard to do with the way that apply_pbr_lighting is so monolithic right now.
What solution would you like?
for example I want each input of this line to have its own small function
And i want to be able to effectively easily modify that specific line of code in my extension material shader . Right now, I have to completely re-write (re-implement) the entirety of apply_pbr_lighting just to change the way direct light affects my output color because this is too monolithic.
What alternative(s) have you considered?
Offer a few preset different apply_pbr_lighting functions that work differently? Make some of them have different input props or a bit flag to be able to change the way inner parts of it work?
But overall i think the best soln here is to just take chunks of the innards of apply_pbr_lighting and put them into small functions which apply_pbr_lighting calls. That way, I can implement those small functions into my shader exactly how i wish and only have to rewrite perhaps a small part of apply_pbr_lighting to change the way my color reacts to point and dynamic lights. !
Additional context
The text was updated successfully, but these errors were encountered: