Unity please fix shader bugs for OpenGL ES2.0 before release

At first test it seems like shaders work a bit better now in U3.0f1 but still there are some annoying bugs in the generated shaders if compiling universal (OpenGL ES2.0 support). See for example bug #373556. It would be a shame if we can’t use full shader power in the official build.

Thanks,
Jaap

you can use the full shader power, just write GLSL shaders, don’t rely on cg not messing it up due to glsl vs glsl es differences etc.

gives you more control and better performance and the surface shader system is something you don’t use on the idevices anyway

Ah just pure shaderlab declarations.
In that case I naturally agree, the things offered should also work or documented as not supported on ogl es 2.0 at least

On the other hand I’m pleasantly surprised that they didn’t cut some of the setup possibilities cause they are bound to at least partially mess in on OpenGL ES 2.0 where no fixed function is present at all (you can decide to either only use fixed function or not use fixed function at all on ogl es)

I guess I can have a look at GLSL one day but not for this release. Have had a quick go at vertex/fragment shaders but didn’t see how you could use it with vertex lighting instead of pixel lighting and with the amount of pixels to write on 4G/iPad we already quite taxing the hardware with vertex lighting. If GLSL does make it possible to write simple vertex lighting shaders it would be interesting to look at it. Any pointers? :slight_smile:

swiftless glsl tutorials, especially tutorial 4 at http://www.swiftless.com/tutorials/glsl/4_lighting.htmlshould be of good use and Tutorial glsl2 – DGL Wiki

That should give you a good hands on for the shader itself, all you need to do then is put those into the shaderlab declaration within the corresponding begin - end defines etc (see glsl manual part of the unity docs for more on the matter)

alternatively you can also use cg which for the iphone will generate glsl code, I would personally just not recommend to use the surface shader system (though in this case its no topic anyway, as you don’t want pixel light etc surf shaders are no option)

Thanks, I’ll have a look at it. The main thing that put me off cg was:

I already rewrote my shader to cg but of course got stuck when lighting came in play. Don’t want to use pixel lighting because of speed. If I manage to make a GLSL version, I’ll put it up the wiki as shader examples are always useful for other people stumbling around in this tricky area.

Just went through my notes and unhappily the quote is right in aspect that on GL ES especially this kind of stuff is cut.
That does not mean that you can’t do it, it just means that gl_LightSource is no longer autofed, you would get 100% control over the light sources pushed to an object used by specifying them in script.

that might potentially be too much of work at your current stage.

But it also depends on what kind of light type you use. point type vs directional makes a major difference here :slight_smile:

alternatively you have pixel lights on which I’m unsure on their impact especially on fillrate.

also the difference might be well worth it, if you read through Iphone 3D engine with openGL 2.0 experience

How do I add GLSL shaders to my iphone project?

same way you add cg shaders, just that you don’t use cgprogram but the corresponding glsl counterparts (the documentation has a page on glsl shaders)