Basically, you can’t do more than 4 levels of “dependent read”. A dependent read is when you read from a texture and then use the result to compute new coordinates to read from a texture.
Shader Model 3.0 does not have this limitation in Direct3D, but on OpenGL (in particular Apple’s OpenGL implementation), some graphics cards (I think some Radeon HDs) only support 4 levels of texture indirection. Yes, the hardware can do unlimited texture indirections, but Apple’s OpenGL only allows 4
Not right now. But yeah, having that capability does make sense, will add for next release.
This tries to do “rougly shader model 3.0” for both D3D9 and OpenGL. On D3D it compiles to SM3, and on OpenGL it tries to use similar set of limits (plus the aforementioned four dependent reads limit, which you’re hitting).
Thanks Aras for all the help. I was able to port the relief shader from Max with ShaderFX to FX Composer, and then manually ported to RenderMonkey and then manually ported to Unity3d.
The code is a little messy. I left the generated code in, while I figured out how to port to the Unity variables.
The shader will work for everybody else when the new CgBatch compiler is released.