Advertisement Jump to content
Sign in to follow this  

Shader troubles....(world space, object space...)

This topic is 3875 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 am having an issue with my shaders where world space, object space, and tangent space is getting lost in the shuffle. I transplanted most of the stuff I'm working with from various sources, in fact ALOT of sources, so needless to say duck tape bubble gum and a lot of reworking went into getting them to mesh up, so this was expected and I'm now going back and cleaning things up, however I think a reworking is in order. my question is this, is there a good way/practice of standardizing a shader such that world space, object space, bone space, tangent space all lay out in sync. further more what level of organization go's into this at an application level, since at present I pass almost all my matrix's to the shader. at present the engine I have built from the ground up deals with models by loading them into an object issuing an handle that stores there world orientation and various other data. a game entity then requests a link to that handle and keeps it for its own use. The entity in fact loads the models information upon requesting the handle (and yes it handles redundant meshes just fine), The issue however is when I get down into things at the HLSL level. Ive been having the full gamut of issues where lighting will rotate with the object, the eyes world position wont rotate/translate correctly with the models another words its a bit of a clusterf**k as far as how the math is handled. The effects are stored in its own object witch registers itself with a list and pass's its pointer to the model object, in case any one was wondering how that was handled. so again, how would you layout a system to achieve this (and I'm I thinking about this correctly)... - Translate/Rotate Object into world space and then clip space Then take the world space data as from the perspective of object space from there I need to, - rotate vertex's to correct bone space, and do the same to texture space from there.... - Rotate world space to bone space to texture space. From there I would write a pixel shader that deals with these vertex inputs... Texture space light direction Texture space eye position. Texture space normal. thats all well and good and working.

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!