XNA Creators Club Online
Page 1 of 1 (3 items)
Sort Posts: Previous Next

Is it possible to apply more then one effect to a primitive?

Last post 7/15/2009 4:51 AM by Cansin Kayi. 2 replies.
  • 7/14/2009 6:16 AM

    Is it possible to apply more then one effect to a primitive?

    Hello, I have been trying to apply more then one effect to a primitive and after many failures I have decided to seek help here, lets say there are two effect files written in HLSL, one that applies grayscale and another that does some simple blurring, how would I apply that to a square made up of two polygons with a texture that are made with such code:

    verts = new VertexPositionTexture[4];
    verts[0] = new VertexPositionTexture(new Vector3(-1, 1, 0), new Vector2(0, 0));
    verts[1] = new VertexPositionTexture(new Vector3(1, 1, 0), new Vector2(1, 0));
    verts[2] = new VertexPositionTexture(new Vector3(-1, -1, 0), new Vector2(0, 1));
    verts[3] = new VertexPositionTexture(new Vector3(1, -1, 0), new Vector2(1, 1));

    so with that verts array for example, would it be possible to apply more then one texture? (this is of course in a 3d space)

    What I have been trying is just drawing it to a rendertarget with a blur effect, then getting the texture of the rendertarget and applying grayscale to that, however I feel that is just a cheat because what I want to achieve is two effects on the square itself not the whole screen if you get my meaning...



  • 7/14/2009 9:45 AM In reply to

    Re: Is it possible to apply more then one effect to a primitive?

    Can't you just create a technique with 2 passes. The first would apply blurring and the second grayscale? Or combine the two into a single pass. Or why would you need to have 2 different HLSL files?
  • 7/15/2009 4:51 AM In reply to

    Re: Is it possible to apply more then one effect to a primitive?

    I was just using those two shaders as an example, it doesn't have to be them exactly. Having a technique with two passes is possible for simple shaders like the blur and greyscale, but I would prefer to know how to apply two in the form of two files in the event that I can't just put them in one shader, as I would prefer to be able to stick in the lowest shader model version possible(so as to be more accessible) and since they have a limit on the number of instructions(shader model 2.0 is my target) I can't just chuck them all in the same file once they reach a certain complexity...
Page 1 of 1 (3 items) Previous Next