Jump to content
  • Advertisement
Sign in to follow this  
D3DXVECTOR3

best way to use ID3DXEffect and textures.

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

ShaderA: texture ambient; texture bumpmap; texture pecular; ObjectA uses ShaderA where I set the textures and render with the effect ObjectB uses ShaderA where I set the textures and render with the effect OR ShaderA: texture ambient = "metal_a.png"; texture bumpmap = "metal_b.png"; texture specular = "metal_s.png"; ShaderB: texture ambient = "stone_a.png"; texture bumpmap = "stone_b.png"; texture specular = "stone_s.png"; ObjectA uses ShaderA render with the effect ObjectB uses ShaderB render with the effect so ShaderA and ShaderB are EXACTLY the same effect but have different textures. Is it better to have more of the same effects or use the same effect but set the textures everytime!? The 1st situation result in more Effect->SetTestures() and the 2nd one will have more Effects loaded.

Share this post


Link to post
Share on other sites
Advertisement
I think it is better to set the texture, because if you duplicate a lot of effect files, it will become a maintenance nightmare.

Share this post


Link to post
Share on other sites
In general, setting new effects is more expensive than setting new textures.

You could use a single shader that did not specify any particular textures to load. Instead, it could use annotations and semantics to indicate which variables in the shader are to be used as diffuse, specular, and bumpmap samplers, respectively.

Then for each mesh that you're trying to render, the application could set the different textures of that mesh to the appropriate variables in the shader by using the annotations and semantics from the shader.

neneboricua

Share this post


Link to post
Share on other sites
Let me tell that is not an easy question.

Your first option is more appropiate for games. It is an open model where the app can access the variables inside the shader. It corresponds to the DXSAS 0.8 model.

The second option is a closed model that corresponds to the DXSAS 1.0 model and is harder to use.

The idea in SAS 0.8 is that the programmer can acces the shaders and modify its values. That means the artist maybe wont get the result he expected for his model in his 3D app (be it Max, Maya, XSI). A green may look like a yellow or a texture won't be appropiate. This model gives controll to the programmer.

The idea in SAS 1.0 is that the artist can create a package with a model and design the effects as he wants them to look. The host app can load the model and provide lights, cameras, time and rendertargets. But it just can't access the shader attributes. That means you will need a different and specific shader for each model (not each object). The advantages is that the model will always look as the artist expected. And the artist is the one that will decide your presentation so thats important.

So, I think you should select which model you want to support. Power to the artist or to the programmer?

Luck!
Guimo


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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!