Clipping planes with Cg

Hi, I have a problem with using a clipping plane in conjunction with Cg. When I enable the Cg profiles the clipping plane stops working! I recall something about needing special texture shader instructions for a clipping plane to work (“cull_fragment”, I think), but I’m not sure how to enable this from Cg. Anyone else have an idea?


  • Richard


I’ll move this thread to the shading language forum, where you might get an answer. Next time however, please post Cg questions to

– Tom

I believe user clip planes are subsumed by ARB_FRAGMENT_PROGRAM, which means that you have to implement them yourself if you use a fragment shader, either explicitly (by binding a fragment program) or implicitly (by having CG do it for you).

AFAICR, the KIL instruction is used to implement clipping planes.

User clip planes don’t have any interaction with ARBfp.

They should Just Work.

They’re not supported in ARBvp except in position_invariant mode.


I 've resolved this problem on NVidia cards by changing vertex shader with fixed pipeline.Pixel shader work ok with clipplane.So the problem maybe in conflict clipplane implementation with vertex shader.

Originally posted by cass:

They’re not supported in ARBvp except in position_invariant mode.

Well, that’s what is specified.
That is true with NVidia.
But, AFAIK, it works with ATi, even without the position_invariant option.
As far as I remember DX shaders have a “phase” keyword to explicitely define the portion of code that change the position of the vertex. The “clipping phase” may be “inserted” there.
So is it API limited or hardware limited ?


This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.