AndrewRayCode / ShaderFrog-Runtime

Runtime library for ShaderFrog
78 stars 16 forks source link

Could we declare public parameters with defaults? #6

Closed bhouston closed 9 years ago

bhouston commented 9 years ago

It would be cool to declare that my shader has a few public parameters like specularColor and opacity each with default values and then those would be publicly exposed.

AndrewRayCode commented 9 years ago

What do you mean by public? On the right side of the "basic" shader code editor, any uniform you type will appear with an appropriate input. Any value you put in there will be set as the default value for the runtime of the shader.

It would be nice to be able to declare #defines or something like that in a similar interface.

One planned feature of shaderfrog is the ability "bake" in uniform values, as in if you know a uniform will never be changed at runtime, you can check a box and it will be replaced in the compiled code with a constant.

bhouston commented 9 years ago

I'm working on a very basic PBR shader here -- I have the guts, but not sure how to hook it up to everything else:

http://shaderfrog.com/app/view/84

bhouston commented 9 years ago

My fault. Closing.

AndrewRayCode commented 9 years ago

I think this is a clear indicator I need to make the uniform list more clear, or give a better indicator that when you add a uniform it's automatically added to the side.

AndrewRayCode commented 9 years ago

Also planned is the ability to add suggested ranges for uniforms - for example if you know that a roughness parameter could only go from 0 to 1, you could use the interface to set the min to 0 and the max to 1, so that on the preview shader screen, end users could play with those values (through a slider or similar interface) without affecting the source code, to see what the possibilities are for using the shader.

bhouston commented 9 years ago

I'd prefer if one could use pragma statements in the shader to specify names, defaults, ranges, etc for the uniforms. That would be a lot cleaner than adding a separate storage format parallel to the shader code.