Author Topic: Render error  (Read 3207 times)

Akari

  • *
  • Posts: 766
    • View Profile
Render error
« on: 2005-11-03 02:38:29 »
I try to render models from xenogears but when I put textures on it I have some funny ladder effect. It always happened just in few places. And then I rotate model it moving.

Could anyone help me just by looking at this. I'm not good when it comes to textures  :z



Cyberman

  • *
  • Posts: 1572
    • View Profile
Render error
« Reply #1 on: 2005-11-03 18:35:48 »
It may be the order in which you are drawing the vertices that's the problem.  I believe in OGL you must draw the triangle's vertices in the correct order in order NOT to get a transparent triangle. That determines the surface normal (which is calculated after you do a glend() for the triangle), if the surface normal is pointing away from the POV it won't be a visable triangle.  So it may make some triangles invisible.  If you have quadrics in your data be CERTIAN you are drawing the right vertices AND they have the surface normal in the right direction for it to be visable.

Why do I say this? Ummm  :oops:  I did that before :D

The triangles with the normals in the 'wrong' direction are removed during the CULLing phase is why they disappear or become black.

Cyb

ficedula

  • *
  • Posts: 2178
    • View Profile
    • http://www.ficedula.co.uk
Render error
« Reply #2 on: 2005-11-03 20:24:48 »
That's called backface culling; and I'm not sure whether it's enabled by default or not. In any case, you can disable it using glDisable as per normal, or control the face winding with glCullFace, IIRC.

...but I'm not sure if it would produce those effects, anyway. Possibly something to do with the near Z plane being set too close to the camera?

mirex

  • *
  • Posts: 1645
    • View Profile
    • http://mirex.mypage.sk
Render error
« Reply #3 on: 2005-11-04 07:07:08 »
If by 'rendering' you mean that you render them through your engine, then it could be caused by issuing wrong UV texcoords to the vertices. Maybe you adress them from some incorrect memory which is changing, and that's why they are moving.

Things like this probably do not happen by switching some 3d effect in OpenGl.

Akari

  • *
  • Posts: 766
    • View Profile
Render error
« Reply #4 on: 2005-11-04 07:12:42 »
Well... the problem seems has been solved.

Quote
Possibly something to do with the near Z plane being set too close to the camera?


First problem (it was circled) vanished after I moved near Z plane.

The second one appeared because triangle texture coords format a bit different than quad (order are c, a, b instead a, b, c, d for quad).

Now all looks much better  :wink:  thanks



Quote
It may be the order in which you are drawing the vertices that's the problem. I believe in OGL you must draw the triangle's vertices in the correct order in order NOT to get a transparent triangle. That determines the surface normal (which is calculated after you do a glend() for the triangle), if the surface normal is pointing away from the POV it won't be a visable triangle. So it may make some triangles invisible. If you have quadrics in your data be CERTIAN you are drawing the right vertices AND they have the surface normal in the right direction for it to be visable.


Hmm... i haven't found normals info yet. I think the two offsets in header that points to the same block are the vertex and normals info. (In field and battle models sometimes they points to different block, but not in battle backgrount that I'm looking ^^'')

Cyberman

  • *
  • Posts: 1572
    • View Profile
Render error
« Reply #5 on: 2005-11-05 04:58:26 »
Note that since Xenogears was made for the PS1 the coordinates for the quads are different  :D
A B C D doesn't work.  This is because quads are done as 2 triangles internally. So in order to know the correct ordering you have to split the quad into 2 triangles A B D and B C D. Though you can use the GL QUAD primitive it's the texture coordinates that will be interesting. Likely why I haven't been able to get FF7 textured quads to render :D

Cyb