Sign in to follow this  

Cg interfaces.

This topic is 3837 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I currently have a shader/material model that loads shaders from DLLs, and CgFx files, where each shader creates a seperate effect. I have been looking into Cg interface's and it seems like all shading could be done easily with a single composite shader that passes an input struct through a series of interfaces, for each type of effect to be applied. Then for each interface I implement a version which applies the effect (light mapping, texture, normal map, displacement map, etc etc), and a version that just passes straight through. Then all effects can be created using a single CgFx program and binding either the pass through or the effect to each interface. I just have a few questions about this approach: Is the Cg compiler good enough to completely optimize out a pass through version of an interface? Has anyone implemented shaders like this and had good results? Am I missing something that will stop this approach from being able to handle all types of effects? Is there any reason why this approach would be less efficient than using a different shader for each effect? Thanks!

Share this post

Link to post
Share on other sites
Sign in to follow this