This project is read-only.

Shader problem

Jul 15, 2009 at 11:05 PM

Hey, i just gotten started with your nice engine and starting to learn on how to use everything correctly. I must say that i all works like a charm and once known easy to implement, many thanks for that!

I tried a planet shader and imported it into the project. After that i ran the custom tool, once i adjusted the shader so that the tool created the .cs file without error i had many errors once i tried to run it :(. The shader work like a charm inside xna, but i just cant get it to work with Xen.

This is the original shader file, i deleted it from my project because of the many errors but i am willing to give it another go. But maybe you spot something on sight why it doesn't work.

I did remove the variable defenition that where generating errors and created a technique for each pass.

Many thanks already for your work on this very nice engine!

Jul 16, 2009 at 2:16 PM
Edited Jul 16, 2009 at 2:17 PM

Hi :-) Thanks for the feedback.

That's a funky shader.

I'm thinking what is tripping up here, is that by design xen does not support changing the render state within a technique pass (it gets ignored - it would be tricky to detect). It's my (hard learned) experience that this can cause *huge* problems as a project gets bigger, because you are managing render state in two very different places. I've had some utterly terrible bugs crop up from this sort of thing.. :-)

This is also the reason only single pass techniques are supported. Without render state changes, there really isn't any significant practical use for multi-pass shaders, and it *significantly* complicates the internal systems.

So what I'd guess, is that you'd need to match up the render state in your drawing code. Also, some of the passes do not define the vertex shader, which is required in xen (in XNA, this would use whatever vertex shader is currently bound - which could be disastrous).

If you have any errors that don't make sense, please let me know. I can see some semantics that won't be recognized in xen (eg, 'AMBIENT' will be causing an error because the only special semantic allowed is 'GLOBAL', otherwise it has to be one of the preset semantics like WORLDVIEWPROJECTION. The equivalent of 'CameraPosition' is supported with 'VIEWPOINT'). 

Hope that helps :-)