Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6725689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:50:15+00:00 2026-05-26T09:50:15+00:00

I rendering hex grid plane, getting result: http://gyazo.com/0a008cc909138c7e3c1368e0078c7695 Grid distorted. Please help – what

  • 0

I rendering hex grid plane, getting result: http://gyazo.com/0a008cc909138c7e3c1368e0078c7695

Grid distorted. Please help – what could be reason for this and how to fix?
I suppose it happens because of overlaying transparencies, but have no idea how to resolve it without changing mesh to hexes.

Textures file looks: http://gyazo.com/0fea1cb07e52976dc9427b74ab23a252
(it has size 256x256px)

Fragment shader:

vec4 textureColor0 = texture2D(uSampler0, vec2(vTextureCoord.s, vTextureCoord.t));
gl_FragColor = vec4(textureColor0.rgb, textureColor0.a);

Mesh position: -10, -10, -26.99f, while camera: -5, -2, -20 and angle: -8, 0, -22

Mesh generation code:

public static MeshData makePlane(int w, int h) {
float[] planeVerts = new float[12 * w * h];
float[] planeNormals = new float[planeVerts.length];
float[] planeTexCoords = new float[8 * w * h];
int[] planeTriangles = new int[6 * w * h];
{
int idx = 0;
for (int x = 0; x < w; x++) {
  for (int y = 0; y < h; y++) {
    planeVerts[idx] = x * 0.8f;
    planeVerts[idx + 1] = y + 0.5f * x;
    planeVerts[idx + 2] = 0;
    planeVerts[idx + 3] = x * 0.8f;
    planeVerts[idx + 4] = y + 1 + 0.5f * x;
    planeVerts[idx + 5] = 0;
    planeVerts[idx + 6] = x * 0.8f + 1;
    planeVerts[idx + 7] = y + 1 + 0.5f * x;
    planeVerts[idx + 8] = 0;
    planeVerts[idx + 9] = x * 0.8f + 1;
    planeVerts[idx + 10] = y + 0.5f * x;
    planeVerts[idx + 11] = 0;
    idx += 12;
  }
}
}
for (int i = 0; i < planeVerts.length; i+=3) {
  planeNormals[i] = 0;
  planeNormals[i + 1] = 0;
  planeNormals[i + 2] = 1;
}
for (int idx = 0; idx < planeTexCoords.length; idx += 8) {
  if (idx % 32 == 0) {
    planeTexCoords[idx] = 0;
    planeTexCoords[idx + 1] = 0.5f;
    planeTexCoords[idx + 2] = 0;
    planeTexCoords[idx + 3] = 0;
    planeTexCoords[idx + 4] = 0.5f;
    planeTexCoords[idx + 5] = 0;
    planeTexCoords[idx + 6] = 0.5f;
    planeTexCoords[idx + 7] = 0.5f;
  } else {
    planeTexCoords[idx] = 0;
    planeTexCoords[idx + 1] = 1;
    planeTexCoords[idx + 2] = 0;
    planeTexCoords[idx + 3] = 0.5f;
    planeTexCoords[idx + 4] = 0.5f;
    planeTexCoords[idx + 5] = 0.5f;
    planeTexCoords[idx + 6] = 0.5f;
    planeTexCoords[idx + 7] = 1;
  }
}
for (int idx = 0; idx < planeTriangles.length; idx += 6) {
  planeTriangles[idx] = idx * 4 / 6;
  planeTriangles[idx + 1] = idx * 4 / 6 + 1;
  planeTriangles[idx + 2] = idx * 4 / 6 + 2;
  planeTriangles[idx + 3] = idx * 4 / 6;
  planeTriangles[idx + 4] = idx * 4 / 6 + 2;
  planeTriangles[idx + 5] = idx * 4 / 6 + 3;
}
return new MeshData(planeVerts, planeTriangles, planeNormals, planeTexCoords);

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T09:50:16+00:00Added an answer on May 26, 2026 at 9:50 am

    It looks like simple depth-buffer fighting — the transparent pixels from one polygon are affecting the depth buffer even though they end up having no effect no the colour buffer. So then when a visible pixel that is logically at exactly the same depth gets through the pipeline it may or may not be drawn depending on your depth comparison function and accumulated precision errors.

    I think I’m right to say that WebGL follows ES 2.0 in not having the alpha test, so probably you want to modify your fragment shader — compare alpha to a certain threshold and if the fragment is below that threshold then discard it.

    Alternatively, if there’s any way you can draw that grid with depth buffering disabled then that’s probably worth following up. Maybe you could draw it last with depth comparison enabled but depth writes disabled, or draw it first with the depth buffer completely disabled and then drawn a single invisible polygon covering the whole plane in order to prime the depth buffer?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Getting a rendering error for this form: 'NoneType' object has no attribute 'widget' http://dpaste.com/88585/
I have a problem rendering the login page. I have followed this turtorial: http://www.dixis.com/?p=352
When rendering a view in an ASP.NET MVC application, I am getting the following
Iam rendering a menu (using Zend framework) (zend_navigation) what iam doing is getting the
While rendering the view page, based on some condition in the controller action I
I am rendering a rails partial and I want to alternate the background color
I'm having major rendering issues in Safari with the web application I'm working on.
If I'm rendering a regular view in asp.net mvc the only domain object properties
I am rendering an OpenGL scene that include some bitmap text. It is my
I am actually rendering an excel file in the browser. I use the Response.Writefile(filePath)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.