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

vertexpositioncolor but no color ...

Last post 8/31/2007 5:56 AM by Heronash. 2 replies.
  • 8/30/2007 11:46 AM

    vertexpositioncolor but no color ...

    Hi,

    So I decided to give xna another shot after getting stuck and frustrated with it a while ago and nothing much has changed :)

    Doing the hazymind tutorial (again) till part 5 when I decided to try and add a grid to my scene .

    My plan: a grid with white borders, gray lines along the x and z axis every 10 units with a white one every 100 units. A colored quad with transparency filling the grid.

    Easier said than done I discovered. Using the vertexpositioncolor I created the grid giving each vertex it's needed color and added a red colored quad and set it's vertices to 50% alpha. After rendering this with the basiceffect I had an all white grid and quad with no transparency.

    A bit of searching solved the transparency problem but I'm not very happy with my solution for it since alpha is set with the shader alpha property while I had hoped to do it with the alpha value on the vertices and it also depends on the draw order, when drawing the grid before the scene I can't see the bottom half of the texturedquad thru the colored quad.

    As for the color of the vertices, can't get it to work. At first I tried to create my own shader with the help of some examples (GridShader.fx) but it will only draw a yellow grid and quad, no clue why because I don't have any yellow anywhere... So I went back to the basicshader and added diffusecolor, this works it seems but I don't want to color the entire grid with one color. I've also tried setting VertexColorEnabled to true in the basiceffect but that had no effect.

    I've uploaded the solution here if anyone wants to have a look at it rather then post some code since I have no clue what I'm doing.

     

    Regards

  • 8/30/2007 12:03 PM In reply to

    Re: vertexpositioncolor but no color ...

    I haven't went through the Hazy Mind tutorial other than a cursory glance, but if you've tried XNA twice and used that tutorial both times and gotten frustrated both times there may be potential that it's not XNA, but the tutorial that you're finding difficult?

    I would recommend checking out some of the samples and tutorials on this site or in the Help in XNA Game Studio Express just to make sure you're giving it a fair shake. You can also find a ton of tutorials and samples at all the other community sites. It may just be that tutorial you are currently following doesn't meet your learning or coding style.

    I'll take a look through your sample you provided just to see if anything is apparent to me, but I think others more wise than myself in the ways of 3D and shaders will have an answer for you before I'm even done downloading.
  • 8/31/2007 5:56 AM In reply to

    Re: vertexpositioncolor but no color ...

    Hi George,

    I've done several other tutorials (the videos here, first 2 series of reimers terrain and some on ziggyware) before I started with the hazymind tut, it's still all very new to me tho.

    Anyway, found the problem which I should've noticed a lot sooner :/, my vertexdeclaration was using VertextPostionTexture instead of VertextPositionColor. clicky

Page 1 of 1 (3 items) Previous Next