Jump to content
  • Advertisement
Sign in to follow this  
MajSlayer

XNA and 3DS DirectX Shaders

This topic is 3647 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

Hello, I'm having a problem getting 3DS's directX shaders working in my draw code in XNA:( I know I need to add the effect to my program like so.. Effect effect2; effect2 = content.Load<Effect>("moscow_lava"); and add it to my content in VC# 2005, but what to do after, I have no idea.. Could someone shoot me some draw code that will handle a DirectX shader from 3DS max design 2009? Thanks MajSlayer

Share this post


Link to post
Share on other sites
Advertisement

This is the very basic step, you've now loaded the effect using the content manager. Where to go from here is an extremely vague question and depends largely on the effect itself and how it fits into your rendering process.

You'll need to set the appropriate parameters on the effect using effect.Parameters["name"].SetValue. This might be trivial, but your effect from 3DS will likely require parameter values that are harder to come by, such as (noise) textures etc. You can find which parameters you need to set by inspecting the HLSL yourself. This may seem tedious, but if the effect does require some special textures for example, the XNA runtime can't very well make these up itself.

Once the parameters have been set, you can start rendering your geometry. Here we also run into the requirement that the geometry's vertex data needs to match the input data the effect requires. The effect might need the basic vertex position, normal and texture coordinates for example. Or it might also require a tangent frame for normal mapping. You see, without knowing more about the effect and what data you have available in your geometry, it comes down to haphazard guessing.

My advice would be to check out some tutorials on how the basics of effects work (here are some) and see if you can make something of your prefab shader with that knowledge. At any rate, you can't just load a shader and expect it to magically work without at least some boilerplate code.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!