Hello, I encountered an error when customizing the shader. I don’t know where my custom attribute needs to be imported. When I click the button to switch the texture of the Sky Box, an error is reported. Can someone help me
Hello, I encountered an error when customizing the shader. I don’t know where my custom attribute needs to be imported. When I click the button to switch the texture of the Sky Box, an error is reported. Can someone help me
This is the chunk you are overriding, and it only requires texture_cubeMap
.
Does your chunk require all these additional textures? If it does, you need to set those on your most likely material.
Thank you. According to your writing method, the problem of error reporting can be solved. If I need to rewrite the values of other attributes of the shader, how should the default values be bound
You can assign texture or set float / vector parameters using this function:
https://developer.playcanvas.com/en/api/pc.Material.html#setParameter
for example
material.setParameter('texture_cubeMap_next', someTexture);
See an example of custom shader with parameters here:
https://playcanvas.github.io/#/graphics/shader-burn
When I click a button, I will perform setParameter. However, when I preview in the browser, I report an error because there is no initial value of this attribute What is this? I really can’t find a solution
There is no initial value for the parameter, you need to set it up.
Thank you very much for your help. After many tests, the error that the initial value is null will not be reported under playcanvas1.59.0. Because the default value of the current visual creation project is 1.60, can I specify the version when I create the project
Yes, the 1.59 did not report the issue, but would occasionally simply fail. So we’ve switched to reporting it. You can ignore it, th behaviour has not changed.
Thank you very much