godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.33k stars 21.24k forks source link

Shader Language #1342

Closed tomtaz closed 9 years ago

tomtaz commented 9 years ago

I'm playing with the new (2D) Shader language and I found myself realy surprised to see that there was no loops or integers available..

Is it normal or is the feature just missing ? And if it is missing, when will it become available ? (Our actual work depends on it)

Thanks for the good job !

tomtaz commented 9 years ago

After looking at the servers/visual/shader_language.h/.cpp seems like there is nothing to parse loops / recognize them, same for integers types, everything about them is commented.

reduz commented 9 years ago

Current language features are for gles2 backend, which does not support loops nor integers. When the GLES3 backend is added, those will be added too On Feb 8, 2015 6:39 AM, "Tassim" notifications@github.com wrote:

After looking at the servers/visual/shader_language.h/.cpp seems like there is nothing to parse loops / recognize them, same for integers types, everything about them is commented.

— Reply to this email directly or view it on GitHub https://github.com/okamstudio/godot/issues/1342#issuecomment-73403745.

tomtaz commented 9 years ago

CanvasItemShaderGraph has a script option. So it seems logical that this script allows us to define unique "Function" nodes that could be used in "Scalar Function" or "Vector Function" lists. Is this feature possible / available / planned ? Or will there be an other way to inject custom functions in the graph ? The graph is great, but becomes rapidly messy when one tries to reproduce some algorithms.

reduz commented 9 years ago

Adding sub graphs and sub code is planned for 1.2. The idea is currently to have the current features in stable first and getting them properly tested, then adding the rest. On Feb 8, 2015 8:38 AM, "Tassim" notifications@github.com wrote:

CanvasItemShaderGraph has a script option. So it seems logical that this script allows us to define unique "Function" nodes that could be used in "Scalar Function" or "Vector Function" lists. Is this feature possible / available / planned ? Or will there be an other way to inject custom functions in the graph ? The graph is great, but becomes rapidly messy when one tries to reproduce some algorithms.

— Reply to this email directly or view it on GitHub https://github.com/okamstudio/godot/issues/1342#issuecomment-73407274.

slapin commented 9 years ago

Current language features are for gles2 backend, which does not support loops nor integers. When the > GLES3 backend is added, those will be added too

Will that mean that one have to write different shaders for gles2 and gles3 backends? What about full OpenGL 4.x features excluded from gles3?

godotengine commented 9 years ago

Well, if you want to use gles3 features it will naturally not work on gles2.

About OpenGL4, I think It's a lost cause given drivers are really buggy on anything but nvidia. OpenGL NG is a lot more interesting at the moment.. So will rather wait and see.. On Feb 8, 2015 5:23 PM, "Sergey Lapin" notifications@github.com wrote:

Current language features are for gles2 backend, which does not support loops nor integers. When the > GLES3 backend is added, those will be added too

Will that mean that one have to write different shaders for gles2 and gles3 backends? What about full OpenGL 4.x features excluded from gles3?

— Reply to this email directly or view it on GitHub https://github.com/okamstudio/godot/issues/1342#issuecomment-73429532.

slapin commented 9 years ago

And how about full OpenGL 3.2 features?

godotengine commented 9 years ago

it's too difficult to make a renderer for each platform, so the lowest common denominator wins.

GLES3 is a fantastic subset actually, it has a lot of very useful features not present in GLES2 such as:

-Standardized texture compression -UBOs -VAOs -FBOs with multiple formats that can be mixed up -Instancing using drawcall ID -transform feedback -3D textures -ability to read-back video memory -support for integers in shader -support for non-unrollable loops in shader

And many many things more. GLES3 is much closer to PS4/XB1 level of functionality than PS3/XBOX The main features lacking are geometry shaders and tesselation, which only work well in very high end hardware anyway. Geometry shaders are useful for optimizing some stuff such as point light drawing or very modern techniques such as voxel cone tracing GI, but for the coming years none of this will work properly in most hardware.

GLES3 will give you current gen console quality rendering without any problems, and once that is working, we can begin doing experiments with OpenGL NG.. which i would much rather use than desktop OpenGL.. and i'm sure most mobile devices will move to it too.

On Sun, Feb 8, 2015 at 11:46 PM, Sergey Lapin notifications@github.com wrote:

And how about full OpenGL 3.2 features?

— Reply to this email directly or view it on GitHub https://github.com/okamstudio/godot/issues/1342#issuecomment-73450081.

OkamStudio

kubecz3k commented 9 years ago

There was nice discussion here, but I don't this the issue should be still open after all that time. Support for Vulcan or opengles 3.x is planned in Godot 3.0, and the shader language will change to fully support capabilities of this technology. Archiving the issue.