Results 1 to 10 of 10

Thread: Pixel Shader Help

  1. #1
    LoveMHz
    Guest LoveMHz's Avatar

    HLSL Shader Help

    Not sure if this is the correct section or not, but what the hell.. First off I'm quite new to HLSL and I've been having problems left and right. I thought I understood it fairly well until I could not draw vertexes with color.
    :dammit:

    Rendered with Primitive Type: D3DPT_LINESTRIP
    http://lovemhz.teamxelove.com/192.168.137.3-image7.jpg

    Rendered with Primitive Type: D3DPT_TRIANGLELIST
    http://lovemhz.teamxelove.com/192.168.137.3-image9.jpg

    Test Source:
    http://pastebin.ca/Y7cW9xar
    Password: pass

    Thanks,
    LoveMHz
    Last edited by LoveMHz; 06-03-2010 at 08:27 PM.

  2. #2
    Looks like these verts are in a triangle list. Although your culling is ass backwards. But that could just be because your rendering it as a wireframe and not as a solid mesh. You may have to re-arrange the verts and play around with the culling and fill mode. I'll play around with this some tomorrow, here's examples on setting the cull mode and fill mode:

    g_pd3dDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW);
    g_pd3dDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
    Last edited by TheFallen93; 06-03-2010 at 10:36 PM.

  3. #3
    LoveMHz
    Guest LoveMHz's Avatar
    Quote Originally Posted by TheFallen93 View Post
    Looks like these verts are in a triangle list. Although your culling is ass backwards. But that could just be because your rendering it as a wireframe and not as a solid mesh. You may have to re-arrange the verts and play around with the culling and fill mode. I'll play around with this some tomorrow, here's examples on setting the cull mode and fill mode:

    g_pd3dDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW);
    g_pd3dDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
    I played around with cullmode yesterday without much luck. I'll see what the different fillmodes do when I get home. Hopefully it's not an issue with the arragement with the verts. I need to reupload the code though, I accidently had my ARGB mixed up.

  4. #4
    D3DPT_TRIANGLELIST is correct but I think you're ignoring the alpha value (it's 0xFF everywhere I see)
    How do you expect it to achieve transparency when it's all overlaying each other? :)
    Maybe you want to use a specific color to specify transparency? I don't know... in that case, I'd adjust the ps/vs for it...

  5. #5
    LoveMHz
    Guest LoveMHz's Avatar
    Quote Originally Posted by le uberfry View Post
    D3DPT_TRIANGLELIST is correct but I think you're ignoring the alpha value (it's 0xFF everywhere I see)
    How do you expect it to achieve transparency when it's all overlaying each other? :)
    Maybe you want to use a specific color to specify transparency? I don't know... in that case, I'd adjust the ps/vs for it...
    0xFF is used in the HLSL Triangle sample and works (Which is what the above code is based on for simplicity). No idea why its not working.

  6. #6
    LoveMHz
    Guest LoveMHz's Avatar
    Fixed it.. Damn cullmode. Thanks Fallen.

    http://i48.tinypic.com/zlpumg.jpg

    Still some bugs left though, but I think I have it now =)
    Last edited by LoveMHz; 06-04-2010 at 04:48 PM.

  7. #7
    You also need to make sure your ZBUFFER is set to the correct thing, it looks like your zbuffer is set up for a buffer wallhack style. I make hacks for PC games and do D3D. Heres a sample.

    pDevice->SetRenderState( D3DRS_ZENABLE,false ); pDevice->SetPixelShader(sa.sYellow); //Behind Something
    if (VisualHacks[5])
    pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
    else
    pDevice->SetRenderState( D3DRS_FILLMODE,D3DFILL_SOLID );
    oDrawIndexedPrimitive(pDevice, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
    pDevice->SetRenderState( D3DRS_ZENABLE, true ); pDevice->SetRenderState( D3DRS_FILLMODE,D3DFILL_SOLID ); pDevice->SetPixelShader(sa.sYellow);
    oDrawIndexedPrimitive(pDevice, PrimType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
    Pretty much chams in a nutshell, but you can see how you can do whatever you want with the right stuff.

  8. #8
    Quote Originally Posted by LoveMHz View Post
    0xFF is used in the HLSL Triangle sample and works (Which is what the above code is based on for simplicity). No idea why its not working.
    The colorful "primitives" are inside the gray primitives, which is why I thought that maybe you'd forgotten the alpha layer...
    Look at it this way - fat guy is in front of the whole theater, you can't see shit, so you shout: "yo bro, your alpha layer ain't nowhere near 0!"
    Otherwise, code a vs/ps to convert a specific color (here: gray? I'd pick pink) into the alpha value.

  9. #9
    LoveMHz
    Guest LoveMHz's Avatar
    Quote Originally Posted by le uberfry View Post
    The colorful "primitives" are inside the gray primitives, which is why I thought that maybe you'd forgotten the alpha layer...
    Look at it this way - fat guy is in front of the whole theater, you can't see shit, so you shout: "yo bro, your alpha layer ain't nowhere near 0!"
    Otherwise, code a vs/ps to convert a specific color (here: gray? I'd pick pink) into the alpha value.
    And that clarifies the next bug on the list. Thanks bro. Ohh I mean You Go Girl!
    Last edited by LoveMHz; 06-04-2010 at 11:31 PM.

  10. #10
    nvm
    Last edited by le uberfry; 06-05-2010 at 02:33 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •