Cg Tutorial questions..

Started by
-1 comments, last by Shaderhacker 18 years, 3 months ago
All: I'm reading through this book and learning how to program shaders using the 3d hardware. There are a few quirks to the code in this book and one that I'm particularly stumped with and need to solve. Firstly, I think the book assumes your 3d application is OpenGL (without telling you), but FX Composer uses a Direct3D application. A lot of the vertex/pixel shaders don't work because of the coordinate system differences between OpenGL and Direct3d. One uses a left-handed system and the other right-handed. This makes for some confusing results. Anyway, at the end of the chapter on Lighting, one of the assignments is to convert the world space operations (with calculating lighting) to eye space. I don't know how to get the eye's position from any of the transformation matrix SEMANTICS from FX Composer. I've tried everything and the only valid eye space position that works is the 3rd row of the inverse view transform (which is a world space position). This is very aggrevating as I'd like to be able to transform to any of the 3 spaces for doing lighting calculations but as it stands only world space works. I've verified this with all the example code.. which sure nuff - use world space to perform lighting calculations. -M

This topic is closed to new replies.

Advertisement