-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
User selected shader is ignored in some cases #6268
Comments
Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, please make sure to fill out the inputs in the issue forms. Thank you! |
hi, can i work on this issue? @davepagurek |
I can add a shader example with lightning or texture. For documentation part, requirement of attributes and uniforms could be added, along with an example code, mentioning particularly about shaders using lightning and texture. Could you please suggest what else could be done and how I should proceed? @davepagurek |
Hi @deveshidwivedi! I think starting by documenting the logic makes sense. In general, we replace default shaders if the user shader uses some of the same uniforms. You can take a look at the implementation of this and the following few functions in the source code to see which count: Lines 554 to 570 in cab0ff1
A minor correction to the initial issue: since these conditions currently use |
Alright! @davepagurek I'll look into it and get back. |
Hi! @davepagurek. I went through this, how do i start? |
I think we'll need to decide where to document this (maybe in the docs for e.g.
We should maybe also add a note that we can consider this "experimental", as we plan to change this behaviour in the future. |
Sounds great, will there be shader examples also? @davepagurek |
I think probably not for now, if only because the "minimal example" for a fully compatible lighting shader is pretty huge and involves copying everything from |
Got it! Where exactly is the documentation needed in shaders? Would it be somewhere close to isLightShader() ? |
I think we'll want the docs to appear in the description here: https://p5js.org/reference/#/p5/shader For any reference page, to find where the source code for the docs live, you can scroll to the bottom of the page to where it says this: If you click the Github link, it takes you to where the docs are. In this case, it's here: Lines 331 to 345 in 37d3324
So I think we'll want to add to the doc comments in that block. |
Okay! Thank you so much! |
I think that would make sense! |
Please take a look, is this how it should be? |
The content looks good! I think there might be some formatting issues with the |
@davepagurek I opened a PR, please have a look! |
Increasing Access
Unsure
Most appropriate sub-area of p5.js?
Feature enhancement details
I tried to write a simple shader and was confused. It seemed like my shader wasn't being used on the sphere I created at all. I finally found in the source code that when P5 selects what shader to use, it will ignore the shader you've set if some criteria are met. For example if you have lighting enabled and your shader doesn't contain the 13 attributes and uniforms in
p5.Shader.js
, P5 will fall back to it's default lighting shader. A couple of things would be nice to avoid confusion:The text was updated successfully, but these errors were encountered: