Anyone to port .CG shader to GLSL ES?

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
User avatar
fantasian
Halfling
Posts: 81
Joined: Fri May 29, 2009 8:47 am
Location: Selanic, Greece
x 2

Anyone to port .CG shader to GLSL ES?

Post by fantasian »

Hello. For our game project, we are using the ever-essential all-in-one shader : http://www.ogre3d.org/tikiwiki//Normal+ ... ing+Shader

The thing is, CG isn't supported in mobile devices; at least not with Ogre-4-Marmalade.

Is anyone up to the task? Is it possible/simple? Or would an exact duplicate be "too much" for mobile devices?
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Re: Anyone to port .CG shader to GLSL ES?

Post by d000hg »

Ogre and Unity both use 3rd-party HLSL2GLSL converter for run-time conversion of Cg and HLSL, it's somehow integrated into the Ogre engine. It doesn't seem to be working great for iOS/GLSL-ES2 but worth a look. You could also use the same tool as a command-line app so you can inspect the output and tweak as needed to fix bugs.

I don't know why it doesn't work well for GLES-ES2, maybe it only generates GLSL and this is incompatible, maybe some other bug. You'd want a proper Ogre coder to answer that :)
caseybasichis
Greenskin
Posts: 100
Joined: Wed Jan 25, 2012 7:50 pm
x 1

Re: Anyone to port .CG shader to GLSL ES?

Post by caseybasichis »

I don't mean to derail this, but would someone mind clearing the air on an aspect of glsl2?

In regards to GLSL ES 2 shaders, are there a handful of standard shaders that can be used for most tasks?

For instance in Maya I use the Mia_x material for anything that is a real world material. Are there similar mainstays for glsl?

This is an area that has been very hazy to me ever since I learned that glsl2 discards all the conveniences of things like lights etc. Is these conversion processes being described part of what makes that possible?
oiram
Halfling
Posts: 87
Joined: Sun Dec 13, 2009 5:06 am
x 6

Re: Anyone to port .CG shader to GLSL ES?

Post by oiram »

I wrote some steps for port Cg shader to GLSL ES2.
http://www.ogre3d.org/forums/viewtopic. ... 57#p459257