Skip to main content
gamedev.net
🔒 Locked 🎮 Unity

Problem rendering terrain

Started by onnel 2 replies 600+ views
Original Post
onnel
onnel
I know this (or very similar questions) has been answered before, but even with the illustrious search engine working I couldn't find anything. My problem is that my terrain doesn't render properly (unlike everything else). I am only getting a "sliver" - like a thick line running from the upper left corner of my view towards the center of the screen. If I move my camera, the "sliver" moves with it (i.e., it doesn't seem to be rendered in world space, but in camera/view space). I assume this has something to do with not setting one of my viewing or projection matrices before rendering, but I'm fairly lost, since as far as I can tell, I render it exactly like all of my other objects. Basically steps are: 1. Save existing world transform 2. Calculate new world transform based on the location my terrain should render 3. Set the new world transform 4. Render terrain (using DrawIndexedPrimitive with a D3DPT_TRIANGLELIST) 5. Revert to my old world transform Ideas? Thanks and apologies again for a question which I know I've seen asked before. Onnel
jimmynelson
jimmynelson
It can be all kinds of problems, bad mesh, setting up the view or projection wrong. You might have the render states wrong... All kinds of things. To me it sounds like it may be view or projection if are getting weird distortions. But if you are sure those are set right I am at a lost.

First step though for checking world transform though is setting it too the identity. When you render your object should be at 0,0,0 with no rotations.

Also you said you are using a triangle list, do some debugging on that to make sure it is working ok. You might be overrendering and getting garbage tri's whihc end up rendering crazy (like if you declare an array of triangles and render 3-4 past that). But you concepts of rendering are good.
Karl G
Karl G
That REEAAALY sounds like either (a) you haven't set your matrices correctly, or (b) your vertices' positions are really high values, like 4.4421321e56. This is caused by you not setting all of the vertex values you think you are (make sure you increment your variables in FOR loops!) or referencing a vertex that is out of the range of the buffer. Usually D3D will scream at you if you do this, but if you don't have debugging turned up and/or you aren't checking the DIP/DP/DS return codes, it could slip by.
onnel
onnel
Ooh..that sounds likely. will check the vertex values and the order they are referecned in!

Thanks!

Onnel

Quote:
Original post by Karl G
That REEAAALY sounds like either (a) you haven't set your matrices correctly, or (b) your vertices' positions are really high values, like 4.4421321e56. This is caused by you not setting all of the vertex values you think you are (make sure you increment your variables in FOR loops!) or referencing a vertex that is out of the range of the buffer. Usually D3D will scream at you if you do this, but if you don't have debugging turned up and/or you aren't checking the DIP/DP/DS return codes, it could slip by.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.