Results 1 to 17 of 17

Thread: Textures Are Goings Crazy

  1. #1

    Thread Starter
    PowerPoster Halsafar's Avatar
    Join Date
    Jun 2004
    Location
    Saskatoon, SK
    Posts
    2,339

    Textures Are Goings Crazy

    The textures on certain triangles are getting like completly messed up as I move towards or away from an object.

    It looks as if the texture starts to crawl across whatever it is on.
    It keeps crawling as you walk towards it, as you get close the crawling gets more towards the edge.
    Once you are pretty much right in front of an object the texture looks fine.

    You can download the game here:
    http://members.shaw.ca/shinhalsafar/SagaEngine.zip

    Please do I cannot figure this out.

    I don't suggest running in windowed mode. Although it should work just fine. I use it all the time
    All you need is DX7 or higher installed.
    I tested the zip on another comp and it worked fine.

    W/S/A/D/Q/E/MOUSE - All the movement you need
    ESC - Quit
    Add/Subtract button on numpad - Music Up/Down

    Do see a good example of this...Turn around from where you start, you should see a cube in the middle of no where. Walk towards it and watch the edges....Notice the messed up texture.

    Edit:

    Also, yes the terrain looks kinda odd, but it is set to show this problem at its worst.

    This is not just on the terrain tho. It is on anything I render. This texture problem goes through everything.
    Last edited by Halsafar; Nov 30th, 2004 at 12:04 AM.
    "From what was there, and was meant to be, but not of that was faded away." - - Steve Damm

    "The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm

    "When you do things right, people won't be sure if you did anything at all." - - God from Futurama

  2. #2
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    Had a look and it seems fine, I do see the thing you mean but that looks liek its just because those triangles were vertical and streched quite a bit, try increasing the Z-Buffer. I've also attached a alteration to your height map and its alot smoother, it doesn't cause that effect .
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  3. #3
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    Would help if I'd attached it:
    Attached Images Attached Images  
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  4. #4

    Thread Starter
    PowerPoster Halsafar's Avatar
    Join Date
    Jun 2004
    Location
    Saskatoon, SK
    Posts
    2,339
    I'd like to shake your hand.

    For two reasons:
    One cause when you tell me exactly how you got such a nice bmp height map. I'm goona be one happy man.

    I am only using the R value from each pixel multiplied by the scale / 20. I wish to fix this but I have to because I get gigantic peaks if I leave it as Scale / 2 which is a good place to start.

    What is the best way to deal with a gray scale bitmap??/

    Two, because you pointed out a problem which was freaking me out. I had no idea what was going on at all. Your simply change to my pathetic height map smoothed the transitions from land to hills very nicely. Looks great, textures don't do that funky stuff.


    Questions:
    What do you mean by increasing the zbuffer???
    The buildings do that. Those quads are verticles. They look quite messed as you walk towards them. Any solution?
    Could it be the normals?

    The normals for every vertice on my landscape is (0,0,0)
    The normals for each quad on the building is proper according to its position:
    // Define the normals for the cube
    D3DVECTOR n0( 0.0f, 0.0f,-1.0f ); // Front face
    D3DVECTOR n1( 0.0f, 0.0f, 1.0f ); // Back face
    D3DVECTOR n2( 0.0f, 1.0f, 0.0f ); // Top face
    D3DVECTOR n3( 0.0f,-1.0f, 0.0f ); // Bottom face
    D3DVECTOR n4( 1.0f, 0.0f, 0.0f ); // Right face
    D3DVECTOR n5(-1.0f, 0.0f, 0.0f ); // Left face

    What else could be creating that crawling effect on the cubes?
    "From what was there, and was meant to be, but not of that was faded away." - - Steve Damm

    "The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm

    "When you do things right, people won't be sure if you did anything at all." - - God from Futurama

  5. #5

    Thread Starter
    PowerPoster Halsafar's Avatar
    Join Date
    Jun 2004
    Location
    Saskatoon, SK
    Posts
    2,339
    Using the map you sent me...The weird crawling textures only appear very very rarely and only at certain points on the terrain.

    If I use trianglestrip and order the indices to render quads in the proper orientation....The crawling textures appear all over all of the terrain and they move as I move.

    Each messed up peiece of texture is a triangle seemingly switching between showing a proper version of the texture to a inverted upsidedown version....

    Using quads with trianglestrip I am able to go under the terrain and see it all still.


    Do I need to set any renderstates? texturestagestates?

    I am not setting ANY except Ambient lighting
    Last edited by Halsafar; Nov 30th, 2004 at 03:17 PM.
    "From what was there, and was meant to be, but not of that was faded away." - - Steve Damm

    "The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm

    "When you do things right, people won't be sure if you did anything at all." - - God from Futurama

  6. #6

    Thread Starter
    PowerPoster Halsafar's Avatar
    Join Date
    Jun 2004
    Location
    Saskatoon, SK
    Posts
    2,339
    (fires a gun in the air jumping around like old school texan)

    Changed my near plane from 10.0f to 100.0f
    Far plane is at 100000.0f

    The texture problem seems to be non existant now.
    Is this a proper fix?


    I can run my terrain through strips and lists without any texture problems.
    The building (the cube) No longer does it either.


    With trilist I noticed now and then I could see parts of the terrain through mountains at VERY far distances....Increasing the near plane also fixed that.


    Now, if I use LineStrip while it is set up for TriangleStrip...to achieve a wireframe...Every quad has a line going from it to an infinite point nowhere in 3d space.
    Last edited by Halsafar; Nov 30th, 2004 at 03:55 PM.
    "From what was there, and was meant to be, but not of that was faded away." - - Steve Damm

    "The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm

    "When you do things right, people won't be sure if you did anything at all." - - God from Futurama

  7. #7

    Thread Starter
    PowerPoster Halsafar's Avatar
    Join Date
    Jun 2004
    Location
    Saskatoon, SK
    Posts
    2,339
    Weird line problem:
    Attached Images Attached Images  
    "From what was there, and was meant to be, but not of that was faded away." - - Steve Damm

    "The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm

    "When you do things right, people won't be sure if you did anything at all." - - God from Futurama

  8. #8
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    The Z-Buffer will be somethign like D3DFMT_D32, but only certain formats are available on each card.

    As for the Triangle lists & Strips I'm not sure how your just switching between one and another . I mean like the indices are set up for either one or the other, you can't just change the way you render it without getting errors, or bugs. Fixing that could sort out your lines problem too.

    I did the height map is Paint Shop Pro. It has a soften tool which blends things to gether so its smooth .
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  9. #9
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    BTW you know how when you rotate the camera in your game it is rotating around where your looking not the other way round. Well thats what happened when I tried to do that thing where I told you your meant to change the camera not the world and all that stuff. Thats why I thought it didn't work well.
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  10. #10
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Originally posted by Electroman
    The Z-Buffer will be somethign like D3DFMT_D32, but only certain formats are available on each card.

    32 bit is not offered on many GPUs, 24 is safer...but still....W-buffer is an other type, but again, not very well supported.

    THis is definitly something we should talk about in a tutorial ME thinks.


    ØØ

  11. #11
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    yea, my old ATi used to support 32bit and I loved it, I hate it that my nVidia one at the moment only has 24bit. I can see bugs pop up cause its not big enough and I can't do anything about it . I always make my code so it tries D3DFMT_D32, D3DFMT_D24S8, D3DFMT_D24X4S4, D3DFMT_D24X8 then D3DFMT_D16. Using the best it can support .
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  12. #12
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349
    What I would do if I were you is enumerate the Z-Buffers. Start checking if it supports the lowest all the way to the highest. Here's what Jack Hoxley did on DirectX4VB:

    VB Code:
    1. If D3D.CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, DispMode.Format, D3DUSAGE_DEPTHSTENCIL, _
    2.         D3DRTYPE_SURFACE, D3DFMT_D16) = D3D_OK Then
    3.     Debug.Print "16 bit Z-Buffers are supported (D3DFMT_D16)"
    4. End If
    5.  
    6. If D3D.CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, DispMode.Format, D3DUSAGE_DEPTHSTENCIL, _
    7.         D3DRTYPE_SURFACE, D3DFMT_D16_LOCKABLE) = D3D_OK Then
    8.     Debug.Print "Lockable 16 bit Z-Buffers are supported (D3DFMT_D16_LOCKABLE)"
    9. End If
    10.  
    11. If D3D.CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, DispMode.Format, D3DUSAGE_DEPTHSTENCIL, _
    12.         D3DRTYPE_SURFACE, D3DFMT_D24S8) = D3D_OK Then
    13.     Debug.Print "32 bit divided between 24 bit Depth and 8 bit stencil are supported (D3DFMT_D24S8)"
    14. End If
    15.  
    16. If D3D.CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, DispMode.Format, D3DUSAGE_DEPTHSTENCIL, _
    17.         D3DRTYPE_SURFACE, D3DFMT_D24X4S4) = D3D_OK Then
    18.     Debug.Print "32 bit divided between 24 bit depth, 4 bit stencil and 4 bit unused (D3DFMT_D24X4S4)"
    19. End If
    20.  
    21. If D3D.CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, DispMode.Format, D3DUSAGE_DEPTHSTENCIL, _
    22.         D3DRTYPE_SURFACE, D3DFMT_D24X8) = D3D_OK Then
    23.     Debug.Print "24 bit Z-Buffer supported (D3DFMT_D24X8)"
    24. End If
    25.  
    26. If D3D.CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, DispMode.Format, D3DUSAGE_DEPTHSTENCIL, _
    27.         D3DRTYPE_SURFACE, D3DFMT_D32) = D3D_OK Then
    28.     Debug.Print "Pure 32 bit Z-buffer supported (D3DFMT_D32)"
    29. End If

    Comes in handy. It helps my DirectX8 programs become more compatible with the various video cards out there and uses the most precise Z Buffer available. If you are using C++ (I bet you are), converting this snippet of code should be no problem.

  13. #13
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    Ta da....
    Code:
    if (g_pD3D->CheckDepthStencilMatch(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, g_d3dpp.BackBufferFormat, g_d3dpp.BackBufferFormat, D3DFMT_D32) == S_OK)
    {
    	// 32bit supported...
    	g_d3dpp.AutoDepthStencilFormat = D3DFMT_D32;
    }
    else if (g_pD3D->CheckDepthStencilMatch(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, g_d3dpp.BackBufferFormat, g_d3dpp.BackBufferFormat, D3DFMT_D24S8) == S_OK)
    {
    	// 24bit supported...
    	g_d3dpp.AutoDepthStencilFormat = D3DFMT_D24S8;
    }
    else if (g_pD3D->CheckDepthStencilMatch(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, g_d3dpp.BackBufferFormat, g_d3dpp.BackBufferFormat, D3DFMT_D24X4S4) == S_OK)
    {
    	// 24bit supported...
    	g_d3dpp.AutoDepthStencilFormat = D3DFMT_D24X4S4;
    }
    else if (g_pD3D->CheckDepthStencilMatch(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, g_d3dpp.BackBufferFormat, g_d3dpp.BackBufferFormat, D3DFMT_D24X8) == S_OK)
    {
    	// 24bit supported...
    	g_d3dpp.AutoDepthStencilFormat = D3DFMT_D24X8;
    }
    else if (g_pD3D->CheckDepthStencilMatch(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, g_d3dpp.BackBufferFormat, g_d3dpp.BackBufferFormat, D3DFMT_D16) == S_OK)
    {
    	// 16bit supported...
    	g_d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
    }
    else
    {
    	// No supported type could be found...
    	return NOSTENCILFOUND;
    }
    I think it was noteme that made me do it this way. the way i used to do it in VB was to just try and create the device using the best ZBuffer and if it caused an error then I tried the next one down. I believe that was Dx4VB I had got that from but it doesn't really make a differance I guess .
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  14. #14

    Thread Starter
    PowerPoster Halsafar's Avatar
    Join Date
    Jun 2004
    Location
    Saskatoon, SK
    Posts
    2,339
    I guess it would be smart to enum zbuffers and use the most powerful one.

    Thanks guys.
    "From what was there, and was meant to be, but not of that was faded away." - - Steve Damm

    "The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm

    "When you do things right, people won't be sure if you did anything at all." - - God from Futurama

  15. #15

    Thread Starter
    PowerPoster Halsafar's Avatar
    Join Date
    Jun 2004
    Location
    Saskatoon, SK
    Posts
    2,339
    Originally posted by Electroman
    BTW you know how when you rotate the camera in your game it is rotating around where your looking not the other way round. Well thats what happened when I tried to do that thing where I told you your meant to change the camera not the world and all that stuff. Thats why I thought it didn't work well.

    Are you saying the way I am doing it isn't working well?
    Should I be moving the world instead???

    Also, movement button are not moving the camera, they are moving the player, which is not visible in any aspect but has a position.
    The camera is updated to a position behind the player.

    Isn't that how it is suppose to be done?

    The reason it acts weird is because of the way the y value of the camera is being set.
    Last edited by Halsafar; Dec 1st, 2004 at 12:21 AM.
    "From what was there, and was meant to be, but not of that was faded away." - - Steve Damm

    "The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm

    "When you do things right, people won't be sure if you did anything at all." - - God from Futurama

  16. #16
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    ow well if your going to be placing a mesh for the player infront of the camera then that is ok. I thought the camera was meant to be the camera cos then it just seemed wierd, like when you move the mouse to look left it swings around a point infront of the camera instead of just turning on the spot.
    I also found it counter inturitive, when you move the mouse up the camera tilts down .

    I don't think your using the wrong method just that your rotating around the wrong point, I found when I used the method I mentioned I could only get it to do what yours does and not the FPS way . Probably possible but i couldn't do it back then.
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  17. #17

    Thread Starter
    PowerPoster Halsafar's Avatar
    Join Date
    Jun 2004
    Location
    Saskatoon, SK
    Posts
    2,339
    Whats the FPS way?

    Also, the camera I am using is a very primitive form of GTA3 PC camera.
    It stays focused on you and swings around your points...
    Of course GTA3 is a 'working' version of my camera.

    I have a better way to do it, but right now I just need to explore my world in anyway.


    The y value of the camera is being set to place the camera at an UpAngle from the player pos. I am not doing that correctly, which is why it looks like that.

    See:
    PHP Code:
    //This is how it was
    /*        m_From.x = m_Player.x - ((m_VectorCircle[m_Angle].u) * m_Away);
            m_From.y = m_Player.y + ((m_VectorCircle[m_UpAngle].v) * (m_Away*2));
            m_From.z = m_Player.z - ((m_VectorCircle[m_Angle].v) * m_Away);*/

    //Ths is how it should be.
    m_From.m_Player.x-(m_VectorCircle[m_Angle].u*m_Away)*(m_VectorCircle[m_UpAngle].u);
    m_From.m_Player.y+(m_VectorCircle[m_UpAngle].m_Away);
    m_From.m_Player.z-(m_VectorCircle[m_Angle].v*m_Away)*(m_VectorCircle[m_UpAngle].u); 
    Last edited by Halsafar; Dec 1st, 2004 at 11:27 AM.
    "From what was there, and was meant to be, but not of that was faded away." - - Steve Damm

    "The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm

    "When you do things right, people won't be sure if you did anything at all." - - God from Futurama

Posting Permissions

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



Click Here to Expand Forum to Full Width