Skip to content
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

Shader language - enum hints for uniforms #8738

Closed
SirPigeonz opened this issue May 12, 2017 · 6 comments
Closed

Shader language - enum hints for uniforms #8738

SirPigeonz opened this issue May 12, 2017 · 6 comments

Comments

@SirPigeonz
Copy link
Contributor

SirPigeonz commented May 12, 2017

Godot 3.x

Would be great to have enums or something similar for uniforms in shader lang.
So it would be easier to add switchable functionality, instead documenting for user which int does what.

@nunodonato
Copy link
Contributor

wont this encourage the use of If statements? branching is discouraged in shaders

@SirPigeonz
Copy link
Contributor Author

SirPigeonz commented May 13, 2017

@nunodonato
Hmmm I didn't though about it. Maybe.
It's waste of processing power, but 3.0 already supports if statements.

Question is, do we make it smarter than user. Or there is no need to make interface for it harder to use, when somebody decides to use it.

I'm usually against making interfaces smarter than user, but maybe I'm wrong in this case. :)

We can always write in new shader tutorial to be aware of using if. Usually it can be avoided using scripting. For example changing shader in node, not shader code in shader itself, although compiling multiple shaders also slows things down.

@nunodonato
Copy link
Contributor

@n-pigeon actually, you can do a sort of branching in shaders, but you shouldn't use ifs. Usually you mix() 2 variables based on a 3rd one which is the "conditional".
Consider a splatmap, for example. Based on the color of the map, you paint different textures, but you never use IFs to decide.

I think @reduz said that the new shader language would also include a few helper functions to make comparing things easier.

@SirPigeonz
Copy link
Contributor Author

SirPigeonz commented May 13, 2017

@nunodonato
Thats how you mix shaders and there will also be an if.
if texMask: col1 else: col2

if texMask * customBlend: col1 else: col2

if / enum would be more for changing shader behaviors more globally by Inspector.
Sometimes you have to use if, trick is to figure out how not to :P

@reduz
Copy link
Member

reduz commented Sep 29, 2017

kicking to 3.1, low priority

@akien-mga akien-mga changed the title Shader 3.0 - enum hints for uniforms Shader language - enum hints for uniforms Sep 15, 2018
@akien-mga akien-mga removed this from the 3.1 milestone Sep 15, 2018
@akien-mga
Copy link
Member

Feature and improvement proposals for the Godot Engine are now being discussed and reviewed in a dedicated Godot Improvement Proposals (GIP) (godotengine/godot-proposals) issue tracker. The GIP tracker has a detailed issue template designed so that proposals include all the relevant information to start a productive discussion and help the community assess the validity of the proposal for the engine.

The main (godotengine/godot) tracker is now solely dedicated to bug reports and Pull Requests, enabling contributors to have a better focus on bug fixing work. Therefore, we are now closing all older feature proposals on the main issue tracker.

If you are interested in this feature proposal, please open a new proposal on the GIP tracker following the given issue template (after checking that it doesn't exist already). Be sure to reference this closed issue if it includes any relevant discussion (which you are also encouraged to summarize in the new proposal). Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants